FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2007
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I allow automatic non root access to my non standard USB device ?

    I'm doing some embedded development and my flash programmer has a USB
    interface. Everything works fine if I program the device as root, but
    I'd like to be able to do it as a regular user. I get port permission
    errors if I try to run the programmer as a regular user.

    $ lsusb
    Bus 002 Device 003: ID 064e:a101 Suyin Corp. Laptop integrated WebCam
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 007 Device 006: ID 15ba:0003 Olimex Ltd. OpenOCD JTAG
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 002: ID 046d:c512 Logitech, Inc. LX-700 Cordless Desktop
    Receiver
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial
    Port
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 004: ID 07ca:a321 AVerMedia Technologies, Inc.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 003: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth +
    WLAN) Interface [Integrated Module]
    Bus 003 Device 002: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint
    Sensor
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


    My programmer is the Olimex Ltd. OpenOCD JTAG device on bus 7.

    The documentation for the device says it needs access to /proc/bus/usb.

    I can allow regular user access by manually issuing a chown command for
    the port, but then I'd have to do it every time I reboot or unplug the
    programmer. How do I set it up to happen automatically in F10 ?

    Thanks !

  2. #2
    PabloTwo's Avatar
    PabloTwo is offline "Fedora User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,919
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Probably the most elegant, and proper way, to allow users rw access to that usb flash programmer is to write a udev rule specifically for it, giving it the permissions and/or ownership level you wish. I have no experience at doing that, so I'll leave that up to you and/or someone else willing to assist you at doing so.

    But, the dirty quick way to allow all users rw permission on all usb (serial) devices would be to modify the default udev rule and change the permissions setting. As stated, this would affect all usb devices, and not just your flash programmer unit. Assuming it's the same file in F10 as F8, which I use:

    /etc/udev/rules.d/50-udev-default.rules

    And the section to look for and the line to modify:
    Code:
    # libusb device nodes
    SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0600"
    Change the MODE="0600" to MODE="0666". It would be prudent to make a backup copy of that file before attempting any edit if you decide to try this method. This should negate any necessity to do any 'chown' commands.

    I haven't tested this method just yet, but I'm about to on my next reboot. I just did the edit as mentioned above, plus another in the same file to enable me to run the 'minicom' command without requiring me to be root. I have minicom configured to talk to a device on /dev/ttyUSB0 as default, which is a usb>serial adaptor with a TNC (Terminal Node Controller) attached, and unless I call minicom as root, /dev/ttyUSB0 gives me the "oh no you don't" treatment.

    I've already tried the "chown paulm:uucp /dev/ttyUSB0" with success, and could add that command to my /etc/rc.d/rc.local file, but I'm going to give the udev mod a twirl first.

    Edit: Rebooted- The mods I made to the default udev rules worked for me. Minicom gave me rw access to usb hub2, port1 (the usb>serial device) through /dev/ttyUSB0 without complaint as a regular user. To unblock access to /dev/ttyUSB0 itself as a user, I changed MODE=0600 to MODE=0660 in the #serial section of the default udev rules file and added myself to the uucp group.
    Last edited by PabloTwo; 20th January 2009 at 10:45 PM.

  3. #3
    Join Date
    Jul 2007
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with what you are saying for F8, but I am not sure about F10.

    I used the gnome set authorizations application to allow non root access to my USB serial devices. I cannot find any rules in /etc/udev/rules.d I think that USB devices are handled differently in F10, but I can't find any documentation on how they now work.

    $ls /etc/udev/rules.d

    10-libifp.rules 60-wacom.rules 90-alsa.rules
    40-multipath.rules 70-mdadm.rules 90-hal.rules
    51-packagekit-firmware.rules 70-persistent-cd.rules
    91-drm-modeset.rules
    60-libmtp.rules 70-persistent-net.rules
    97-bluetooth-serial.rules
    60-libnjb.rules 85-pcscd_ccid.rules 99-fuse.rules
    60-pcmcia.rules 85-pcscd_egate.rules

    And 90-hal.rules contains this:

    # pass all events to the HAL daemon
    RUN+="socket:/org/freedesktop/hal/udev_event"

    I'd use the gnome set authorization tool to allow access to
    the USB port for my programmer, but it doesn't appear to handle non
    standard devices.

  4. #4
    PabloTwo's Avatar
    PabloTwo is offline "Fedora User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,919
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Sorry my suggested 'dirty' method didn't pan out for you. I was aware at the onset that differences/changes from F8 to F10 may throw a wrench into the gears. I also don't run Gnome so I don't have the gnome set authorizations to play around with and explore/experiment and XFCE doesn't appear to have anything equivalent. You could try:

    rpm -ql udev | grep default

    To see if F10 puts a default rules file in some other location than /etc/udev/rules.d/

    Putting your 'chown' command for the usb port(s) in /etc/rc.d/rc.local would probably only work if you kept that usb device plugged in all the time, as plugging it in after you booted up it would just take on the default values it uses now. Though, for the heck of it, you could try something like this in that rc.local file:

    chown -R elmerfud:root /proc/bus/usb/007

    That would make elmerfud owner of all the ports on usb bus 7. I presume that is basically the command you're using now, except you were perhaps targeting an individual port (6) instead of the whole bus. To test if plugging the device in with the whole bus set with the user as owner and if it would 'inherit' the same permissions properties, with the device unplugged, give the command shown above, then plug it in and see what shakes.

    My gut feeling is that it will just follow the udev rule and end up with 'root' as the owner of the port that it is assigned to, but if it did work, then adding that line into rc.local file would be your key to success.

  5. #5
    Join Date
    Jul 2007
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added a file named 50-udev-default.rules to /etc/udev/rules.d directory with the following in it:

    SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="15ba", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0600"

    Then I rebooted because I didn't know how to easily reset udev. Only my computer wouldn't reboot. It seemed to have a lot of trouble finding devices. I booted it with the F10 Live CD, mounted my hard drive and removed that file and it rebooted again.

    Any ideas ?

    At this point I think I am going to write a Python utility to find the port the device is mounted on and change the permissions accordingly. It will save me a lot of time.

  6. #6
    PabloTwo's Avatar
    PabloTwo is offline "Fedora User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,919
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Other than to suggest spending a bit of time in 'man udev' and trying again by adding an entry into some pre existing udev .rules file, no, I'm out of suggestions. It's looking like you already spent some time in 'man udev' as I see the line you added was not an exact clone of the line I posted from my F8 install. But in any event, if you succeed with this approach, I think you want MODE="0666", which was the mod I made to the entry on my system.

  7. #7
    Seve's Avatar
    Seve is offline Retired Community Manager
    Join Date
    Oct 2004
    Location
    The GTA, Ontario, Canada
    Age
    68
    Posts
    12,371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello:
    Is there not a setting under

    $ polkit-gnome-authorization

    where you can grant permission(s) to others ?

    Seve
    Registered Linux User: #384977
    .................................................. ............
    See the Links below for more Help and those much wanted extras ... :)


  8. #8
    PabloTwo's Avatar
    PabloTwo is offline "Fedora User" T-Shirt Winner
    Join Date
    Mar 2007
    Location
    Seville, FL
    Posts
    8,919
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Seve
    Is there not a setting under

    $ polkit-gnome-authorization

    where you can grant permission(s) to others ?
    Hi Seve-

    Well, no polkit-gnome-authorization app on my F8/XFCE install, but your suggestion prompted me to revisit my PolicyKit.conf file where I discovered I had an 'orphaned' entry left over from when I was doing battle with pulseaudio the other week. I suppose PolicyKit is another possible line of attack for elmerfud to use though.

  9. #9
    Join Date
    Sep 2007
    Location
    Cambodia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could take from here:
    http://forums.fedoraforum.org/showpo...63&postcount=2

    Building a special rule worked for me, trying to convince polkit did not.

    Cheers
    Hamlet - O, from this time forth, my thoughts be bloody, or be nothing worth !
    Shakespeare "Halmet" Act IV, Scene 4
    Registered Linux user number 418565

Similar Threads

  1. Forcing DVI output to a non-standard DVI device
    By CelticBlues in forum Using Fedora
    Replies: 0
    Last Post: 24th September 2008, 07:52 PM
  2. can't connect to an access point with a non standard key index
    By SwampYankee in forum Servers & Networking
    Replies: 0
    Last Post: 21st May 2008, 02:23 PM
  3. Is Device Mapper standard now?
    By jgarrison in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 18th May 2008, 06:53 PM
  4. Automatic unmounting through CD/DVD Device button
    By Ambiguous-69 in forum Using Fedora
    Replies: 11
    Last Post: 9th May 2006, 06:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •