LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-19-2007, 08:29 PM   #1
mastemmer
Member
 
Registered: Jul 2007
Location: Porto Alegre, Brazil
Distribution: Slackware
Posts: 44

Rep: Reputation: 17
Setting permisson of USB hotplug dev. (usbcam)


I am trying to set up the program gphoto2 to download photos
from my USB-cam (a canon PowerShot A450).
It works when i run gphoto2 as root, but not for a normal user.
Clearly a problem of permissions. But how to set the permissions
of a dynamically mounted USB device?
The manual that comes with gphoto instructs to place the files
/etc/hotplug/usb.usermap
and the script
/etc/hotplug/usb/usbcam
It did not work. Nothing happened.
Maybe the question is: Where should i place these files so that
the script is run when a new USBCAM is detected?
PS. My O.S. is Slackware 12.

M. Stemmer
 
Old 12-20-2007, 04:54 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
It depends. Do you have HAL installed and running ? By default it is. If so, I would add yourself to the appropriate groups as stated in the HAL sticky. The other way is to change/add udev rule for it to have a certain permission when the node is created.
 
Old 12-20-2007, 05:22 AM   #3
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
You could try and get a libgphoto2 package for Slackware 12.0 here (it will setup your UDEV rules properly): http://www.slackware.com/~alien/slac...oto2/pkg/12.0/

Or install digiKam for your photo management if you want - it is a great program and will popup anytime you attach your camera:

http://www.slackware.com/~alien/slac...ikam/pkg/12.0/

The digiKam program needs the following other packages to be installed (Slackare 12.0 packages also available from http://www.slackware.com/~alien/slackbuilds/):

exiv2
jasper
libgphoto2
libkdcraw
libkexiv2
libkipi
sqlite

Eric
 
Old 12-20-2007, 07:47 AM   #4
mastemmer
Member
 
Registered: Jul 2007
Location: Porto Alegre, Brazil
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 17
I installed the package from
http://www.slackware.com/~alien/slac...ikam/pkg/12.0/
but gphoto2 still works only as root.
It added a file
/etc/udev/rules.d/90-libgphoto2.rules
that should have assigned permission 660 belonging to group plugdev
I am in this group. The entries in
/proc/bus/usb
that were mounted when the camera was plugged still belong to root:root
But alas, manually changing their permission to 666 still does not work.
For now think i will give up gphoto2 and try digiKam.

M. Stemmer
 
Old 12-20-2007, 08:19 AM   #5
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
I solved a similar problem with a Canon Powershot A70 and 720IS in this way:

http://www.linuxquestions.org/questi...-gtkam-594315/

Fluxx.

Last edited by Fluxx; 12-20-2007 at 08:21 AM.
 
Old 12-20-2007, 10:40 AM   #6
mastemmer
Member
 
Registered: Jul 2007
Location: Porto Alegre, Brazil
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 17
That tip from Fluxx was the breakthru i was needing.
Especially this rules file from rworkman:

Quote:
Originally Posted by rworkman View Post
For the time being, this should work for you - put this in a custom 90-local.rules file:
Code:
SUBSYSTEM=="usb" \
  ATTR{product}=="Canon Digital Camera" \
  ATTR{manufacturer}=="Canon Inc." \
  GROUP:="plugdev" \
  MODE:="0664"
Please confirm whether or not this works.
It solved my problem. Thank you.

M. Stemmer
 
Old 12-31-2007, 12:58 PM   #7
mastemmer
Member
 
Registered: Jul 2007
Location: Porto Alegre, Brazil
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 17
Just to explain how i did it:
To set the permissions for a digital camera for gphoto2 you need a file in
Code:
/etc/udev/rules.d
First use the lsusb to find the vendor and device code for the camera.
For my Canon PowerShot A450 it shows:
Code:
Bus 2 Device 3: ID 04a9:3149 Canon, Inc.
So, now i know that vendor=0x04a9 and device=0x3149 for my camera.
Now i cam make a file
Code:
/etc/udev/rules.d/90-usbcam.rules
conaining the followin entry:
Code:
ACTION=="add" SUBSYSTEM=="usb" ATTRS{device}=="0x3149" \
ATTRS{vendor}=="0x04a9" GROUP="plugdev" MODE="0664"
When i turn on the camera, a new device
Code:
/dev/usbdev2.3
is created and the group is set to plugdev with permission 664.

M. Stemmer
 
Old 01-01-2008, 07:40 AM   #8
Xdrummer
LQ Newbie
 
Registered: Jul 2005
Location: Slovakia
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
Watch out for kernel versions

Just to add my confusion to this subject. I have 2 laptops and one desktop, all running Slackware 12.0, all up-to-date with the same installations apart from having different kernels. I've first installed Slackware 12 on one of the laptops and kept the default kernel Slack offered me (along with my own modifications). I did not need to do a thing to get my camera working apart from copying udev rules I've kept from previous system. Nothings else and I could access my Cannon Ixus 40 PTP camera via Digikam as ordinary user. The horror unleashed when I've tried to do the same with the other computers, both featuring newer kernels (2.6.22 and 2.6.23). Suddenly I couldn't access the camera other than root. Nothing helped. I've read all the threads I found here and in other places. I've followed all the instructions, build all packages my self, added 90-local.rules etc. No results.

Finally, I've started to look for differences in my kernel configs and googled something about a deprecated option CONFIG_USB_DEVICE_CLASS. Manually setting this option to 'y' solved my nightmares. Now, I don't have any energy left to search what is it, why do I need it or what it does imply. I just thought it may help someone else stuck with similar issue.

Apart from that, thanx for all the great instructions in this and other threads here.
 
Old 01-26-2008, 08:56 AM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I just bought a new digital camera (Fuji A900). It is detected fine when running gphoto2 as root, and I can get pictures off of it fine, but it will not work as a regular user. I've tried adding a udev rule for it, but it still will not be detected when running gphoto2 as regular user.

The device is:
Code:
Bus 1 Device 8: ID 04cb:01c7 Fuji Photo Film Co., Ltd
The rules I added to '/etc/udev/rules.d/90-usbcam.rules' are:
Code:
ACTION=="add" SUBSYSTEM=="usb" ATTRS{device}=="0x01c7" \
ATTRS{vendor}=="0x04cb" GROUP="plugdev" MODE="0664"
I restarted udev, plugged in the camera and it is NOT detected as user. I am a member of 'plugdev' and other devices such as cdrom and usb sticks can be accessed just fine. I also restarted HAL and tried reloading the messagebus, but this also had no effect. This is strange. Any ideas ?
 
Old 02-05-2008, 02:42 PM   #10
mastemmer
Member
 
Registered: Jul 2007
Location: Porto Alegre, Brazil
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 17
Very strange indeed. I don't know why it works. I don't knhow why it doesn't work.
I just tried to do the same recipe on another computer, also with Slackware 12 and there was no way to change the permission mode and ownership of the usbdev.
It just seems to ignore the /etc/udev/rules.d/90-usbcam.rules.
 
Old 02-05-2008, 03:32 PM   #11
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
Could it be that another rule has already matched? I think that udev reads the files in order, and uses the first match it finds. 90 is pretty low precedence, try moving it up to see if it makes a difference.I think that local rules are usually moved way up. Try 10-local.rules.

Brian

Last edited by BCarey; 02-05-2008 at 03:33 PM.
 
Old 02-06-2008, 06:18 AM   #12
PJBrs
Member
 
Registered: Oct 2006
Distribution: Slackware 14.2 / -current
Posts: 76

Rep: Reputation: 33
I have the same problem; I compiled libgphoto2 both with AlienBOB's slackbuld and the one from Slackbuilds.org (without checking whether they're the same script ), with both I had problems. Reading this thread, I did:

Code:
$ zgrep CONFIG_USB_DEVICE_CLASS /proc/config.gz
# CONFIG_USB_DEVICE_CLASS is not set
I'll recompile the kernel (2.6.24 in my case) and see if it works.
 
Old 02-07-2008, 06:03 AM   #13
PJBrs
Member
 
Registered: Oct 2006
Distribution: Slackware 14.2 / -current
Posts: 76

Rep: Reputation: 33
Ha! I recompiled with CONFIG_USB_DEVICE_CLASS=y and now it works for non-root users too!

Thanks, Xdrummer!
 
Old 02-07-2008, 09:42 AM   #14
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Stange, I don't have that option enabled either. I guess I have to re-compile.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
digikam and usbcam permissions on slackware 11 - tried everything :( Xdrummer Slackware 3 12-06-2006 02:42 PM
Hotplug, digikam, usbcam, Slackware 11.0 problem arubin Slackware 6 10-17-2006 05:39 AM
USB hotplug: how do I get the same /dev node every time? georgekm Linux - General 5 03-29-2005 06:25 PM
stop hotplug from detecting things connected to usb (but still noticing usb itself) TheOneAndOnlySM Linux - Hardware 5 10-18-2003 10:35 AM
USB Compact flash card reader hotplug creates /dev/sda but no /dev/sda1 -Mandrake 9.1 bibinono Linux - Hardware 2 08-11-2003 09:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration