Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Writing udev Rules
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Kenji Miyamoto
Veteran
Veteran


Joined: 28 May 2005
Posts: 1452
Location: Looking over your shoulder.

PostPosted: Sun May 21, 2006 10:32 am    Post subject: Writing udev Rules Reply with quote

How would I write a rule to change the permissions on the following device? I have no hotplug:
Code:
  looking at device '/class/usb_device/usbdev3.5':
    KERNEL=="usbdev3.5"
    SUBSYSTEM=="usb_device"
    SYSFS{dev}=="189:260"

  looking at device '/devices/pci0000:00/0000:00:13.1/usb3/3-1':
    ID=="3-1"
    BUS=="usb"
    DRIVER=="usb"
    SYSFS{configuration}==""
    SYSFS{serial}=="KCKCY41700223"
    SYSFS{product}=="KODAK EasyShare CX7430 Zoom Digital Camera"
    SYSFS{manufacturer}=="Eastman Kodak Company"
    SYSFS{maxchild}=="0"
    SYSFS{version}==" 2.00"
    SYSFS{devnum}=="5"
    SYSFS{speed}=="12"
    SYSFS{bMaxPacketSize0}=="8"
    SYSFS{bNumConfigurations}=="1"
    SYSFS{bDeviceProtocol}=="00"
    SYSFS{bDeviceSubClass}=="00"
    SYSFS{bDeviceClass}=="00"
    SYSFS{bcdDevice}=="0100"
    SYSFS{idProduct}=="057b"
    SYSFS{idVendor}=="040a"
    SYSFS{bMaxPower}=="  2mA"
    SYSFS{bmAttributes}=="c0"
    SYSFS{bConfigurationValue}=="1"
    SYSFS{bNumInterfaces}==" 1"
The following rule doesn't work:
Code:
# cat /etc/udev/rules.d/10-local.rules
BUS=="usb", SYSFS{idVendor}=="040a",MODE="0666",GROUP=camera,NAME="kodak%n"
The rulen does work (and I'ven changed kodak to camera), and the following device is created:
Code:
crw-rw-rw- 1 root camera 189, 261 2006-05-21 03:49 /dev/camera6
If the device node is created, gphoto2 cannot find the camera. Also, the procfs entry isn't changed:
Code:
$ ls -lR /proc/bus/usb/
/proc/bus/usb/:
total 0
dr-xr-xr-x 2 root root 0 2006-05-21 03:42 001
dr-xr-xr-x 2 root root 0 2006-05-21 03:42 002
dr-xr-xr-x 2 root root 0 2006-05-21 03:42 003
-r--r--r-- 1 root root 0 2006-05-21 03:48 devices

/proc/bus/usb/001:
total 0
-rw-rw-r-- 1 root usb 43 2006-05-21 03:42 001

/proc/bus/usb/002:
total 0
-rw-rw-r-- 1 root usb 43 2006-05-21 03:42 001

/proc/bus/usb/003:
total 0
-rw-rw-r-- 1 root usb 43 2006-05-21 03:42 001
-rw-rw-r-- 1 root usb 57 2006-05-21 03:48 006
How would I change this?
_________________
[ Kawa-kun, new and improved!! ]

Alex Libman seems to be more of an anarchist than a libertarian.
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Sun May 21, 2006 12:24 pm    Post subject: Reply with quote

If you need a fixed device name, you should go for SYMLINK.
Code:
BUS=="usb", SYSFS{serial}=="KCKCY41700223", NAME="%k", SYMLINK="mykodak", GROUP="camera"

This should give you a device node /dev/mykodak pointing to the real device. Btw. I would change the idVendor to serial, as the given vendor id doesn't look that specific.
_________________
-- erol
Back to top
View user's profile Send private message
Kenji Miyamoto
Veteran
Veteran


Joined: 28 May 2005
Posts: 1452
Location: Looking over your shoulder.

PostPosted: Sun May 21, 2006 9:22 pm    Post subject: Reply with quote

The thing is, I found out that the permissions to /proc/bus/usb need to be adjusted, since Gphoto2 uses the legacy interface. Is there a way to do this?
_________________
[ Kawa-kun, new and improved!! ]

Alex Libman seems to be more of an anarchist than a libertarian.
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Sun May 21, 2006 9:54 pm    Post subject: Reply with quote

Maybe you can set the correct permissions in proc with a RUN in your udev rules iow faking hotplug :). Something like
Code:
RUN+="/usr/sbin/changepermission.sh"
You can also pass parameters to RUN rules.
_________________
-- erol
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Sun May 21, 2006 9:59 pm    Post subject: Reply with quote

Found this thingie regarding libusb vs. kernel drivers. That's more scanner related but if your GPhoto2 also relies on usbfs and libusb ...
_________________
-- erol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum