|
From: Andrew S. <str...@as...> - 2007-04-25 16:25:37
|
Sarah,
I think the simplest way is to go through udev.
1) create a group named something like "tekscope"
2) Create a file in /etc/udev/rules.d (well, that's where it is on
Ubuntu) something like:
SUBSYSTEM=="usb_device", ACTION=="add", SYSFS{idVendor}=="1234",
SYSFS{idProduct}=="5678", GROUP="tekscope", MODE="0660"
3) Restart udev to re-load the new rules, and voila, anyone in the
tekscope group should be able to access the USB device created when the
device is plugged in.
Sarah Messer wrote:
> Hello,
>
> I have a (working) USB interface to a Tektronix TDS-2014B oscilloscope
> based around pyusb. My issue is that it's only usable when I'm
> SuperUser. I'm doing support work for a company, and would rather not
> require several different people to log in as root in order to
> download data from the scopes. Here's what I've figured out so far:
>
> 1) The following python commands work the way one would expect if
> logged in as root:
> > import usb
> > barn=usb.busses()
> >barn[1].devices
> (<usb.Device object at 0x80ee5f8>,)
>
> 2) If I lack root access, the device list returns empty:
> ()
>
> 3) I'm running SuSe 10.0 with python 2.4.1, pyusb 0.3.5, and
> libusb-0.1.12 (with a minimal custom patch, see my posting on the
> libusb group
> <http://sourceforge.net/tracker/index.php?func=detail&aid=1633542&group_id=1674&atid=101674>
> for details).
>
> If I understand things correctly, there are three different low-level
> daemons / drivers which might be involved in establishing permissions
> for the USB ports: HAL, udev, and hotplug. I seem to have bits of all
> three on the system, and I'm trying to figure out which one sets the
> permissions:
>
> Things I've tried:
> 1) editted fstab to put the "users,dev,exec" flags on the usbfs line
> (in addition to the "noauto" flag that was there already. The full
> listing is:
> usbfs /proc/bus/usb usbfs noauto,users,dev,exec 0 0
> Despite this, rebooting mounts the usbfs with only the rw flag, not
> the users flag and so on. This makes me think that fstab doesn't
> actually control mounting of usbfs.
> 2) I tried editting the mount commands in /etc/hotplug/usb.rc, but
> again this has no effect. I made the first line of this file
> echo "Executing /etc/hotplug/usb.rc \a"
> but rebooting doesn't seem to produce either the bell or message.
> This makes me think Hotplug isn't handling the USB communication either.
> 3) lsmod and ps reveal the following potentially-relevant modules /
> processes: pci_hotplug, usblp, usbcore, ehci_hcd, uhci_hcd, hald,
> hald-addon-acpi, hald-addon-stor, and udevd.
> 4) If I run "chgrp users /dev/usbdev*" (as root), the affected
> devices become available to non-root users. However, if a device (or
> the PC) is power-cycled, it becomes root-only again.
>
> Any ideas on how to tell whether I need to learn HAL or UDev or
> something else? Any clues on how to let pyusb talk to the scopes for
> regular users?
>
> Thanks.
>
>
> -Sarah
>
> ------------------------------------------------------------------------
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.
> <http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Pyusb-users mailing list
> Pyu...@li...
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
|