Welcome to Radarspotting. Please login or sign up.

March 28, 2024, 08:00:12 AM

Login with username, password and session length

New Members

New Members

You should get an activation email when you join.  If not, please use the Contact option.

Permission denied RPI3 Modesdeco2

Started by I_Need_help, February 13, 2017, 05:52:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

I_Need_help

hi,
   trying to upgrade to an RPI3 following my old notes and all is good if i put SUDO in front of the command to launch ModesDeco2 but if i don't i get:

pi@raspberrypi:~ $ 2017-02-13 17:52:09.061  INFO     ModeSDeco2 v.20160520
2017-02-13 17:52:09.061  INFO     Magnetic declination value was calculated
2017-02-13 17:52:09.066  INFO     Device: 0 already in use)
libusb_open error -3
2017-02-13 17:52:09.070  ERROR    Can't open device: sdr_open(): Permission denied

how do i fix this?

sergsero

#1
Hi,

A normal user under Linux doesn't have the permissions to access arbitrary USB devices because of security reasons.
In your message did not indicate what SDR receiver are you using. Assume that it is RTL dongle.
You need to add the udev rules to make the dongle available for the non-root users. First you can check to find the vendor id and product id for your dongle.

1. The way to do this, run the command:
lsusb

If dongle was connected, on a console you will see among others the line, for example:
QuoteBus 003 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
or
Bus 001 Device 006: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T

Each line has the important parts are "0bda" (the vendor id) and "2838" (or "2832 for other instance") (the product id):
Bus 003 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

2. Create a new file (as root) in /etc/udev/rules.d/20.rtlsdr.rules that contains the following line:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

With the vendor and product ids for your particular dongle.
This should make the dongle accessible to any user in the adm group and add a /dev/rtl_sdr symlink when the dongle is attached.

3. Check and set (if necessary) the file permissions:
sudo chmod u=rw,g=r,o=r 20.rtlsdr.rules

4. Now to unplug the dongle from port.
Now you can either reboot computer or run the command (as root) to instruct udev to reload all rule files by running command:
sudo udevadm control --reload-rules; udevadm trigger.

5. Re-plug the dongle to the USB port. After re-plugging your dongle (or rebooting) you should be able to access the RTL dongle as a normal user. If you still can't access, make sure that you are a member of the plugdev group:
cat /etc/group


Another reason can be that kernel also automatically loads the dvb driver module for the dongle to make it available as a TV tuner. This causes the program to complain that something is already using the dongle.
You can blacklist the offending modules by create a file in directory /etc/modprobe.d with a *.conf extension (for example block-rtl.conf) with these contents:
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830


Now you must reboot computer.

For a quick kill of the kernel module you can just do:
sudo rmmod rtl2832_sdr; rmmod dvb_usb_rtl28xxu

Regards,
sergsero

I_Need_help

thank you Sergsero, it now works i had missed the need to do sudo chmod u=rw,g=r,o=r 20.rtlsdr.rules