Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 35860 - baselayout: usb device modes in /proc/bus/usb
Summary: baselayout: usb device modes in /proc/bus/usb
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: Low enhancement
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-15 00:15 UTC by Jonas Berlin
Modified: 2005-07-09 18:03 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Berlin 2003-12-15 00:15:07 UTC
Currently, when I want to import pictures from my camera with gphoto2, I need to do that as root because the usb devices in /proc/bus/usb/ are owned and writable by root only.

I studied the available options and since there already is a group "usb" in /etc/group, I thought that could be used as the group for usb devices and thus users could be allowed access to usb devices by simply including them in the usb group. I thought this solution would be analoguous with other gentoo group usage, for example that users need to be in the "cron" group to be able to use crontab, etc..

Since /etc/init.d/localmount is the script that takes care of mounting the usbfs/usbdevfs filesystem, I would suggest that it could use the following mount options:

devmode=0664,devgid=85

(gid 85 is at least in my current baselayout-1.8.6.10-r1 the group "usb")

.. which I would allow user (still root) and group (usb) read-write access to the usb devices. I tried this out and it seemed to work as expected.

-rw-rw-r--    1 root     usb            18 Dec 15 09:28 001

A bit more flexible but a bit less straightforward way would be to allow users to specify USBFSOPTS="devmode=0664,devgid=85" or whatever they like in /etc/conf.d/localmount and then just use whatever values the users want. Of course the options I presented (or some variation thereof) could be used as the default value unless the user has overridden the value by specifying some other USBFSOPTS value.
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2004-05-05 20:33:19 UTC
This seems like a good idea, but it totally doesn't work for me:

1 mustard /usr/src $ sudo umount /proc/bus/usb
0 mustard /usr/src $ sudo mount -t usbfs none /proc/bus/usb -o devmode=0664,devgid=85
0 mustard /usr/src $ ls -l /proc/bus/usb
total 0
dr-xr-xr-x  2 root root 0 May  5 21:50 001/
dr-xr-xr-x  2 root root 0 May  5 21:50 002/
dr-xr-xr-x  2 root root 0 May  5 21:50 003/
dr-xr-xr-x  2 root root 0 May  5 21:50 004/
-r--r--r--  1 root root 0 May  5 21:50 devices
0 mustard /usr/src $ ls -l /proc/bus/usb/001
total 0
-rw-r--r--  1 root root 43 May  5 21:50 001

Feel free to re-open if you can figure out what's wrong with this.
Comment 2 SpanKY gentoo-dev 2004-12-16 12:55:46 UTC
perhaps it was a kernel bug ?
Comment 3 SpanKY gentoo-dev 2004-12-16 12:59:43 UTC
root@vapier 0 bus # uname -a
Linux vapier 2.6.10-rc3 #23 Mon Dec 6 08:59:04 EST 2004 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz GenuineIntel GNU/Linux

root@vapier 0 bus # mount -t usbfs none /proc/bus/usb -o devmode=0664,devgid=85 
root@vapier 0 bus # ls -Rl usb
usb:
total 0
dr-xr-xr-x  2 root root 0 Dec  6 18:31 001
dr-xr-xr-x  2 root root 0 Dec  6 18:31 002
-r--r--r--  1 root root 0 Dec  6 18:31 devices

usb/001:
total 0
-rw-rw-r--  1 root usb 43 Dec  6 18:31 001
-rw-rw-r--  1 root usb 59 Dec  6 18:31 002

usb/002:
total 0
-rw-rw-r--  1 root usb 43 Dec  6 18:31 001
Comment 4 SpanKY gentoo-dev 2005-07-09 18:03:26 UTC
added back in