Raspberry Pi 4 USB Bug Experienced with RTL-SDRs now Fixed with Kernel Update
Thank you to Michael B for letting us know about recent fixes to the Raspberry Pi kernel which affect RTL-SDR users. If you've been experiencing error "rtlsdr_read_reg failed with -7" when running RTL-SDR software on Raspberry Pi 4's running a Linux kernel with version 6.1 or higher, a Raspberry Pi kernel fix has been pushed which should fix the problem.
This problem "rtlsdr_read_reg failed with -7" appears to occur after having closed any program that uses an RTL-SDR, and then reopening it.
This doesn't seem to have been an issue for the older 5.12 and 4.19 kernels where this issue was previously fixed, but Raspberry Pi recently moved to the 6.1 kernel in May 2023 where the issue came back. Raspbian releases after this date may have been problematic.
The official Raspbian should eventually update, but if you've been experiencing this issue, you could try update your kernel now using:
sudo apt install rpi-update sudo rpi-update
Alternatively according to Michael, kernel version 6.6.y should also have this problem fixed:
sudo rpi-update rpi-6.6.y
Note that updating the kernel could break other software, so doing this is at your own risk.
Neither rpi_update given above works for me. I have a pi 4b with a rtl-sdr v3 purchased in the last week. I loaded a fresh 64 bit Pi OS using the SD card imager between each attempt.
Executing: /usr/bin/python3 -u /home/smm/gnu_radio/pi_rtl_sdr_1.py
gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.5.1
built-in source types: file fcd rtl rtl_tcp uhd hackrf bladerf rfspace
airspy airspyhf soapy redpitaya freesrp xtrx
[INFO] [UHD] linux; GNU C++ version 12.2.0; Boost_107400; UHD_4.3.0.0+ds1-5
Detached kernel driver
Found Rafael Micro R820T tuner
Reattached kernel driver
…
libusb: warning [libusb_exit] device 1.1 still referenced
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Detached kernel driver
rtlsdr_read_reg failed with -7
…
No supported tuner found
…
rtlsdr_demod_write_reg failed with -7
rtlsdr_demod_read_reg failed with -7
Traceback (most recent call last)
:…
RuntimeError: Failed to set default samplerate.
>>> Done (return code 1)
I just tested this with the 64-bit desktop version and after running sudo rpi-update it works fine. Before running the update it gives the rtlsdr_read_reg failed with -7 error.
I’m continuing to experience the failure.
The Git indicates a merge, but the ticket hasn’t been closed. (???)
Hi