-
Notifications
You must be signed in to change notification settings - Fork 35
Device Permissions
USB devices usually default to root-only access, so when you try to open one with IDF, you're greeted with a permission error. To fix this, you need to add a file to /etc/udev/rules.d
containing rules to grant wider access. udev rule files are processed in lexical order and must end in .rules
, so name it something like 99-idf.rules
, and drop it into the above directory. The quick fix is to grant full permissions for all devices:
KERNEL=="hidraw*", MODE="0666"
But if that makes you nervous, you can be more selective:
KERNEL=="hidraw*", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="003f", MODE="0666"
You might be able to lookup your device's vendor and product IDs somewhere, but IDF also has a tool that can help. You'll still have to grant full permissions before it can see the device, but then you can get the IDs and clamp the permissions back down. Note that the IDs must be in lowercase hexadecimal.
Adding or making changes to udev files only requires that you disconnect and reconnect your device for the changes to take effect.
If you think permissions of 0666 are too loose, then see http://reactivated.net/writing_udev_rules.html for more information on finer grained permission setting. For example, it might be sufficient to just set the group or user owner for specific devices (for example the plugdev group on some systems).