Opendigitalradio / dabtools

DAB/DAB+ software for RTL-SDR dongles and the Psion Wavefinder including ETI stream recording. This project is currently unmaintained.
GNU General Public License v3.0
17 stars 11 forks source link

Unable to build wavefinder-driver for use with Psion Wavefinder #17

Open PartialVolume opened 4 months ago

PartialVolume commented 4 months ago

I have a Psion Wavefinder which appears to be working as it appears in the output of lsusb

Bus 003 Device 005: ID 09cd:2001 Psion Dacom Home Networks, Ltd Psion WaveFinder DAB radio receiver

For reference I'm building this on KDE Neon (Ubuntu 22.04LTS) I've build the main software without any build issues ..

cmake ../src
make
[  5%] Building C object CMakeFiles/dab2eti.dir/dab.c.o
[ 11%] Building C object CMakeFiles/dab2eti.dir/dab_tables.c.o
[ 17%] Building C object CMakeFiles/dab2eti.dir/depuncture.c.o
[ 23%] Building C object CMakeFiles/dab2eti.dir/fic.c.o
[ 29%] Building C object CMakeFiles/dab2eti.dir/input_sdr.c.o
[ 35%] Building C object CMakeFiles/dab2eti.dir/input_wf.c.o
[ 41%] Building C object CMakeFiles/dab2eti.dir/misc.c.o
[ 47%] Building C object CMakeFiles/dab2eti.dir/sdr_fifo.c.o
[ 52%] Building C object CMakeFiles/dab2eti.dir/sdr_sync.c.o
[ 58%] Building C object CMakeFiles/dab2eti.dir/wf_maths.c.o
[ 64%] Building C object CMakeFiles/dab2eti.dir/wf_prstables.c.o
[ 70%] Building C object CMakeFiles/dab2eti.dir/wf_sync.c.o
[ 76%] Building C object CMakeFiles/dab2eti.dir/dab2eti.c.o
/home/nick/Software/dabtools/src/dab2eti.c: In function ‘do_wf_decode’:
/home/nick/Software/dabtools/src/dab2eti.c:272:1: warning: no return statement in function returning non-void [-Wreturn-type]
  272 | }
      | ^
/home/nick/Software/dabtools/src/dab2eti.c: In function ‘eti_callback’:
/home/nick/Software/dabtools/src/dab2eti.c:134:3: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  134 |   write(1, eti, 6144);
      |   ^~~~~~~~~~~~~~~~~~~
[ 82%] Building C object CMakeFiles/dab2eti.dir/viterbi.c.o
[ 88%] Linking C executable dab2eti
[ 88%] Built target dab2eti
[ 94%] Building C object CMakeFiles/eti2mpa.dir/eti2mpa.c.o
/home/nick/Software/dabtools/src/eti2mpa.c: In function ‘main’:
/home/nick/Software/dabtools/src/eti2mpa.c:72:5: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   72 |     write(1,buf + 12 + 4*NST + FICF*96 + data_offset, data_length);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[100%] Linking C executable eti2mpa
[100%] Built target eti2mpa

But when I try to build the wavefinder-driver I get the following error "make[3]: * No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop.* make[2]: [arch/x86/Makefile:248: archheaders] Error 2"**

make -C /lib/modules/6.5.0-45-generic/build SUBDIRS=/home/nick/Software/dabtools/wavefinder-driver modules
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-45-generic'
**make[3]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'.  Stop.**
make[2]: *** [arch/x86/Makefile:248: archheaders] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-45-generic'
make: *** [Makefile:9: default] Error 2

Any suggestions as to how to resolve this would be welcome. Thanks.

PartialVolume commented 4 months ago

I solved the above problem by modifying the Makefile as follows:

ifneq ($(KERNELRELEASE),)
    obj-m := wavefinder.o
else
KDIR        := /lib/modules/$(shell uname -r)/build
PWD         := $(shell pwd)
DEBUG       := 1

default:
    $(MAKE) -I /usr/src/linux-headers-$(shell uname -r)/include/linux -C $(KDIR) M=$(PWD) modules
endif

Changing SUBDIRS=$(PWD) to M=$(PWD) got rid of the above error, however the compilation of the driver itself failed due to multiple issues including usb_maxpacket having changed the number of parameters in more recent kernels.

I'm guessing nobody is using the wavefinder driver on a recent kernel? As the last post or commit was a number of years ago.

LichP commented 2 months ago

@PartialVolume Greetings from the one other person on the internet trying to make a Psion Wavefinder work in 2024! I've had some success fixing the driver for modern kernels (I'm running Arch 6.6.49-1-lts on my test system). I've corrected the compile errors and fixed some buffers to ensure they are allocated on the heap. The driver loads and recognises the device, and when I run dab2eti 225648000 the device completes tuning and the LED lights up green, which is a good start. However dab2eti gets stuck on Waiting for sync ..., so that's as far I've got. If I enable some of the debugging in the driver it looks like the kernel is receiving USB data packets from the device, but the actual data appears to be just zeroes, which the driver ignores. I'm not sure if this is due to some other problem I've missed in the driver code, or if it's a problem with the actual device.

I've committed my changes to a fork on https://github.com/LichP/dabtools if you're interested in giving it a go. One pro-tip if you do is to add a udev rules file to set permissions on the /dev/wavefinder0 device file (e.g. /etc/udev/rules.d/90-wavefinder.rules with contents KERNEL=="wavefinder0", SUBSYSTEM=="usbmisc", MODE="0666"), which avoids the need to run dab2eti as root.

PartialVolume commented 2 months ago

Well, it's nice to know there is at least two of us trying to get this to work :-) putting us in the top 0.00000000025% by world population. Pretty exclusive group.

I'll give your fork a try and see if I get the same results.