Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Permissions difficulties with USB camera
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
krazykit
Tux's lil' helper
Tux's lil' helper


Joined: 28 Aug 2004
Posts: 91

PostPosted: Tue Mar 08, 2005 2:42 am    Post subject: Permissions difficulties with USB camera Reply with quote

I'm trying to use my Canon Powershot a400 (a PTP device, NOT usb-mass storage) with digikam. I had it working out the other day, and now it doesn't (computer pixies, I bet :wink:). The reason I think it's a permissions problem is that my camera will work when I run digikam as root, but not as user.
doing cat /proc/bus/usb/devices gives me (irrelevant stuff snipped)
Code:
T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
P:  Vendor=04a9 ProdID=30b7 Rev= 0.01
S:  Manufacturer=Canon Inc.
S:  Product=Canon Digital Camera
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=06(still) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=83(I) Atr=03(Int.) MxPS=   8 Ivl=96ms

Any ideas on how to fix this problem?
Back to top
View user's profile Send private message
krazykit
Tux's lil' helper
Tux's lil' helper


Joined: 28 Aug 2004
Posts: 91

PostPosted: Tue Mar 08, 2005 7:10 pm    Post subject: Reply with quote

I suppose I could just always run the program in root, but that's really a cruddy solution.
Back to top
View user's profile Send private message
krazykit
Tux's lil' helper
Tux's lil' helper


Joined: 28 Aug 2004
Posts: 91

PostPosted: Sun Apr 10, 2005 11:35 pm    Post subject: Reply with quote

Well, perhaps it's time for a bump... it really is a shoddy solution to have to chmod after transferring pictures...
Back to top
View user's profile Send private message
fredgt
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 168
Location: Belgium

PostPosted: Mon Apr 11, 2005 12:07 am    Post subject: Reply with quote

I've got the same camera and i had that problems to. It's a hotplug problems, it doesn't set the correct device file properties.
You can edit the hotplug script ( /etc/hotplug/usb/usbcam ) so the device file property of the you're normal user (for me 'arne'). I also added a few lines, because it still didn't work but now it does.
It's probably not completely by the book but you can give it a try. Don't forget to backup the script before you edit it, and don't forget to change the username.

Code:

#!/bin/bash
# $Id: usbcam.console,v 1.4 2002/09/12 16:50:18 hun Exp $
#
# /etc/hotplug/usb/usbcam
#
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
    # New code, using lock files instead of copying /dev/console permissions
    # This also works with non-gdm logins (e.g. on a virtual terminal)
    # Idea and code from Nalin Dahyabhai <nalin@redhat.com>
    if [ -f /var/run/console.lock ]
    then
        CONSOLEOWNER=`cat /var/run/console.lock`
    elif [ -f /var/lock/console.lock ]
    then
        CONSOLEOWNER=`cat /var/lock/console.lock`
    else
        CONSOLEOWNER=
    fi
    if [ -n "$CONSOLEOWNER" ]
    then
        chmod 0000 "${DEVICE}"
        chown arne:users "${DEVICE}"
        chmod 0666 "${DEVICE}"
    else
        chmod 0000 "${DEVICE}"
        chown arne:users "${DEVICE}"
        chmod 0666 "${DEVICE}"
    fi
fi
Back to top
View user's profile Send private message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Mon May 02, 2005 2:18 pm    Post subject: Reply with quote

I think I'm having the same problem. I don't have either /var/run/console.lock or /var/lock/console.lock on my box. Has anyone filed a bug on this?
Back to top
View user's profile Send private message
Kern3lP4nic
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jun 2004
Posts: 116
Location: Someone, somewhere, in the north of Italy

PostPosted: Mon May 02, 2005 5:04 pm    Post subject: Reply with quote

those files are created by pam
Back to top
View user's profile Send private message
pesche
n00b
n00b


Joined: 08 Feb 2005
Posts: 21
Location: Berne, Switzerland

PostPosted: Wed May 18, 2005 2:08 pm    Post subject: Reply with quote

Hi there

Try to find the file usbcam.group on your disk. If you have digicam / gphoto2 and the right libs installed, the file should be located in

Code:
/usr/share/doc/libgphoto2-2.1.5/linux-hotplug/


The contents of the file should look like this

Code:

#!/bin/bash
# $Id: usbcam.group,v 1.3 2003/09/16 16:42:44 hun Exp $
#
# /etc/hotplug/usb/usbcam
#
# Sets up newly plugged in USB camera so that only members of the
# group

GROUP=camera

# can access it from user space. (Replace camera with the name of the
# group you want to have access to the cameras.)
#
# Note that for this script to work, you'll need all of the following:
# a) a line in the file /etc/hotplug/usermap that corresponds to the
#    camera you are using. You can get the correct lines for all cameras
#    supported by libgphoto2 by running "print-usb-usermap".
# b) a group "camera" where all users allowed access to the
#    camera are listed
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
#
# In the usermap file, the first field "usb module" should be named
# "usbcam" like this script.
#

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
    chmod o-rwx "${DEVICE}"
    chgrp "${GROUP}" "${DEVICE}"
    chmod g+rw "${DEVICE}"
fi


Change the group variable according to the group you want to have access to the camera device. Copy the modified file to

Code:
/etc/hotplug/usb/usbcam


Make a backup copy of the original file if needed. You have to chmod the usbcam file

Code:
chmod 775 /etc/hotplug/usb/usbcam


Plug in you camera and turn it on. Hotplug should now set the proper device permissions and you should be able to access your camera in digikam as a normal user. There are more example hotplug scripts, you can also create the device node with permissions e.g. only for one user, this is done in the file usbcam.user

Have a look at the files in

Code:
/usr/share/doc/libgphoto2-2.1.5/linux-hotplug


Greetings,
Pesche.
_________________
"The significant problems we have cannot be solved at the same level of thinking with which we created them."

Albert Einstein (1879 - 1955)
Back to top
View user's profile Send private message
iniTeX
n00b
n00b


Joined: 23 Jul 2003
Posts: 15
Location: Germany

PostPosted: Tue May 31, 2005 11:27 am    Post subject: problems with usbcam (fixed with USE=pam_console) Reply with quote

hi there,

i had problems with my ixus400 yesterday.

i figured out that "usbcam" wants to set the owner according to /var/run/console.lock.

unless you don't have the use-flag "pam_console" set and pam compiled with it you don't have something like /var/{lock,run}/console.lock.

so i compiled pam with pam_console. then i saw that there was not /var/run/console.lock but /var/run/console/console.lock.
i fixed usbcam with another elif-loop and i could download pictures from my camera again.

i don't now if this (use-variable and hacking a usbcam) was the right way to do it so i don't want to send in a bug report.

perhaps someone can enlighten me.

greets, iniTeX
_________________
dashi delegs
Back to top
View user's profile Send private message
pesche
n00b
n00b


Joined: 08 Feb 2005
Posts: 21
Location: Berne, Switzerland

PostPosted: Thu Jun 02, 2005 11:50 am    Post subject: Reply with quote

Hi Initex

As i have already written in my previous post, there's no need for any console.lock file or any other hacks. You just have to use the proper hotplug script (e.g. the one indicated in my post which works with groups...)

Greetings,
Pesche.
_________________
"The significant problems we have cannot be solved at the same level of thinking with which we created them."

Albert Einstein (1879 - 1955)
Back to top
View user's profile Send private message
digitalboi
n00b
n00b


Joined: 03 May 2005
Posts: 15

PostPosted: Fri Jun 03, 2005 8:37 pm    Post subject: Reply with quote

I have a similiar problem. I have got the camera to detect after I modified the permissions of usbcam.group like pesche said. However I have a wierd problem going on. Let me give the scenario.

User A logs into kde. Then User B logs into KDE. User A activates his session and view the pictures on the camera through digikam. Then User A leaves and User B activates her session to view the pictures however it says the camera is not hooked up, but User A has no problem viewing the pictures. As soon as User A logs completely out then User B can view the pictures on the camera. Also if user B logs in only, they have no problem viewing. I can't figure out what the problem is.

BTW when user B activates their session. User A does close out digikam completely and the process is no longer running when user B tries to view pictures on the camera.

Don't know if this has to anything to do with it, but when I try to view the camera thru konqueror using media://HP_M305 it gives an error saying it doesnt exist. This happens with both users but not with root. If someone can point me to the right file I would be grateful. If anyone needs any configs posted let me know and I'll be glad to do it. In the mean time I have to log out of my session everytime so the second person who logged in can view and import pictures off the camera. Please help. Thanks in advance.
Back to top
View user's profile Send private message
yfh2
Apprentice
Apprentice


Joined: 20 May 2004
Posts: 242

PostPosted: Tue Jul 19, 2005 10:36 pm    Post subject: Reply with quote

ok, now, what if I don't use hotplug ?

I found that the camera is created under /proc/bus/usb/003/xyz where xyz is incremented each time the camera is plugged.

It is initialised with root only permissions.

Can I change this in any way ???
Back to top
View user's profile Send private message
Pol
Tux's lil' helper
Tux's lil' helper


Joined: 01 May 2003
Posts: 113

PostPosted: Thu Jul 21, 2005 3:50 pm    Post subject: Reply with quote

digitalboi wrote:

Don't know if this has to anything to do with it, but when I try to view the camera thru konqueror using media://HP_M305 it gives an error saying it doesnt exist. This happens with both users but not with root. If someone can point me to the right file I would be grateful. If anyone needs any configs posted let me know and I'll be glad to do it. In the mean time I have to log out of my session everytime so the second person who logged in can view and import pictures off the camera. Please help. Thanks in advance.


Same here ... In root it works, in user not ...

Anyone found a solution ?
Back to top
View user's profile Send private message
seppelrockt
Guru
Guru


Joined: 14 May 2004
Posts: 423

PostPosted: Tue Aug 30, 2005 1:02 pm    Post subject: Reply with quote

The usbcam script solution works fine here - I even had the file at the right place allready - all I had to change was the group. No PAM and no hotplug needed.
Back to top
View user's profile Send private message
pkturner
n00b
n00b


Joined: 19 Sep 2003
Posts: 35
Location: Massachusetts, USA

PostPosted: Sat Sep 17, 2005 11:48 am    Post subject: bug Reply with quote

There's a more thorough discussion of this problem in bug 84628.
Back to top
View user's profile Send private message
Tarch
n00b
n00b


Joined: 27 Apr 2005
Posts: 42

PostPosted: Sat Dec 31, 2005 2:57 pm    Post subject: Reply with quote

Hi all, i've tried with the usbcam script solution but I have a problem, I add the group camera and I add my user to the group camera, I substitute the script, but gphoto says me that I don't have the permissions to access the device. I think it's related to the user and group from which I executing the program but I don't know how to resolve it (a temporary workaround is to set the permission rw to other but I don't like it).

Bye and thank you! 8O

P.S. Happy New Year.
Back to top
View user's profile Send private message
pkturner
n00b
n00b


Joined: 19 Sep 2003
Posts: 35
Location: Massachusetts, USA

PostPosted: Sat Dec 31, 2005 6:54 pm    Post subject: bugfix Reply with quote

When I looked at this topic 3 months ago I didn't like any of the suggested solutions, since they didn't appear to be headed toward a permanent fix.

Happily, there's now a fix in libgphoto2-2.1.6-r1. The ebuild is still listed as unstable, so if you want that fix right away you'll need to add it to /etc/package.keywords.
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