Skip to content

Commit

Permalink
v1.461: bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jks-prv committed Jul 14, 2021
1 parent 3628c3d commit fef9092
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 79 deletions.
6 changes: 6 additions & 0 deletions CHANGE_LOG
Expand Up @@ -2,6 +2,12 @@ CHANGE_LOG

For the Github commit log see here: github.com/jks-prv/Beagle_SDR_GPS/commits/master

v1.461 July 15, 2021
Bug fixes:
MW 9/10 kHz step applies up to 1710 kHz regardless of selected ITU mode.
Default frequency step restored to 5 kHz.
Mode selection allowed during recording except those that would change mono/stereo condition.

v1.460 May 24, 2021
Fix needed by the KiwiSDR Android app (from the Google Play store).
Match frequency step amounts between "snap to nearest" mode and L/R arrow keys.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,5 +1,5 @@
VERSION_MAJ = 1
VERSION_MIN = 460
VERSION_MIN = 461

# Caution: software update mechanism depends on format of first two lines in this file

Expand Down
139 changes: 139 additions & 0 deletions bits.h
@@ -0,0 +1,139 @@
#pragma once

// NB: using e.g. "Bn" here instead of "BTn" conflicts with system include files

#define BT0 0x00000001
#define BT1 0x00000002
#define BT2 0x00000004
#define BT3 0x00000008

#define BT4 0x00000010
#define BT5 0x00000020
#define BT6 0x00000040
#define BT7 0x00000080

#define BT8 0x00000100
#define BT9 0x00000200
#define BT10 0x00000400
#define BT11 0x00000800

#define BT12 0x00001000
#define BT13 0x00002000
#define BT14 0x00004000
#define BT15 0x00008000

#define BT16 0x00010000
#define BT17 0x00020000
#define BT18 0x00040000
#define BT19 0x00080000
#define BT20 0x00100000

#define BT31 0x80000000

// bits
#define b0(w) (((w) >> 0) & 1)
#define b1(w) (((w) >> 1) & 1)
#define b2(w) (((w) >> 2) & 1)
#define b3(w) (((w) >> 3) & 1)
#define b4(w) (((w) >> 4) & 1)
#define b5(w) (((w) >> 5) & 1)
#define b6(w) (((w) >> 6) & 1)
#define b7(w) (((w) >> 7) & 1)

#define b8(w) (((w) >> 8) & 1)
#define b9(w) (((w) >> 9) & 1)
#define b10(w) (((w) >> 10) & 1)
#define b11(w) (((w) >> 11) & 1)
#define b12(w) (((w) >> 12) & 1)
#define b13(w) (((w) >> 13) & 1)
#define b14(w) (((w) >> 14) & 1)
#define b15(w) (((w) >> 15) & 1)

#define b16(w) (((w) >> 16) & 1)
#define b17(w) (((w) >> 17) & 1)
#define b18(w) (((w) >> 18) & 1)
#define b19(w) (((w) >> 19) & 1)
#define b20(w) (((w) >> 20) & 1)
#define b31(w) (((w) >> 31) & 1)

#define bn(w,b) ( ((w) & (1 << (b)))? 1:0 )
#define bf(f,s,e) ( ((f) >> (e)) & ((1 << ((s)-(e)+1)) - 1) )
#define bf64(f,s,e) ( ((f) >> (e)) & ((1LL << ((s)-(e)+1)) - 1LL) )

#define b7_0(w) ((w) & H8)
#define b15_8(w) (((w) >> 8) & H8)

#define BIT(w,b) bn(w,b)
#define BIS(w,b) (w) |= 1 << (b)
#define BIC(w,b) (w) &= ~(1 << (b))
#define BIW(w,b) ( ((w) & ~(1 << (b))) | (1 << (b)) )


// field combine

#define FC2(f1,s1, f0,s0) \
((f1) << (s1) | (f0) << (s0))

#define FC3(f2,s2, f1,s1, f0,s0) \
((f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define FC4(f3,s3, f2,s2, f1,s1, f0,s0) \
((f3) << (s3) | (f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define FC5(f4,s4, f3,s3, f2,s2, f1,s1, f0,s0) \
((f4) << (s4) | (f3) << (s3) | (f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define FC6(f5,s5, f4,s4, f3,s3, f2,s2, f1,s1, f0,s0) \
((f5) << (s5) | (f4) << (s4) | (f3) << (s3) | (f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define FC7(f6,s6, f5,s5, f4,s4, f3,s3, f2,s2, f1,s1, f0,s0) \
((f6) << (s6) | (f5) << (s5) | (f4) << (s4) | (f3) << (s3) | (f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define FC8(f7,s7, f6,s6, f5,s5, f4,s4, f3,s3, f2,s2, f1,s1, f0,s0) \
((f7) << (s7) | (f6) << (s6) | (f5) << (s5) | (f4) << (s4) | (f3) << (s3) | (f2) << (s2) | (f1) << (s1) | (f0) << (s0))

#define m0(w) ((w)? BT0 : 0)
#define m1(w) ((w)? BT1 : 0)
#define m2(w) ((w)? BT2 : 0)
#define m3(w) ((w)? BT3 : 0)
#define m4(w) ((w)? BT4 : 0)
#define m5(w) ((w)? BT5 : 0)
#define m6(w) ((w)? BT6 : 0)
#define m7(w) ((w)? BT7 : 0)

#define m8(w) ((w)? BT8 : 0)
#define m9(w) ((w)? BT9 : 0)
#define m10(w) ((w)? BT10 : 0)
#define m11(w) ((w)? BT11 : 0)
#define m12(w) ((w)? BT12 : 0)
#define m13(w) ((w)? BT13 : 0)
#define m14(w) ((w)? BT14 : 0)
#define m15(w) ((w)? BT15 : 0)

#define m16(w) ((w)? BT16 : 0)
#define m17(w) ((w)? BT17 : 0)
#define m18(w) ((w)? BT18 : 0)
#define m19(w) ((w)? BT19 : 0)
#define m20(w) ((w)? BT20 : 0)
#define m31(w) ((w)? BT31 : 0)

// mask field
#define mf(s,e) ( ((1 << (s+1)) - 1) & ~((1 << (e)) - 1) )

// bit field set
#define bfs(dst,s,e,src) ( ((dst) & ~mf(s,e)) | ((src) << (e)) )

// bit set
#define bset_v(dst,v,src) ( ((dst) & ~(v)) | (((src) & (v))? (v) : 0) )
#define bset_n(dst,b,src) ( ((dst) & ~mf(b,b)) | (((src) & (1 << (b)))? (1 << (b)) : 0) )


// black on color unless otherwise noted
#define RED "\e[97m\e[101m" // white on red
#define YELLOW "\e[103m"
#define GREEN "\e[102m"
#define CYAN "\e[106m"
#define BLUE "\e[97m\e[104m" // white on blue
#define MAGENTA "\e[97m\e[105m" // white on magenta
#define GREY "\e[47m"
#define NORM "\e[m"
9 changes: 9 additions & 0 deletions extensions/example/example.cpp
Expand Up @@ -69,15 +69,24 @@ void example_close(int rx_chan)
ext_unregister_receive_iq_samps(e->rx_chan);
}


// NB: To capitalize the name in the extension menu while using lowercase in program code
// follow the capitalization used below, e.g. EXAMPLE_main()
// AND capitalize the name of this directory.

//void EXAMPLE_main();
void example_main();

ext_t example_ext = {
//"EXAMPLE",
"example",
//EXAMPLE_main,
example_main,
example_close,
example_msgs,
};

//void EXAMPLE_main()
void example_main()
{
// commented out so extension doesn't actually appear
Expand Down
2 changes: 1 addition & 1 deletion extensions/iq_display/iq_display.cpp
Expand Up @@ -112,7 +112,7 @@ class iq_display {
}

void set_sample_rate(float fs) {
_fs = fs;
_fs = fs;
_maNsend = fs/4;
pll_init();
}
Expand Down
3 changes: 1 addition & 2 deletions kiwi.h
Expand Up @@ -46,7 +46,7 @@ Boston, MA 02110-1301, USA.
extern int version_maj, version_min;

extern bool background_mode, need_hardware, is_multi_core, kiwi_restart,
DUC_enable_start, rev_enable_start, web_nocache, auth_su, kiwi_reg_debug,
DUC_enable_start, rev_enable_start, web_nocache, kiwi_reg_debug,
have_ant_switch_ext, gps_e1b_only, disable_led_task, debug_printfs, force_camp,
snr_local_time, log_local_ip, DRM_enable;

Expand All @@ -68,7 +68,6 @@ extern double ui_srate, freq_offset;
extern TYPEREAL DC_offset_I, DC_offset_Q;
extern kstr_t *cpu_stats_buf;
extern char *tzone_id, *tzone_name;
extern char auth_su_remote_ip[NET_ADDRSTRLEN];
extern cfg_t cfg_ipl;
extern char *fpga_file;
extern lock_t spi_lock;
Expand Down
16 changes: 12 additions & 4 deletions main.cpp
Expand Up @@ -75,13 +75,13 @@ bool create_eeprom, need_hardware, kiwi_reg_debug, have_ant_switch_ext, gps_e1b_
disable_led_task, is_multi_core, kiwi_restart, debug_printfs;

char **main_argv;
char *fpga_file;
char *fpga_file, *other_args;

#ifdef USE_OTHER
void other_task(void *param)
{
void other_main(int test_flag, int p0, int p1, int p2);
other_main(test_flag, p0, p1, p2);
void other_main(char *other_args, int p0, int p1, int p2);
other_main(other_args, p0, p1, p2);
kiwi_exit(0);
}
#endif
Expand Down Expand Up @@ -129,6 +129,8 @@ int main(int argc, char *argv[])

for (int ai = 1; ai < argc; ) {
if (ARG("-fw")) { ARGL(fw_sel_override); printf("firmware select override: %d\n", fw_sel_override); }
if (ARG("-other")) { other_args = ARGP(); printf("other args: \"%s\"\n", other_args); }

if (ARG("-kiwi_reg")) kiwi_reg_debug = TRUE;
if (ARG("-bg")) { background_mode = TRUE; bg=1; }
if (ARG("-fopt")) use_foptim = 1; // in EDATA_DEVEL mode use foptim version of files
Expand Down Expand Up @@ -211,11 +213,17 @@ int main(int argc, char *argv[])
version_maj, version_min);
lprintf("compiled: %s %s on %s\n", __DATE__, __TIME__, COMPILE_HOST);

#ifdef DEVSYS
#if defined(DEVSYS) && 0
printf("%6s %6s %6s %6s\n", toUnits(1234), toUnits(999800, 1), toUnits(999800777, 2), toUnits(1800777666, 3));
printf("______ ______ ______ ______\n");
_exit(0);
#endif

#if (defined(DEVSYS) && 0) || (defined(HOST) && 0)
void ale_2g_test();
ale_2g_test();
_exit(0);
#endif

if (debian_ver) lprintf("-debian %d\n", debian_ver);
char *reply = read_file_string_reply("/etc/debian_version");
Expand Down
2 changes: 1 addition & 1 deletion net/net.cpp
Expand Up @@ -776,7 +776,7 @@ bool internal_conn_setup(u4_t ws, internal_conn_t *iconn, int instance, int port
bool ident_geo_sent = false;
memset(iconn, 0, sizeof(internal_conn_t));

if (ws & ICONN_WS_EXT) {
if (ws & ICONN_WS_SND) {
mcs = &iconn->snd_mc;
mc_fail = mcs;
mcs->connection_param = NULL;
Expand Down
5 changes: 3 additions & 2 deletions net/services.cpp
Expand Up @@ -505,13 +505,14 @@ static int _UPnP_port_open(void *param)
static void UPnP_port_open_task(void *param)
{
char *cmd_p;
int status, exit_status;

asprintf(&cmd_p, "upnpc %s%s-a %s %d %d TCP 2>&1",
(debian_ver != 7)? "-e KiwiSDR " : "",
(net.pvt_valid == IPV6)? "-6 " : "",
net.ip_pvt, net.port, net.port_ext);
net_printf2("UPnP: %s\n", cmd_p);
int status = non_blocking_cmd_func_forall("kiwi.UPnP", cmd_p, _UPnP_port_open, 0, POLL_MSEC(1000));
int exit_status;
status = non_blocking_cmd_func_forall("kiwi.UPnP", cmd_p, _UPnP_port_open, 0, POLL_MSEC(1000));
if (WIFEXITED(status) && (exit_status = WEXITSTATUS(status))) {
net.auto_nat = exit_status;
net_printf2("UPnP_port_open_task net.auto_nat=%d\n", net.auto_nat);
Expand Down
17 changes: 0 additions & 17 deletions rx/rx_cmd.cpp
Expand Up @@ -57,8 +57,6 @@ volatile float audio_kbps[MAX_RX_CHANS+1], waterfall_kbps[MAX_RX_CHANS+1], water
volatile u4_t audio_bytes[MAX_RX_CHANS+1], waterfall_bytes[MAX_RX_CHANS+1], waterfall_frames[MAX_RX_CHANS+1], http_bytes;
char *current_authkey;
int debug_v;
bool auth_su;
char auth_su_remote_ip[NET_ADDRSTRLEN];

const char *mode_s[N_MODE] = {
"am", "amn", "usb", "lsb", "cw", "cwn", "nbfm", "iq", "drm", "usn", "lsn", "sam", "sau", "sal", "sas", "qam"
Expand Down Expand Up @@ -496,21 +494,6 @@ bool rx_common_cmd(const char *stream_name, conn_t *conn, char *cmd)
pwd_s = NULL;
}

if (type_admin && auth_su && strcmp(conn->remote_ip, auth_su_remote_ip) == 0) {
bool no_console = false;
struct stat st;
if (stat(DIR_CFG "/opt.no_console", &st) == 0)
no_console = true;
if (no_console == false) {
printf("PWD %s ALLOWED: by su\n", type_m);
allow = true;
is_local = true;
cant_login = false;
}
auth_su = false; // be certain to reset the global immediately
memset(auth_su_remote_ip, 0, sizeof(auth_su_remote_ip));
}

int badp = 1;

pdbug_cprintf(conn, "PWD %s %s RESULT allow=%d pwd_s=<%s> pwd_m=<%s> cant_determine=%d is_local=%d isLocal(enum)=%d %s\n",
Expand Down
14 changes: 0 additions & 14 deletions rx/rx_server.cpp
Expand Up @@ -560,20 +560,6 @@ conn_t *rx_server_websocket(websocket_mode_e mode, struct mg_connection *mc)
conn_printf("down=%d UIP=%d stream=%s\n", down, update_in_progress, st->uri);

conn_printf("URL <%s> <%s> %s\n", mc->uri, mc->query_string, remote_ip);
if (auth_su && strcmp(remote_ip, auth_su_remote_ip) == 0) {
struct stat _st;
if (stat(DIR_CFG "/opt.no_console", &_st) == 0)
return NULL;
printf("allowed by su %s %s\n", rx_streams[st->type].uri, remote_ip);
#ifdef USE_SDR
if (!init_snd_wf) {
c2s_sound_init();
c2s_waterfall_init();
init_snd_wf = true;
}
#endif
} else

if (st->type == STREAM_SOUND && !internal) {
int type;
const char *reason_disabled = NULL;
Expand Down
2 changes: 2 additions & 0 deletions types.h
@@ -1,6 +1,8 @@
#ifndef _TYPES_H_
#define _TYPES_H_

#include "bits.h"

#include <stdlib.h>

typedef unsigned long long u64_t;
Expand Down

0 comments on commit fef9092

Please sign in to comment.