On 27/02/12 10:07, Mark Morgan Lloyd wrote:
Henry Vermaak wrote:
On 26/02/12 13:29, Mark Morgan Lloyd wrote:

I've had this sort of requirement in the past, specifically when using
libusb (i.e. the program needed sufficient privilege to grab the
device).

You need udev rules that set the user/group permissions for the
devices that you use. You don't need to run as root.

I'd be happy to be proven wrong, but my understanding is that you do
since there is one specific kernel call (in effect, telling the kernel
to release an unrecognised device to an unprivileged program) that won't
work otherwise.

You need root permissions because libusb accesses the file /dev/bus/usb/%d/%d. The default permissions to these files are restricted to root by default, so udev is used so that known devices can be used by less-privileged users. E.g. usb printers, which will set the group to "lp" on my system (Debian). This is what I use at work for development with a Cypress FX2 board:

hcv@technical09:~$ lsusb
...
Bus 001 Device 003: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit
...

hcv@technical09:~$ ls -l /dev/bus/usb/001/
total 0
crw-rw-r-- 1 root root    189, 0 Feb 27 09:15 001
crw-rw-r-- 1 root plugdev 189, 2 Feb 27 10:26 003

hcv@technical09:~$ cat /etc/udev/rules.d/55-hcv.rules
ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="8613", MODE="0664", GROUP="plugdev"

I belong to the "plugdev" group, so I can use the device without running as root.

Henry

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to