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. |
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). |
Or add 'users' into /etc/fstab for your camera to allow normal users access to mount, read + write from it.
|
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. |
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. |
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. |
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 |
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 Code:
mount /mnt/dsc-v1 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 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... |
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. |
It looks like you haven't created the mount point /mnt/cam yet - you need to
Code:
mkdir /mnt/cam 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. |
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 |
All times are GMT -5. The time now is 01:18 PM. |