From: Sarah Messer Date: Wed, 13 Aug 2008 18:27:17 +0000 Subject: Re: Fw: access permissions for udev / usb device Message-Id: <592368.2921.qm@web50711.mail.re2.yahoo.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="0-643306297-1218652037=:2921" List-Id: References: <158297.31144.qm@web50709.mail.re2.yahoo.com> In-Reply-To: <158297.31144.qm@web50709.mail.re2.yahoo.com> To: linux-hotplug@vger.kernel.org --0-643306297-1218652037=:2921 Content-Type: text/plain; charset=us-ascii > > My base problem is that I can access a USB device > (Tektronix TDS > > 2014B oscilloscope) only as root. > ... > > the device & endpoints are added to GID=1000 w/ > permissions 664 > > (illustrated below), but this still does not allow > non-root users to > > actually control the device. (I get an > "Operation not permitted" > > error > > How are you trying to control the device? What software > and what > interface is it using? If (for example) you're using > an older version > of libusb that uses /proc/bus/usb, you'll have problems > because udev > only sets permissions on /dev/bus/usb. You could use a > rule similar > to this to set it in both places ($ENV{DEVICE} points to > /proc/bus/usb): > > ATTRS{idVendor}=="04d8", MODE="0664", > GROUP="plugdev" > ATTRS{idVendor}=="04d8", RUN+="/bin/chmod > 664 $ENV{DEVICE}" > ATTRS{idVendor}=="04d8", RUN+="/bin/chgrp > plugdev $ENV{DEVICE}" Adding the RUN+= commands doesn't seem to have made a difference. Before this most-recent change, the file in /dev/bus/usb was assigned to root-usb-664 and the file in /proc/bus/usb was assigned to root-root-644. After the change, ll confirms the permissions & group-assignment of the relevant files were altered (root-usb-664 for both devices). I'm attaching the modified 10-libsane.rules; my copy of 55-libsane.rules contains a similar section where the "Tektronix" code was before. TO answer your other questions, the low-level interface to the usb port is through libusb-0.1.12. That's being wrapped by pyusb-0.4.1, and my code is actually written in Python 2.5.1. I've tried skipping the Python intermediary, but something gets lost in conversion when I try to write up the control code in C. I get intermittent "timeout" errors as both root and non-root. The timeout errors occur with similar frequencies on two different machines and are frustratingly difficult to isolate / predict / control (I've some descriptions on them over in the libusb-devel archives if anyone's curious...) The current (permissions) difficulty seems separate - it appears on one machine (SUSE 10.3, udev 114, Python 2.5.1), but not on another one (SUSE 10.0, udev 068, Python 2.4.1). The versions of libusb and (I think) pyusb are the same on both machines. The permissions difficulty is also entirely reproducible. Any ides on how I can isolate & fix its cause? Thanks. -Sarah --0-643306297-1218652037=:2921 Content-Type: application/octet-stream; name="10-libsane.rules" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="10-libsane.rules" IyBUaGUgYXV0b21hdGljYWxseSBjcmVhdGVkIGZpbGUgd2FzIG1hbnVhbGx5 IG1vZGlmaWVkCiMgZm9yIG9wZW5TVVNFIDEwLjMgb24gRnJpIEF1ZyAwMyAy MDA3IGJ5IGpzbWVpeEBzdXNlLmRlIGFzIGZvbGxvd3M6CiMgU1VCU1lTVEVN PT0idXNiIiBpcyBhZGRlZCBiZWZvcmUgdGhlIFNVQlNZU1RFTT09InVzYl9k ZXZpY2UiIHRlc3QKIyBidXQgdGhlIGxhdHRlciBpcyBrZXB0IGZvciBiYWNr d2FyZCBjb21wYXRpYmlsaXR5LgojIFJlZ2FyZGluZyBTVUJTWVNURU09PSJ1 c2IiIHNlZSB0aGUgTm92ZWxsL1N1c2UgQnVnemlsbGEgYnVncwojIGh0dHBz Oi8vYnVnemlsbGEubm92ZWxsLmNvbS9zaG93X2J1Zy5jZ2k/aWQ9Mjk0MTYx CiMKIyB1ZGV2IHJ1bGVzIGZpbGUgZm9yIHN1cHBvcnRlZCBVU0IgZGV2aWNl cwojCiMgVG8gYWRkIGEgVVNCIGRldmljZSwgYWRkIGEgcnVsZSB0byB0aGUg bGlzdCBiZWxvdyBiZXR3ZWVuIHRoZQojIExBQkVMPSJsaWJzYW5lX3J1bGVz X2JlZ2luIiBhbmQgTEFCRUw9ImxpYnNhbmVfcnVsZXNfZW5kIiBsaW5lcy4K IwojIFRvIHJ1biBhIHNjcmlwdCB3aGVuIHlvdXIgZGV2aWNlIGlzIHBsdWdn ZWQgaW4sIGFkZCBSVU4rPSIvcGF0aC90by9zY3JpcHQiCiMgdG8gdGh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