LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2005, 04:55 PM   #1
gumb
Member
 
Registered: Oct 2005
Distribution: openSUSE
Posts: 38

Rep: Reputation: 15
USB camera works as root but not user


I managed to get my USB digital camera (Sony DSC-V1) to work using Digikam when logged in as root. Although it only ever auto-detects it as an F707 despite the V1 also being in the default list of devices, it works the same with either setting. This is in PTP mode (haven't had any joy using USB mass storage mode).

When I log in under my normal username it produces an error along the lines of 'cannot access the device' or 'cannot read the device'. I'm sure this is just a basic permissions issue or similar but since I'm a Linux dunce I don't know where to start in rectifying it.

I'm running SuSE 9.2 as a single user on a Vaio laptop.

Thanks,
gumb.
 
Old 10-27-2005, 06:18 PM   #2
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,274

Rep: Reputation: 63
First, after connecting the camera, run dmesg at the commandline or in a terminal window. This will tell you the name of the device it attaches to. Something like sda.

Next, run ls -l /dev/sda (or whatever device was output from dmesg). This will tell you the ownership and permissions. It's usually something like root:root rw-rw----

The easiest way to allow your user access would be, as root, to run chmod 666 /dev/sda (or whatever device was output from dmesg).
 
Old 10-28-2005, 07:19 AM   #3
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Or add 'users' into /etc/fstab for your camera to allow normal users access to mount, read + write from it.
 
Old 10-29-2005, 02:07 AM   #4
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
Since you're using PTP mode with Digicam you should read this to set up the permissions correctly:

http://www.gphoto.org/doc/manual/permissions-usb.html

A lot of this work will already be done but just verify that everything is the way it should be. I have a DSC-P52 and personally I'd much rather use it as a mass storage device, support for which has vastly improved with more recent kernels.
 
Old 10-29-2005, 02:38 PM   #5
gumb
Member
 
Registered: Oct 2005
Distribution: openSUSE
Posts: 38

Original Poster
Rep: Reputation: 15
Thanks for all the suggestions, but they don't really get me anywhere. Regarding the second reply and the adding of 'users' to fstab, I'm not entirely sure how to go about this, but I did modify the file at the line:

usbfs /proc/bus/usb usbfs defaults 0 0

so that it now reads

defaults,users
(I also tried defaults,user because I noticed everything else in that file is singular and I don't know what difference it makes)

That didn't change anything. Having switched the camera on and run dmesg, I see hundreds of entries saying:

hdc: packet command error: status=0x51 { DriveReady SeekComplete Error }
hdc: packet command error: error=0x50
ide: failed opcode was 100

Amongst all of this I found the line:

usb 4-3: new high speed USB device using address 2

So I don't know how to progress with the first response in this case. As for the third response, to me as a complete newbie it all seems rather hairy having read that link. It assumes my more advanced knowledge of too many things which don't make sense to me. However, I've tried to work my way through and have found that I only have a file 'devices' in my /proc/bus/usb directory, not one called 'drivers'. I then stumble at the point where it tells me to modprobe usb-ohci and usb-uhci, because both produce 'FATAL: Module usb_*hci not found.'

When I plug in or switch on the camera as root, nothing happens, but the PTP mode will work in Digikam. As a user, a box launches stating a new camera was detected, and asking if I want to open with: kfmclient openURL camera:/ ?
If I click yes, the directory contains two subdirectories, one for the Sony DSC-F707V and one for the Sony DSC-V1 (both PTP mode). If I open either of them, after a few seconds I get an error saying:

Could not read file Could not claim the USB device.

I'm flummoxed on all three counts.
 
Old 10-30-2005, 12:39 AM   #6
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
Well the first two responses were dealing with the camera as a UMS (USB Mass Storage) device and since you're using PTP mode they're not really relevent.

The error messages in your dmesg output suggest that you don't have your secondary master device set up properly, so you should definitely look into that.

The modprobe errors you got indicate that either you have the usb drivers compiled into the kernel or they don't exist. Assuming they're in the kernel you may be able to continue with the instructions anyway.
 
Old 10-30-2005, 10:40 AM   #7
gumb
Member
 
Registered: Oct 2005
Distribution: openSUSE
Posts: 38

Original Poster
Rep: Reputation: 15
The camera does offer both USB and PTP modes, so I switched it to USB. The only difference is now I can't access it at all. In Digikam as root, if I select USB Mass Storage device, it fails. I checked the system information in YaST and found that I have EHCI USB drivers, as opposed to OCHI or UHCI. However, if I try modprobe usb-ehci, I get the same fatal error.

I then typed dmesg again with it as a USB mass storage device, and noticed the following output:

usb 4-3: new high speed device using address 3
scsi1 : SCSI emulation for USB Mass Storage devices
Vendor: Sony Model: Sony DSC Rev: 4.50
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sda: 63424 512-byte hdwr sectors (32 MB)
sda: test WP failed, assume Write Enabled
sda: assuming drive cache: write through
/dev/scsi/host1/bus0/target0/lun0: p1
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi1, channel 0, id 0, lun 0, type 0
USB Mass Storage device found at 3

Following this are several more of the hdc packet command errors previously described. I don't understand what any of this means and what the relevance of SCSI is. Can anyone see an obvious problem and magic solution here?

PS If I now try ls -l /dev/sda, I get:
brw-rw---- 1 root disk 8, 0 Oct
 
Old 10-30-2005, 11:37 PM   #8
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
SCSI is the protocol that UMS uses to transfer the data. It's the same protocol that was emulated to enable cd burning in older kernels until the ATAPI protocol was ironed out. Your dmesg output with the camera as the scsi device indicates that it's attached to sda1, which is normal if you only ever attach one USB device.

Now the easiest thing for you to do would be to create a mount point - in your case I would use /mnt/dsc-v1 or you could use /mnt/camera or whatever. Assuming the first, then you would want to add the following line to /etc/fstab:
Code:
/dev/sda1   /mnt/dsc-v1  vfat      noauto,users          0   0
Then when you plug the camera in, you would be able to, as a regular user:
Code:
mount /mnt/dsc-v1
and use it like you would any mounted device (floppy, etc). When you're done just umount it and everything's ok.

I like to use midnight commander (mc) to transfer the files (because it's quick, doesn't load thumbnails that drain the camera battery, etal). I have a menu command like so (where my mount point is /mnt/dsc-p52):
Code:
mount /mnt/dsc-p52 ; sleep 2 ; xterm -geometry 96x60 -e mc /mnt/dsc-p52 /home/share/pictures ; umount /mnt/dsc-p52
This opens mc and umounts the camera when it's done. The only problem is that sometimes the camera doesn't mount on the first try - I'm not sure why.

As for the hdc packet command errors, they're not related to the camera but you should definitely think about posting another question concerning them...
 
Old 11-01-2005, 02:30 AM   #9
gumb
Member
 
Registered: Oct 2005
Distribution: openSUSE
Posts: 38

Original Poster
Rep: Reputation: 15
I'm still having problems with this. I've done as specified and entered the line in fstab. (Again, I'm confused as to the difference between 'user' and 'users', because all the other entries in that file only say 'user'). Anyway, it gives me the error 'Mount point /mnt/cam does not exist'.

I ran dmesg again and found that the output was similar but it shows
/dev/scsi/host0/bus0/target0/lun0: p1
and elsewhere where it previously said scsi1 it now has scsi0

I haven't unplugged the device or put it in another USB port. Does this mean it is still on sda1 or something else? I tried changing the line in fstab to sda or sda0 just at a guess, but no difference. The dmesg output is slightly different also in that it shows
'Initializing USB Mass Storage driver...'
at the start, which it didn't previously, and at the end it adds
'usbcore: registered new driver usb-storage
USB Mass Storage support registered'

I do want the device to work under root as well as my normal user account. Thanks for your help so far. I'm sure this is do-able but this laptop has never made things simple since I bought it.
 
Old 11-01-2005, 01:27 PM   #10
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
It looks like you haven't created the mount point /mnt/cam yet - you need to
Code:
mkdir /mnt/cam
The only real difference between "user" and "users" is that "user" is somewhat more restrictive - once mounted, only the user who mounted and root can unmount a fs, whereas "users" allows anyone to unmount a mounted fs. You can use "user" if you like (although I think there was a reason why I use "users" vs "user" even though there's only one account used on this machine).

The different dmesg messages indicate that the kernel simply used a different scsi device for some reason, it should still be accessible under /dev/sda1 (my understanding is that the camera is now "registered" to use sda1 each time, but I could be wrong). The "Initializing" messages are just indicating that you're using UMS vs PTP mode now, in PTP mode it didn't use scsi emulation.
 
Old 11-01-2005, 05:35 PM   #11
gumb
Member
 
Registered: Oct 2005
Distribution: openSUSE
Posts: 38

Original Poster
Rep: Reputation: 15
Excellent! That's cracked it, I'm finally up and running. It works fine now as root or user. Thanks a lot for your help and perseverance. I shall have to come back to this forum again with all my other queries!

gumb
 
  


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
camera only works in root??? sneckert Mandriva 9 01-30-2005 03:50 PM
X only works with root user joe83 Slackware 14 09-06-2004 08:17 AM
IntelliMouse thumb buttons work as root, broken as non-root user, wheel works always digital vortex Linux - Hardware 7 03-02-2004 04:14 PM
Camera only works as root. ToolBoy Linux - Hardware 1 06-23-2003 07:29 PM
Digital Camera Software for an non-root user gboutwel Linux - Software 2 06-29-2002 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:57 PM.

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