It requires the that the kernel support USB (for 2.2 kernels you need the backport of the 2.3 USB code) and the usbdevfs filesystem, you don't need full devfs support (in fact I think you don't need it if you have devfs but I'm not sure). It also needs the libusb user-space USB library to access the system. Currently it relies on the device & bus format of the CVS version (as that is what is used by gphoto2).
Why did it write it? For the very simple reason that I got fed up with having to do su -c 'chmod a+w /proc/bus/usb/001/002 every time I plugged in my digital camera.
tar xzvf usb_perms.tar.gz cd usb-perms make su -c 'make install'This will build it using gcc and install in /usr/local/sbin. If you don't have libusb it won't link. There isn't any nice configure script to check that all your include files etc. are where they are expected to be.
If you want the executable anywhere other than /usr/local/sbin or the init script anywhere other than /sbin/init.d you need to edit the Makefile and change the PREFIX and RCDIR values.
For example to set a Canon PowerShot S20 digital camera to world write access and leave its GID unchanged you need the line:
04a9 3043 0666 0Alternatively if you wish to restict access to members of the video group (which on my system is group 33) you could use:
04a9 3043 0664 33Which will set the group to 33 and give group write access.
Permissions on devices with a vendor ID or product ID of 0 are not accepted; this is so that you can't change the permissions of the controller, which is probably not a good idea.
The program in the test subdirectory if the libusb distribution will print the Vendor and Product ids of any connected devices. (In fact the bus scanner in this daemon is a descendant of that program).
usb_permsThe options are:
Long | Short | Argument | Default | Description |
--file | -f | filename | /etc/usb_perms | The name of the file from which to read the list of known devices. |
--time | -t | number | 3 | The number of seconds to wait between polling the /proc/bus/usb system |
--verbose | -v | 0, 1, or 2 | 0 | 0: only report failures, 1: (default) Report any changes on the bus, 2: keep up a running commentary (specifying -v without an argument is equivalent to -v2). |
--daemon | -d | none | If this option is set then the program is run as a daemon, otherwise it just runs in the foreground. |
You can of course make Start and Kill links in suitable run-level directories if you want it to start automatically on system boot.
When in daemon mode, the pid is written to /var/run/usb_perm.pid and any messages from the daemon go to /var/log/usb_perm.log.