UdevConfig

From GNU Radio
Jump to navigation Jump to search

If you're using UHD, you've probably done something like this already. This is really only necessary when using a USRP1 with the deprecated libusrp.

The udev daemon is used by some Linux distributions to handle plug/unplug events for usb devices.

Follow these steps to allow users other than root to use the USRP:

Setup udev for the usrp

1. Define a group for the usrp

sudo groupadd usrp

2. Add users to the usrp group

sudo usermod -a -G usrp [username]

3. Add a new udev rule

echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="fffe", SYSFS{idProduct}=="0002", GROUP:="usrp", MODE:="0660"' > tmpfile
sudo chown root.root tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-usrp.rules

On later Ubuntu, the syntax has changed, BUS is no longer a valid keyword and SYSFS -> ATTR. If

grep BUS /etc/udev/rules.d/*

is empty, try this rule instead:

echo 'ACTION=="add", ATTR{idVendor}=="fffe", ATTR{idProduct}=="0002", GROUP:="usrp", MODE:="0660"' > tmpfile
sudo chown root.root tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-usrp.rules

4. Load the new udev rule

sudo udevadm control --reload-rules

Verify the setup

Power cycle the usrp device and:

lsusb | grep fffe:0002

You should see an entry with ID: fffe:0002

ls -lR /dev/bus/usb

You should see a device file with group usrp and mode crw-rw----

Notes for the NI version of the devices

In order to get the NI version of the, e.g., B210 working, which is actually sold as National Instruments USRP-2901, one has to use another USB vendor and product ID. In the case of the USRP-2901 the vendor ID is 3923 and the product id is 7814. The udev rule would then look as follows (for Ubuntu):

echo 'ACTION=="add", ATTR{idVendor}=="3923", ATTR{idProduct}=="7814", GROUP:="usrp", MODE:="0660"' > tmpfile
sudo chown root.root tmpfile
sudo mv tmpfile /etc/udev/rules.d/10-usrp.rules