mount PTP camera with fusefs_gphotofs as a user

I'm currently trying to mount a PTP camera as a user via fusefs_gphotofs.

It works as root but not as a user. I think I've done everything I'd expect/need to do to get this to work. There's not a great deal of info resulting from Google searches.

Any and all help/advice appreciated. Lots of details below, please tell me if you want/need more diags.

Code:
uname -a
FreeBSD webmaker.asgard.uk 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0: Mon Apr 25 18:54:10 BST 2011     root@:/usr/obj/usr/src/sys/WEBMAKER  i386
Code:
ldstat | grep fuse
12    1 0xc5315000 e000     fuse.ko

Code:
/etc/devfs.conf
perm    xpt0    0660
perm    pass*   0660
own     fuse*   root:operator
perm    fuse*   0666
perm    ugen*   0666
perm    usb*    0666
perm    acd0    0660
perm    cd0     0660
link    cd0     cdrom
link    cd0     dvd

Code:
cat /etc/devfs.rules
[system=10]
add path 'pass*'        mode 0666
add path 'xpt0'         mode 0666
add path 'unlpt*'       mode 0666 group cups
add path 'ulpt*'        mode 0666 group cups
add path 'lpt*'         mode 0666 group cups
add path 'cdrom'        mode 0666 group operator
add path 'fd0'          mode 0666 group operator
add path 'dvd'          mode 0666 group operator
add path 'da*'          mode 0666 group operator
add path 'uscanner*'    mode 0666 group operator
add path 'bktr'         mode 0666 group operator
add path 'bktr0'        mode 0666 group operator
add path 'tuner'        mode 0666 group operator
add path 'tuner0'       mode 0666 group operator
add path 'video*'       mode 0666 group operator
add path 'cuse*'        mode 0666 group operator
add path 'fuse*'        mode 0666 group operator
add path 'ugen/*'       mode 0666 group operator
add path 'usb/*'        mode 0666 group operator
add path 'ugen*'        mode 0666 group operator
add path 'usb*'         mode 0666 group operator

Code:
pw groupshow operator
operator:*:5:root,dave

mount point is:
Code:
ll | grep camera
drwxr-xr-x   2 dave  dave             0 Jan  1  1970 camera

Mounting the camera:
Code:
gphotofs ~/camera

No errors reported, no output to stdout.

Accessing the mountpoint:
Code:
ls camera/
ls: camera/: Protocol error

output from mount command (local HDDs and NFS mount removed):
Code:
mount
devfs on /dev (devfs, local, multilabel)
linprocfs on /usr/compat/linux/proc (linprocfs, local)
procfs on /proc (procfs, local)
/dev/fuse0 on /usr/home/dave/camcard (fusefs, local, nosuid, synchronous, mounted by dave)
/dev/fuse1 on /usr/home/dave/camcard (fusefs, local, nosuid, synchronous, mounted by dave)
/dev/fuse2 on /usr/home/dave/camera (fusefs, local, nosuid, synchronous, mounted by dave)

Processes:
Code:
ps -aux | grep gphoto
dave  58088  0.0  0.8 30680  8248  ??  Is    3:57PM   0:00.61 gphotofs /home/dave/camera
Unmounting:
Code:
umount ~/camera
umount: /home/dave/camera: statfs: Protocol error
umount: /home/dave/camera: unknown file system

su to root then mount it:
Code:
gphotofs /home/dave/camera
ls camera/
store_00010001
ls camera/store_00010001/DCIM/999_FUJI/
DSCF9284.JPG DSCF9285.JPG DSCF9286.JPG DSCF9287.JPG DSCF9288.JPG DSCF9289.JPG

Code:
ps -aux | grep gphoto
dave  58088  0.0  0.8 30680  8260  ??  Ss    3:57PM   0:00.73 gphotofs /home/dave/camera
root  58435  0.0  0.8 31048  8560  ??  Ss    4:03PM   0:00.27 gphotofs /home/dave/camera

Code:
umount /home/dave/camera/

ps -aux | grep gphoto
dave  58088  0.0  0.8 30680  8260  ??  Is    3:57PM   0:00.73 gphotofs /home/dave/camera

Back to user dave:
Code:
umount ~/camera
umount: /home/dave/camera: statfs: Protocol error
umount: /home/dave/camera: unknown file system

ps -aux | grep gphoto
dave  58088  0.0  0.8 30716  8272  ??  Ss    3:57PM   0:00.85 gphotofs /home/dave/camera

kill -HUP 58088

ps -aux | grep gphoto
(no output this time)
 
Hi, check what happens when you put in the sysctl.conf file
Code:
vfs.usermount=1
This option is responsible for allow regular users to mount file systems. Of course it will be available after next reboot, but you can do it faster using one of these commands; # /etc/rc.d/sysctl reload # /etc/rc.d/sysctl restart

Also please change permissions for devices listed in devfs.conf file to something like e.g. # chmod 0640 /dev/device_name
Eventually you can try # chmod 0660 /dev/device_name
And restart devfs using # /etc/rc.d/devfs restart


By the way. I think that most important device/option is
Code:
perm    ugen* 666
placed in the /etc/devfs.conf. What about digiKam? "An advanced digital photo management application for KDE", available in the Ports Collection and as a package graphics/digikam.
 
Hi Francis,

Code:
vfs.usermount=1
is already in /etc/sysctl.conf (should have put that in the OP).

No luck changing devices to 0640 (write only for group. I need to write too, but same errors on trying to access as user).

I've not made any changes to devd.conf from the default, there are no references in there to usb* or ugen*-like devices.

I've just run digikam as user (from Konsole), no camera detected.
Code:
digikam: Failed to autodetect camera!
digikam: Libgphoto2 error: No error (0)

Re-run it as root and it works.

That's interesting because I did try the ghoto2 frontend for libgphoto2 from the command line and that detected the camera logged in as user before I installed fusefs_ghotofs. Gphoto2 also detected the webcam I use for timelape from a script using gphoto2. This script no longer works because gphoto2 no longer detects *any* camera as user, only as root.

It's looking as though fusefs_gphotofs has changed something on install that I didn't expect and currently don't know about.

As user:
Code:
gphoto2 --auto-detect
Model                          Port
----------------------------------------------------------

As root:
Code:
gphoto2 --auto-detect
Model                          Port
----------------------------------------------------------
Fuji FinePix S1800             usb:/dev/usb,/dev/ugen3.3
Argus DC-1510                  usb:/dev/usb,/dev/ugen0.3
 
Hi, if the permission change to 0640 does not work, try # chmod 0666 /dev/fuse*

I also think that you may opt out from /etc/devd.conf, /etc/devfs.rules[1] and leave only /etc/devs.conf file (In this file is also a few examples. Worth a look). For example, for the acd0 device it looks (I give it only for certainty);
Code:
# Allow members of the group operator to mount the cdrom.
own     /dev/acd0       root:operator
perm    /dev/acd0       0660
In my case after changing permission for /dev/acd0 to - if I remember 0666 - I can mount cd as a regular user in the home directory. Similar to floppy etc.
dgmm said:
...that detected the camera logged in as user before I installed fusefs_ghotofs.
So maybe try to remove fusefs_gphotofs? I see that there is no options to configure. Have a look on sysutils/fusefs-kmod.


[1]Returning to /etc/devfs.rules file. Maybe create usb group, then add user and put these lines to /etc/devfs.rules]
Code:
[usb_dev=10]
add path 'usb/*' mode 0660 group usb
add path 'da*s*' mode 0660 group usb
The usb/* should set the permissions for using some camera protocol. The da*s* should do the same thing but for USB Mass Storage devices. Of course you must add to the /etc/rc.conf file;
Code:
devfs_system_ruleset="usb_dev"
and restart devfs. Browse /boot/defaults/loader.conf file for finding something interesting/useful.
 
It seems to be something more fundamental in the USB access chain of events.

I've now kldunloaded fuse.ko, pkg_deleted all three fusefs related ports, removed libgphoto2 and reinstalled from ports, tried creating group usb, added my user to it, did perm and own to root:usb in devfs.conf (and restarted both devfs and devd). Neither camera detected by gphoto2 --auto-detect, both are detected by root user.

I've also discovered now that as a user, my USB scanner is no longer detected. I think I'll take this problem off to the FreeBSD newsgroups, relevant mailing list(s) and/or contact the gphoto2 port maintainer.

I'm currently installed gphoto2 onto a (relativey) vanilla FreeBSD box to see what happens there. I've just checked /etc/devfs.conf and it's not been touched as of yet. That should give me a known clean system to work from. This time I can check what, if anything, changes.
 
SOLVED
Bugger! It was so simple to fix. Maybe too simple and too obvious LOL

I'm busy checking ownership and permissions for read/write access and I finally noticed that ugen devices are links to usb/n.n.n It's not just a name. It really is a link to a device inside a directory. For whatever reason, /dev/usb was 766. Only root could get in there.

Since that's something I've never noticed before and never had a need or reason to change, I can't see why or how it did change. Whatever the reasons, chmod 776 /dev/usb has fixed things at least to the extent that gphoto2 now finds both cameras and sane can detect the scanner as user, not just root.

I'm off to re-install fusefs_gphotofs and will report back for closure and search engine completeness. And yes, I do feel stupid :)
 
SOLVED - fusefs_gphotofs works fine.

Yes, it really was as simple as changing the permissions on /dev/usb to 770, i.e. making /dev/usb executable for group as well as owner.

Installing fusefs_gphotofs, the associated lib and kernel module worked fine, no changes made to the permissions of /dev/usb by the install. I still don't why or how they changed originally but it's all working fine now.
 
Back
Top