persistent write and read access to usb-devices as non root

Hi all

I’ve written a software that read and writes to a usb connected measuring device using libusb.

But the access path changes based on what port I put it into and what order devices start up.
So I either have to run as root, or do a chgrp -R usb for the path the devise show up on before I run.

So how can I change this so it is persistent across reboots being owned by another group.
I use opensuse 11.4 and 12.1.

I’ve discovered opensuse uses udev, but to me this look extremely complicated I just want to add
a group called usb with read and write access to the devices and add my users to this group, like
we do with lp.

Any insight appreciated, thanks


libusb couldn't open USB device /dev/bus/usb/002/003: Permission denied.
libusb requires write access to USB device nodes.

mortenb@randsfjorden1:~> ls -l /dev/bus/usb/002/003 
crw-rw-r-- 1 root root 189, 130 Nov 14 00:25 /dev/bus/usb/002/003
(why is group root?)

And what rule do a simple usb temp fit into?  
mortenb@randsfjorden1:~> ls /etc/udev/rules.d/
51-lirc.rules
55-hpmud.rules
55-libsane.rules
56-hpmud_support.rules
56-sane-backends-autoconfig.rules
70-kpartx.rules
70-persistent-cd.rules
70-persistent-net.rules
71-multipath.rules
99-iwlwifi-led.rules


Morten Bjoernsvik, Oslo Norway

Nevermind

I found this that helped me getting the correct string for matching:
openSUSE 12.2: Chapter 12. Dynamic Kernel Device Management with udev


**udevadm monitor --env**

I’ve created a file which was missing:
/etc/udev/rules.d/50-udev-default.rules and added the entries I I got above

I just added GROUP=“usb” and it now seem to work.

Congrats on finding a solution yourself.

I can add that you should not change the rules files that are allready there by installation. They will be overwritten at next installation. That could be on a next system installation and in that case you would probably be aware of that. But it could also happen on a Security update in the Update repo and thus hit you unprepaired.