Skip to content

Commit

Permalink
Merge branch 'main' into fix-signed-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ka9q committed Apr 8, 2024
2 parents e931d5a + ecb34c9 commit 37af954
Show file tree
Hide file tree
Showing 17 changed files with 462 additions and 427 deletions.
22 changes: 11 additions & 11 deletions Makefile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ endif
$(CC) $(CFLAGS) -MM $(CFILES) > .depend

# Executables
set_xcvr: set_xcvr.o config.o
set_xcvr: set_xcvr.o
$(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lrt -lbsd -lm -lpthread

aprs: aprs.o ax25.o libradio.a
aprs: aprs.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

aprsfeed: aprsfeed.o ax25.o libradio.a
aprsfeed: aprsfeed.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

control: control.o decode_status.o modes.o bandplan.o libradio.a
control: control.o bandplan.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread

cwd: cwd.o morse.o libradio.a
cwd: cwd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

tune: tune.o libradio.a
Expand All @@ -93,10 +93,10 @@ show-pkt: show-pkt.o libradio.a
show-sig: show-sig.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm -lpthread

metadump: metadump.o dump.o libradio.a
metadump: metadump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

monitor: monitor.o decode_status.o morse.o config.o libradio.a
monitor: monitor.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lasound -lncursesw -liniparser -lbsd -lm -lpthread

opusd: opusd.o libradio.a
Expand All @@ -105,7 +105,7 @@ opusd: opusd.o libradio.a
opussend: opussend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lbsd -lm -lpthread

packetd: packetd.o ax25.o libradio.a
packetd: packetd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread

pcmcat: pcmcat.o libradio.a
Expand All @@ -120,13 +120,13 @@ pcmrecord: pcmrecord.o libradio.a
pcmsend: pcmsend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lportaudio -lbsd -lm -lpthread

powers: powers.o dump.o libradio.a
powers: powers.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

pl: pl.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread

radiod: main.o audio.o fm.o wfm.o linear.o spectrum.o radio.o rtcp.o radio_status.o modes.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
radiod: main.o audio.o fm.o wfm.o linear.o spectrum.o radio.o radio_status.o rtcp.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -liniparser -lairspy -lairspyhf -lrtlsdr -lportaudio -lusb-1.0 -lbsd -lm -lpthread

rdsd: rdsd.o libradio.a
Expand All @@ -148,7 +148,7 @@ libfcd.a: fcd.o hid-libusb.o
ranlib $@

# subroutines useful in more than one program
libradio.a: avahi.o avahi_browse.o attr.o filter.o iir.o status.o misc.o multicast.o osc.o config.o
libradio.a: morse.o dump.o modes.o ax25.o avahi.o avahi_browse.o attr.o filter.o iir.o decode_status.o status.o misc.o multicast.o osc.o config.o
ar rv $@ $?
ranlib $@

Expand Down
22 changes: 11 additions & 11 deletions Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ endif
$(CC) $(CFLAGS) -MM $(CFILES) > .depend

# Executables
set_xcvr: set_xcvr.o config.o
set_xcvr: set_xcvr.o
$(CC) $(LDOPTS) -o $@ $^ -lpigpio -liniparser -lrt -lbsd -lm -lpthread

aprs: aprs.o ax25.o libradio.a
aprs: aprs.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

aprsfeed: aprsfeed.o ax25.o libradio.a
aprsfeed: aprsfeed.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

control: control.o decode_status.o modes.o bandplan.o libradio.a
control: control.o bandplan.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncursesw -liniparser -lbsd -lm -lpthread

cwd: cwd.o morse.o libradio.a
cwd: cwd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

tune: tune.o libradio.a
Expand All @@ -93,10 +93,10 @@ show-pkt: show-pkt.o libradio.a
show-sig: show-sig.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lncursesw -lbsd -lm -lpthread

metadump: metadump.o dump.o libradio.a
metadump: metadump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

monitor: monitor.o decode_status.o morse.o config.o libradio.a
monitor: monitor.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lasound -lncursesw -liniparser -lbsd -lm -lpthread

opusd: opusd.o libradio.a
Expand All @@ -105,7 +105,7 @@ opusd: opusd.o libradio.a
opussend: opussend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lopus -lportaudio -lbsd -lm -lpthread

packetd: packetd.o ax25.o libradio.a
packetd: packetd.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread

pcmcat: pcmcat.o libradio.a
Expand All @@ -120,13 +120,13 @@ pcmrecord: pcmrecord.o libradio.a
pcmsend: pcmsend.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lportaudio -lbsd -lm -lpthread

powers: powers.o dump.o libradio.a
powers: powers.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lbsd -lm -lpthread

pl: pl.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lfftw3f_threads -lfftw3f -lbsd -lm -lpthread

radiod: main.o audio.o fm.o wfm.o linear.o spectrum.o radio.o rtcp.o radio_status.o modes.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
radiod: main.o audio.o fm.o wfm.o linear.o spectrum.o radio.o radio_status.o rtcp.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -liniparser -lairspy -lairspyhf -lrtlsdr -lportaudio -lusb-1.0 -lbsd -lm -lpthread

rdsd: rdsd.o libradio.a
Expand All @@ -148,7 +148,7 @@ libfcd.a: fcd.o hid-libusb.o
ranlib $@

# subroutines useful in more than one program
libradio.a: avahi.o avahi_browse.o attr.o filter.o iir.o status.o misc.o multicast.o osc.o config.o
libradio.a: morse.o dump.o modes.o ax25.o avahi.o avahi_browse.o attr.o filter.o iir.o decode_status.o status.o misc.o multicast.o osc.o config.o
ar rv $@ $?
ranlib $@

Expand Down
11 changes: 4 additions & 7 deletions Makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ aprsfeed: aprsfeed.o libradio.a
control: control.o modes.o bandplan.o decode_status.o libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread

cwd: cwd.o morse.o libradio.a
cwd: cwd.o libradio.a
$(CC) -g -o $@ $^ -lm

dmr: dmr.o libradio.a
Expand All @@ -55,7 +55,7 @@ metadump: metadump.o dump.o libradio.a

# should be setuid root to enable renicing to better priority, but this makes me uncomfortable
# macos doesn't have Linux-style capabilities to enable specific root-like privileges
monitor: monitor.o decode_status.o morse.o libradio.a
monitor: monitor.o libradio.a
$(CC) -g -o $@ $^ -lopus -lportaudio -lfftw3f_threads -lfftw3f -lncurses -liniparser -lm -lpthread

opusd: opusd.o libradio.a
Expand Down Expand Up @@ -85,7 +85,7 @@ pl: pl.o libradio.a
powers: powers.o dump.o libradio.a
$(CC) $(LDOPTS) -o $@ $^ -lm -lpthread

radiod: main.o radio.o audio.o fm.o wfm.o linear.o spectrum.o radio_status.o modes.o status.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
radiod: main.o radio.o audio.o fm.o wfm.o linear.o spectrum.o radio_status.o modes.o rx888.o airspy.o airspyhf.o funcube.o rtlsdr.o sig_gen.o ezusb.o libfcd.a libradio.a
$(CC) -g -o $@ $^ -lavahi-client -lavahi-common -lfftw3f_threads -lfftw3f -lncurses -liniparser -lairspy -lairspyhf -lrtlsdr -lportaudio -liconv -lusb-1.0 -lm -lpthread

rdsd: rdsd.o libradio.a
Expand Down Expand Up @@ -122,13 +122,10 @@ libfcd.a: fcd.o hid-libusb.o
ranlib $@

# subroutines useful in more than one program
libradio.a: avahi.o avahi_browse.o attr.o ax25.o config.o decimate.o filter.o status.o misc.o multicast.o rtcp.o osc.o iir.o
libradio.a: morse.o avahi.o avahi_browse.o attr.o ax25.o config.o decimate.o filter.o status.o decode_status.o misc.o multicast.o rtcp.o osc.o iir.o
ar rv $@ $?
ranlib $@







4 changes: 4 additions & 0 deletions config/recordings@wwv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARGS="-s --channels 2 -d /recordings/wwv wwv-iq.local"



78 changes: 77 additions & 1 deletion decode_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int decode_radio_status(struct frontend *frontend,struct channel *channel,uint8_

if(type == EOL)
break; // end of list

unsigned int optlen = *cp++;
if(optlen & 0x80){
// length is >= 128 bytes; fetch actual length from next N bytes, where N is low 7 bits of optlen
Expand Down Expand Up @@ -260,3 +260,79 @@ int decode_radio_status(struct frontend *frontend,struct channel *channel,uint8_
}
return 0;
}
// Extract SSRC; 0 means not present (reserved value)
uint32_t get_ssrc(uint8_t const *buffer,int length){
uint8_t const *cp = buffer;

while(cp - buffer < length){
enum status_type const type = *cp++; // increment cp to length field

if(type == EOL)
break; // end of list, no length

unsigned int optlen = *cp++;
if(optlen & 0x80){
// length is >= 128 bytes; fetch actual length from next N bytes, where N is low 7 bits of optlen
int length_of_length = optlen & 0x7f;
optlen = 0;
while(length_of_length > 0){
optlen <<= 8;
optlen |= *cp++;
length_of_length--;
}
}
if(cp - buffer + optlen >= length)
break; // invalid length; we can't continue to scan

switch(type){
case EOL: // Shouldn't get here
goto done;
case OUTPUT_SSRC:
return decode_int32(cp,optlen);
break;
default:
break; // Ignore on this pass
}
cp += optlen;
}
done:;
return 0;
}
// Extract command tag
uint32_t get_tag(uint8_t const *buffer,int length){
uint8_t const *cp = buffer;

while(cp - buffer < length){
enum status_type const type = *cp++; // increment cp to length field

if(type == EOL)
break; // end of list, no length

unsigned int optlen = *cp++;
if(optlen & 0x80){
// length is >= 128 bytes; fetch actual length from next N bytes, where N is low 7 bits of optlen
int length_of_length = optlen & 0x7f;
optlen = 0;
while(length_of_length > 0){
optlen <<= 8;
optlen |= *cp++;
length_of_length--;
}
}
if(cp - buffer + optlen >= length)
break; // invalid length; we can't continue to scan

switch(type){
case EOL: // Shouldn't get here
goto done;
case COMMAND_TAG:
return decode_int32(cp,optlen);
break;
default:
break; // Ignore on this pass
}
cp += optlen;
}
done:;
return 0; // broadcast
}

0 comments on commit 37af954

Please sign in to comment.