You are not logged in.

#1 2005-02-21 22:10:49

Virtual DarKness
Member
From: Italy
Registered: 2004-04-02
Posts: 32
Website

digital camera with udev, without hotplug

I've read the digital camera page on the wiki but it uses hotplug to set the permission for the camera.

My camera is a usb ptp-only camera and now it works fine with digikam but only as root. As a normal user I can see the camera but I don't have read permissions.

I'd like to set up the device with permissions to 660 and owned by root:camera. I've the lastest udev version (053-1).. is it possible to do it configuring the udev.rules file? I've read that the permission file is no longer used but in it I found a section dedicated to the camera:

# camera devices
camera*:root:camera:0660
usb/dc2xx*:root:camera:0660
usb/mdc800*:root:camera:0660

so I tried to put this on the udev.rules file:

KERNEL="camera*",    NAME="camera%n", GROUP="camera", MODE="0660"
KERNEL="usb/dc2xx*",    NAME="camera%n", GROUP="camera", MODE="0660"
KERNEL="usb/mdc800*",    NAME="camera%n", GROUP="camera", MODE="0660"

but doesn't work..

any idea?
Thanks.

bye,
Giovanni.


Linux registered user #72162

Offline

#2 2005-02-21 22:48:37

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: digital camera with udev, without hotplug

You need to add yourself to the camera group.

For more info http://wiki2.archlinux.org/index.php/So … n%20denied

Offline

#3 2005-02-21 22:54:36

Virtual DarKness
Member
From: Italy
Registered: 2004-04-02
Posts: 32
Website

Re: digital camera with udev, without hotplug

Sorry I forgot to mention it: I'm already in the camera group..

bye,
Giovanni.


Linux registered user #72162

Offline

#4 2005-02-22 10:49:36

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: digital camera with udev, without hotplug

First of all don't change /etc/udev/rules.d/udev.rules.
I don't have access to my arch box right now but since you say that you can use /dev/camera as root I think there already is a rule in the standard udev.rules. But you can't have more than one rule for a device. The first rule in the file is used.
I would do something like this:
Copy udev.rules file to 00.udev.rules (it will be processed by udev as first rules file) and remove everything from there except the current rule for creating /dev/camera (just search for camera). Leave it as it is only add at the end of this line group and mode (as you did in your rules - ", GROUP="camera", MODE="0660"). If you use only one camera at a time you can also add symlink for example: SYMLINK="my_name_for_cam" (you can add other things like device id, etc., etc. - see http://www.reactivated.net/udevrules.php for more examples).
Let us know if it works. I'll check my udev.rules when I get back home today.

Offline

#5 2005-02-22 13:56:12

Virtual DarKness
Member
From: Italy
Registered: 2004-04-02
Posts: 32
Website

Re: digital camera with udev, without hotplug

Hi lanrat,
thanks for your answer..

I've created the 00.udev.rules file and using kinfocenter i found the serial number of my camera and tried to manage it in this way:

BUS="usb", SYSFS{serial}="KCTDL44735744", NAME="camera", GROUP="camera", MODE="0660"

the "/dev/camera" thing should apply only to cameras that can be seen as a storage device but mine works only with PTP.

According to the url you posted it should work but still doesn't (but I've not tried to reboot yet. Should I ?)

bye,
Giovanni.

p.s.
/proc/bus/usb/devices:

T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 13 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=040a ProdID=057f Rev= 1.00
S:  Manufacturer=Eastman Kodak Company
S:  Product=KODAK EasyShare DX7590 Zoom Digital Camera
S:  SerialNumber=KCTDL44735744
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=06(still) Sub=01 Prot=01 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=16ms

Linux registered user #72162

Offline

#6 2005-02-23 00:33:24

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: digital camera with udev, without hotplug

Hmmm. I'm not sure it this will work at all since your camera works with PTP only.

I have Canon Ixus v3 that supports both usb storage (I think but I never tried it) and PTP (which is what I'm using via hotplug usb agent).

If you want to be sure that udev will create a link you have to use udevinfo and udevtest utils.
You should also use /sys to find needed values. If you want to list all things that udev can see run udevinfo -s. You have to find the device under /sys/block or /sys/class.

For example:

udevinfo -p /sys/class/usb_host/usb1/device/usb1/1-1/1-1.4 -a

  looking at class device '/sys/class/usb_host/usb1/device/usb1/1-1/1-1.4':
    SYSFS{bConfigurationValue}="1"
    SYSFS{bDeviceClass}="ff"
    SYSFS{bDeviceProtocol}="ff"
    SYSFS{bDeviceSubClass}="ff"
    SYSFS{bMaxPower}="100mA"
    SYSFS{bNumConfigurations}="1"
    SYSFS{bNumInterfaces}=" 1"
    SYSFS{bcdDevice}="0001"
    SYSFS{bmAttributes}="c0"
    SYSFS{detach_state}="0"
    SYSFS{devnum}="6"
    SYSFS{idProduct}="3070"
    SYSFS{idVendor}="04a9"
    SYSFS{manufacturer}="Canon Inc."
    SYSFS{maxchild}="0"
    SYSFS{product}="Canon Digital Camera"
    SYSFS{speed}="12"
    SYSFS{version}=" 1.10"

Normally my usb devices are under /sys/class/usb (like my usb printer lp0). You have to search yourself. The important thing is that udevinfo can list all devices found under given node (sys subdir) but you can't mix values from different "levels" (devices) which means I can only use the values listed above (notice the lack of "bus" field).
The rule in 00.udev.rules could look like this:

SYSFS{idVendor}="04a9", SYSFS{idProduct}="3070", NAME="camera", GROUP="camera", MODE="0660", SYMLINK="default_camera cameras/canon_ixus_v3"

You can have up to 5 SYSFS fields in one rule (according to udev man) and several symlinks. The rule should create /dev/camera /dev/default_camera /dev/cameras/canon_ixus_v3. You can only have one rule for a device in udev (first rule is used).
After reboot udev restarts and you can test the rule with:

udevtest /sys/class/usb_host/usb1/device/usb1/1-1/1-1.4

It should print the matching rule (simulation) and udev rules file name.
Remember to plug your camera after reboot if you don't have coldplug enabled (hotplug in DAEMONS in /etc/rc.conf) - it will generate an event for udev.

I'm not really sure if it will work at all in case of this kind of protocol (even if you create the link in /dev how are you going to use it ?).

BTW why are you not using hotplug agent? It's very easy to setup and well described in the wiki. It also works very well with gtkam and digikam.

Offline

Board footer

Powered by FluxBB