* USB / udev only work for root
@ 2009-01-02 22:54 Sarah Messer
2009-01-03 18:24 ` Piter PUNK
2009-01-05 15:58 ` Sarah Messer
0 siblings, 2 replies; 3+ messages in thread
From: Sarah Messer @ 2009-01-02 22:54 UTC (permalink / raw)
To: linux-hotplug
Hello,
I can only communicate with a USB device using libusb when I'm logged in as root. I reported this previously for libusb-0.1.12, and have since tried upgrading to libusb-1.0 with the libusb-compat patch.
My system:
OpenSUSE 10.3, i386
communication is with a Tektronix TDS2014B oscilloscope using pyusb (a Python wrapper for libusb-0.1)
udev version 114-19
The problem is not present on an OpenSUSE 10.0 machine running identical code with straight libusb-0.1/pyusb
/etc/udev/rules.d/55-libsane.rules contains the following lines (among many others):
# ENV{DEVTYPE}="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664", OWNER="root", GROUP="root"
SUBSYSTEM="usb", ACTION="add|change", SYSFS{idVendor}="0699", SYSFS{idProduct}="0368", GROUP="usb", MODE="0664"
The 'scope's /dev/bus/usb/ entry looks like:
crw-rw-r-- 1 root usb 189, 132 2009-01-02 17:09 005
The non-root user who tried to use this scope is a member of these groups:
users dialout uucp video usb
Further notes:
1) Other USB devices which aren't being accessed via libusb are accessible to non-root users (e.g. printer, thumbdrive)
2) System seems to require an external hub between the scope and PC for reliable communication, but I _think_ that's a separate hardware issue since it's present on both machines.
3) The exact error message is "error sending control message: Operation not permitted"
4) I can get an (apparently valid) DeviceHandle, but both reset() and getString() calls fail - with permissions as the cited reason.
Any guidance you can provide on the likely source of the problem (or troubleshooting tricks) would be welcome.
Thanks
-Sarah
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: USB / udev only work for root
2009-01-02 22:54 USB / udev only work for root Sarah Messer
@ 2009-01-03 18:24 ` Piter PUNK
2009-01-05 15:58 ` Sarah Messer
1 sibling, 0 replies; 3+ messages in thread
From: Piter PUNK @ 2009-01-03 18:24 UTC (permalink / raw)
To: linux-hotplug
Sarah Messer wrote:
> The problem is not present on an OpenSUSE 10.0 machine running identical code with straight libusb-0.1/pyusb
>
> /etc/udev/rules.d/55-libsane.rules contains the following lines (among many others):
>
> # ENV{DEVTYPE}="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664", OWNER="root", GROUP="root"
>
> SUBSYSTEM="usb", ACTION="add|change", SYSFS{idVendor}="0699", SYSFS{idProduct}="0368", GROUP="usb", MODE="0664"
Change SYSFS to ATTRS.
Piter Punk
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: USB / udev only work for root
2009-01-02 22:54 USB / udev only work for root Sarah Messer
2009-01-03 18:24 ` Piter PUNK
@ 2009-01-05 15:58 ` Sarah Messer
1 sibling, 0 replies; 3+ messages in thread
From: Sarah Messer @ 2009-01-05 15:58 UTC (permalink / raw)
To: linux-hotplug
Changing SYSFS -> ATTRS in 55-libsane.rules worked. Thanks
For the record, the command sequence I use (in pyusb) is:
import usb #sets up libusb
...
allBus=usb.busses() #read in a list of available USB busses
...
bus=allBus[bIndex] #focus on bus number bIndex
dev=bus.devices[dIndex] #focus on device number dIndex on that bus
handfiv.open() #open that device and return the DeviceHandle
#read the device serial number as a string
#prepend 'USB' to distinguish this from RS-232 equipment
#on the same system
thisSerNum='USB'+hand.getString(dev.iSerialNumber, USB_SHORT_BUFF)
...
Ellipsis marks omitted code which sets up variables and is not directly related to the usb managment.
The code fails at the hand.getString() call (with SYSFS in the .rules file).
This code is part of a device-identification loop, and so there is no claimInterface() command. Device-descriptor queries like the above are necessary to determine which interfaces are available for claiming.
Thanks for your help.
-Sarah
--- On Sat, 1/3/09, Piter PUNK <piterpunk@unitednerds.org> wrote:
> From: Piter PUNK <piterpunk@unitednerds.org>
> Subject: Re: USB / udev only work for root
> To: "Sarah Messer" <ikustosu@yahoo.com>
> Cc: "libusb-devel" <libusb-devel@lists.sourceforge.net>, linux-hotplug@vger.kernel.org
> Date: Saturday, January 3, 2009, 12:24 PM
> Sarah Messer wrote:
> > The problem is not present on an OpenSUSE 10.0 machine
> running identical code with straight libusb-0.1/pyusb
> >
> > /etc/udev/rules.d/55-libsane.rules contains the
> following lines (among many others):
> >
> > # ENV{DEVTYPE}="usb_device",
> NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}",
> MODE="0664", OWNER="root",
> GROUP="root"
> >
> > SUBSYSTEM="usb",
> ACTION="add|change",
> SYSFS{idVendor}="0699",
> SYSFS{idProduct}="0368", GROUP="usb",
> MODE="0664"
>
> Change SYSFS to ATTRS.
>
> Piter Punk
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-05 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-02 22:54 USB / udev only work for root Sarah Messer
2009-01-03 18:24 ` Piter PUNK
2009-01-05 15:58 ` Sarah Messer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).