-
Notifications
You must be signed in to change notification settings - Fork 128
Description
There are 2 additional changes required to smi_stream_dev.c besides the 1 vs 2 parameter change for class_create. An inlcuded statement needs to be added: #include <linux/vmalloc.h> and the fuction smi_stream_dev_remove should not return anything. See my pull request #241. I have tested this fix on Pi4 and Pi0 both running an up-to-date version of Bookworm.
On a Pi 4 with the latest Bookworm (Pi OS 12):
$ uname -a
Linux pi4-sdr 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux
When compiling the driver I get an error relating to the same function in this PR:
/home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.c: In function ‘smi_stream_dev_probe’:
/usr/src/linux-headers-6.6.51+rpt-common-rpi/include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
29 | #define THIS_MODULE (&__this_module)
| ~^~~~~~~~~~~~~~~
| |
| struct module *
/home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.c:1053:37: note: in expansion of macro ‘THIS_MODULE’
1053 | smi_stream_class = class_create(THIS_MODULE, DEVICE_NAME);
| ^~~~~~~~~~~
In file included from /usr/src/linux-headers-6.6.51+rpt-common-rpi/include/linux/device.h:31,
from /usr/src/linux-headers-6.6.51+rpt-common-rpi/include/linux/platform_device.h:13,
from /home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.c:51:
/usr/src/linux-headers-6.6.51+rpt-common-rpi/include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
230 | struct class * __must_check class_create(const char *name);
| ~~~~~~~~~~~~^~~~
/home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.c:1053:24: error: too many arguments to function ‘class_create’
1053 | smi_stream_class = class_create(THIS_MODULE, DEVICE_NAME);
| ^~~~~~~~~~~~
...
make[5]: *** [/usr/src/linux-headers-6.6.51+rpt-common-rpi/scripts/Makefile.build:248: /home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.o] Error 1
make[4]: *** [/usr/src/linux-headers-6.6.51+rpt-common-rpi/Makefile:1946: /home/pi/Downloads/cariboulite/driver/build] Error 2
make[3]: *** [/usr/src/linux-headers-6.6.51+rpt-common-rpi/Makefile:246: __sub-make] Error 2
make[2]: *** [CMakeFiles/smi_stream_dev.dir/build.make:79: smi_stream_dev] Error 2
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/smi_stream_dev.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
binary file doesn't exist: /home/pi/Downloads/cariboulite/driver/build/smi_stream_dev.ko
Applying the patch with curl -L https://github.com/cariboulabs/cariboulite/pull/176.patch | git apply -v
I get:
Checking patch driver/smi_stream_dev.c...
error: while searching for:
}
// Create sysfs entries with "smi-stream-dev"
smi_stream_class = class_create(THIS_MODULE, DEVICE_NAME);
ptr_err = smi_stream_class;
if (IS_ERR(ptr_err))
{
error: patch failed: driver/smi_stream_dev.c:1316
error: driver/smi_stream_dev.c: patch does not apply
So I applied the change manually, and here is my diff:
pi@pi4-sdr:~/Downloads/cariboulite $ git diff driver/smi_stream_dev.c
diff --git a/driver/smi_stream_dev.c b/driver/smi_stream_dev.c
index e0d6618..c7f3fba 100644
--- a/driver/smi_stream_dev.c
+++ b/driver/smi_stream_dev.c
@@ -1050,7 +1050,7 @@ static int smi_stream_dev_probe(struct platform_device *pdev)
}
// Create sysfs entries with "smi-stream-dev"
- smi_stream_class = class_create(THIS_MODULE, DEVICE_NAME);
+ smi_stream_class = class_create(DEVICE_NAME);
ptr_err = smi_stream_class;
if (IS_ERR(ptr_err))
{
After re-running install.sh
, it compiles now, but when it's installing the driver I see some errors like:
01-16 09:23:53.090 7491 7491 E CARIBOU_SMI caribou_smi_init@caribou_smi.c:539 couldn't open smi driver file '/dev/smi' (Permission denied)
01-16 09:23:53.090 7491 7491 E CARIBOULITE Setup cariboulite_init_submodules@cariboulite_setup.c:288 Error setting up smi submodule
01-16 09:23:53.090 7491 7491 E IO_UTILS_SPI io_utils_spi_remove_chip@io_utils_spi.c:487 the device is already empty
01-16 09:23:53.091 7491 7491 I CARIBOU_PROG caribou_prog_release@caribou_prog.c:122 device release completed
01-16 09:23:53.091 7491 7491 E FPGA caribou_fpga_close@caribou_fpga.c:247 caribou_fpga_close: dev not initialized
[ERROR] cariboulite_init_driver() failed
01-16 09:23:53.095 7491 7491 E FPGA caribou_fpga_close@caribou_fpga.c:247 caribou_fpga_close: dev not initialized
01-16 09:23:53.095 7491 7491 E CARIBOULITE Setup cariboulite_release_submodules@cariboulite_setup.c:465 FPGA communication release failed (-1)
01-16 09:23:53.095 7491 7491 E IO_UTILS_SPI io_utils_spi_close@io_utils_spi.c:340 closing uninitialized device
After a reboot, I launched SoapySDRServer (sudo systemctl start SoapySDRServer.service
), and was able to connect to the H1F and S1G bands from GQRX on my Mac remotely.
Originally posted by @geerlingguy in #176 (comment)