Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: [SOLVED] Hardy - USB Device Permissions

  1. #11
    Join Date
    Jul 2007
    Location
    Melbourne, Australia
    Beans
    3,475
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Hardy - USB Device Permissions

    I saw this post earlier and found it hard to follow. Usb devices automount in ubuntu unless they have been improperly unmounted. If you are getting some error message, please post it. I've never had to put any lines into a 'permissions.rules file' to get a usb device to work. I'm confused as to why you thought you had to do this, this may have been necessary for linux when usb's were new, but everything to enable usb function is now included in the kernel, and has been for some time.
    Windows is the best virus detector on the market!
    Ubuntu attracts Human Beings - Windows attracts viruses and worms

  2. #12
    anewguy is offline I Ubuntu, Therefore, I Am
    Join Date
    Jun 2007
    Location
    Sometimes I visit earth
    Beans
    5,438
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Hardy - USB Device Permissions

    I'll try not to appear as frustrated as I am right now, so please bear with me. These devices require a "key" exchange to unlock. They also don't use "standard" USB communications as far as a camera device is concerned. As such, when they are mounted, they follow the rules in (at least now in Hardy) is 40-basic-permissions.rules. By default, the device is mounted with 664 permissions - it's owned by root and not world accessable:

    # USB devices (usbfs replacement)
    SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
    SUBSYSTEM=="usb_device", MODE="0664"

    By adding the following to that file, it essentially says "for these 2 devices identified by vendor and product id, mount them as world accessable":

    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0dca",SYSFS{idProduct}=="0027", MODE="0666"

    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="167b", SYSFS{idProduct}=="0101", MODE="0666"


    I don't know how else to explain this. They aren't "normal" USB cameras, they don't look like a flash drive, they don't look like anything.

    When the device permissions default to root as they do, you have to run via "sudo" from a command line rather than from a GUI. In addition, the program creates a folder and downloads the images into that folder. Since running as a super-user, the folder and images become owned by root, not the user, even though they are in the user's home folder. Try updating images and saving them back to that folder, or deleting them, and you need super user access again. Not good.

    As I said, the above lines solved the problem in Feisty and Gutsy - I know, I made the changes, it worked. The same lines are added to a different file (I believe it is 20-permissions.rules) in standard Debian.

    This is really all the clearer I think I can make it. Remember, these are not "standard" USB devices, so they are recognized as cameras, flash drives, etc..


    EDIT: Here's the C code where the failure happens unless root user - trying to claim the device via a libusb call:

    if (m_p_handle)
    {
    wrk_x = usb_set_configuration (m_p_handle, DEFAULT_CONFIGURATION);
    if (wrk_x !=0)
    {
    do_logmsg("Warning: Unable to set usb configuration (%d)\n",wrk_x);
    return FALSE;
    }


    I know the code isn't as "fancy" as it could be, but the thing is it works.

    the returned code is: (-1076978200)



    Soooooo......please somebody tell me either what stupid thing I am doing wrong or else what changed in either the device permissions handling (note it Hardy the USB devices where moved from 40-permissions.rules to 40-basic-permissions.rules) -OR- what changed in libusb such that now I have to be a root user no matter what.

    This is why I marked my latest post on this, which was merged back here, as for a moderator or a guru. I'm just an idiot, believe me, but I think there is much more to what is going on here than what the "normal" user with a "normal" device would run into. Basically, the program is working as the driver for the device.
    Last edited by anewguy; May 9th, 2008 at 06:35 AM.

  3. #13
    anewguy is offline I Ubuntu, Therefore, I Am
    Join Date
    Jun 2007
    Location
    Sometimes I visit earth
    Beans
    5,438
    Distro
    Ubuntu 12.04 Precise Pangolin

    Wink Re: Hardy - USB Device Permissions

    Okay, for all of you who may have thought I was full of it, via a yahoo search of 40-permissions.rules and reading through a LOT of posts, I found this:

    https://bugs.launchpad.net/ubuntu/+s...ev/+bug/210421

    Basically, the syntax used in the 40-permissions.rules file prior to Hardy has changed. In addition, other posts suggested that any user changes now need to be in a user-numbered-and-named.rules file higher than 40.

    So, I removed the 2 lines from 40-basic-permissions.rules and placed them in a new file called 41-cvs-permissions.rules, modified them to fit the new Hardy syntax, and guess what - it works.

    So, if someone else is having problems with device permissions, people should pay more attention to the udev files and the changes made to them for Hardy which caused the old syntax not to be recognized. I suppose SOMEWHERE in some log file there are some cryptic error messages about this, but basically this is the fix.

    Keep this in mind next time.
    Last edited by anewguy; May 9th, 2008 at 08:20 AM. Reason: small correction

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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