gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

MacOs Gphoto2 running only under sudo

Open marcelmatula opened this issue 1 year ago • 21 comments

Describe the bug

I am a newbie with MacOs (before I worked with gphoto2 on Ubuntu and Rasbian). When I installed (brew install gphoto2) I am able to take photo only with sudo (not with ordinary user). If there was any program blocking USB port I would expect same error for running command under sudo. I tried to add different groups to user but it did not help.

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error (-53: 'Could not claim the USB device') ***

Any suggestion what I am missing in order to run gphoto2 without sudo?

Thanks

Regular user getting:

Name the camera Canon EOS 550D usb:000,005

libgphoto2 and gphoto2 version gphoto2 2.5.28

Copyright (c) 2000-2021 Marcus Meissner and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of gphoto2 under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options: gphoto2 2.5.28 clang, popt(m), exif, no cdk, no aa, jpeg, readline libgphoto2 2.5.30 standard camlibs, clang, no ltdl, EXIF libgphoto2_port 0.12.1 iolibs: disk ptpip serial usb1, clang, no ltdl, EXIF, USB, serial without locking

To Reproduce Steps to reproduce the behavior: sudo gphoto2 --capture-preview // this works gphoto2 --capture-preview // this does not - see log below

If its a camera misbehavior, attach debug output using --debug --debug-logfile=debug.log (if considered useful).

gphoto2 --capture-preview --debug \0.000018 main (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST: 0.000030 main (2): gphoto2 2.5.28 0.000033 main (2): gphoto2 has been compiled with the following options: 0.000035 main (2): + clang (C compiler used) 0.000036 main (2): + popt (mandatory, for handling command-line parameters) 0.000038 main (2): + exif (for displaying EXIF information) 0.000043 main (2): + no cdk (for accessing configuration options) 0.000045 main (2): + no aa (for displaying live previews) 0.000046 main (2): + jpeg (for displaying live previews in JPEG format) 0.000047 main (2): + readline (for easy navigation in the shell) 0.000049 main (2): libgphoto2 2.5.30 0.000051 main (2): libgphoto2 has been compiled with the following options: 0.000053 main (2): + standard camlib set (ax203 canon digigr8 dimagev directory docupen jl2005a jl2005c kodak_dc240 lumix mars pentax ptp2 ricoh_g3 sierra sonix sq905 st2205 topfield tp6801) 0.000055 main (2): + clang (C compiler used) 0.000056 main (2): + no ltdl (for portable loading of camlibs) 0.000057 main (2): + EXIF (for special handling of EXIF files) 0.000059 main (2): libgphoto2_port 0.12.1 0.000062 main (2): libgphoto2_port has been compiled with the following options: 0.000063 main (2): + iolibs: disk ptpip serial usb1 0.000064 main (2): + clang (C compiler used) 0.000066 main (2): + no ltdl (for portable loading of iolibs) 0.000067 main (2): + EXIF (for vusb) 0.000069 main (2): + USB (libusb1, for USB cameras) 0.000070 main (2): + serial (for serial cameras) 0.000071 main (2): + no resmgr (serial port access and locking) 0.000072 main (2): + no ttylock (serial port locking) 0.000074 main (2): + no lockdev (serial port locking) 0.000076 main (2): CAMLIBS env var not set, using compile-time default instead 0.000077 main (2): IOLIBS env var not set, using compile-time default instead 0.000079 main (2): invoked with following arguments: 0.000080 main (2): --capture-preview 0.000081 main (2): --debug 0.000088 load_settings (2): Creating gphoto config directory ('/Users/marcel/.gphoto') 0.000123 load_settings (2): Loading settings from file '/Users/marcel/.gphoto/settings'. 0.000147 main (2): The user has not specified both a model and a port. Try to figure them out. 0.000151 gp_port_init_localedir (2): localedir has been set to /opt/homebrew/Cellar/libgphoto2/2.5.30_1/share/locale (compile-time default) 0.000154 gp_port_info_list_load (2): Using ltdl to load io-drivers from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1'... 0.000201 foreach_func (2): Called for filename '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/disk'. 0.000533 foreach_func (2): Loaded '' ('^disk:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/disk'. 0.000537 foreach_func (2): Called for filename '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'. 0.000817 foreach_func (2): Loaded 'PTP/IP Connection' ('ptpip:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'. 0.000821 foreach_func (2): Loaded '' ('^ptpip:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'. 0.000823 foreach_func (2): Loaded 'IP Connection' ('ip:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'. 0.000825 foreach_func (2): Loaded '' ('^ip:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'. 0.000826 foreach_func (2): Called for filename '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'. 0.004062 foreach_func (2): Loaded 'Serial Port Device' ('serial:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'. 0.004072 foreach_func (2): Loaded '' ('^serial:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'. 0.004074 foreach_func (2): Called for filename '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'. 0.007614 foreach_func (2): Loaded '' ('^usb:') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'. 0.007626 foreach_func (2): Loaded 'Universal Serial Bus' ('usb:000,005') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'. 0.007628 foreach_func (2): Loaded 'Universal Serial Bus' ('usb:000,004') from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'. 0.007631 gp_port_info_list_count (2): Counting entries (10 available)... 0.007633 gp_port_info_list_count (2): 5 regular entries available. 0.007635 gp_port_init_localedir (2): ignoring late call (localedir value NULL) 0.007638 gp_init_localedir (2): localedir has been set to /opt/homebrew/Cellar/libgphoto2/2.5.30_1/share/locale (compile-time default) 0.007640 gp_abilities_list_load_dir (2): Using ltdl to load camera libraries from '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30'... 0.007697 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ax203'. 0.007701 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/canon'. 0.007703 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/digigr8'. 0.007704 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/dimagev'. 0.007706 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/directory'. 0.007707 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/docupen'. 0.007709 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/jl2005a'. 0.007710 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/jl2005c'. 0.007711 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/kodak_dc240'. 0.007713 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/lumix'. 0.007715 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/mars'. 0.007716 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/pentax'. 0.007717 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ptp2'. 0.007719 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ricoh_g3'. 0.007720 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sierra'. 0.007722 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sonix'. 0.007723 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sq905'. 0.007769 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/st2205'. 0.007771 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/topfield'. 0.007773 foreach_func (2): Found '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/tp6801'. 0.007776 gp_abilities_list_load_dir (2): Found 20 camera drivers. 0.039037 gp_port_info_list_count (2): Counting entries (10 available)...
0.039042 gp_port_info_list_count (2): 5 regular entries available. 0.039043 gp_port_new (2): Creating new device... 0.039047 gp_port_info_list_get_info (2): Getting info of entry 0 (10 available)... 0.039276 gp_port_set_settings (2): Setting settings... 0.039282 gp_port_info_list_get_info (2): Getting info of entry 1 (10 available)... 0.039515 gp_port_set_settings (2): Setting settings... 0.039519 gp_port_info_list_get_info (2): Getting info of entry 2 (10 available)... 0.039855 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. 0.039858 gp_port_set_settings (2): Setting settings... 0.039860 gp_port_info_list_get_info (2): Getting info of entry 3 (10 available)... 0.041453 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds. 0.041458 gp_port_set_settings (2): Setting settings... 0.041460 gp_libusb1_update (2): (old int=0, conf=-1, alt=-1) port usb:000,005, (new int=0, conf=-1, alt=-1) port usb:000,005 0.041462 gp_libusb1_update (2): lowlevel libusb1 port not yet opened, no need for libusb changes 0.041463 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras... 0.041526 gp_libusb1_find_device_lib (2): Looking for USB device (vendor 0x4a9, product 0x31ea)... found. 0.041536 gp_libusb1_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01 0.041538 gp_abilities_list_detect_usb(2): Found 'Canon EOS 550D' (0x4a9,0x31ea) 0.041540 gp_port_info_list_get_info (2): Getting info of entry 4 (10 available)... 0.043053 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds. 0.043057 gp_port_set_settings (2): Setting settings... 0.043059 gp_libusb1_update (2): (old int=0, conf=-1, alt=-1) port usb:000,004, (new int=0, conf=-1, alt=-1) port usb:000,004 0.043060 gp_libusb1_update (2): lowlevel libusb1 port not yet opened, no need for libusb changes 0.043062 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras... 0.043225 gp_libusb1_find_device_by_class_lib(2): Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)... 0.043373 gp_libusb1_find_device_by_class_lib(2): Looking for USB device (class 0x6, subclass, 0x1, protocol 0x1)... 0.043390 gp_port_free (2): Freeing port... 0.043391 gp_port_close (2): Closing port... 0.043718 gp_camera_set_abilities (2): Setting abilities ('Canon EOS 550D')... 0.043728 gp_setting_set (2): Setting key 'model' to value 'Canon EOS 550D' (gphoto2) 0.043730 save_settings (2): Saving 2 setting(s) to file "/Users/marcel/.gphoto/settings" 0.043952 gp_port_info_list_lookup_path(2): Looking for path 'usb:000,005' (10 entries available)... 0.043959 gp_port_info_list_get_info (2): Getting info of entry 3 (10 available)... 0.043961 gp_camera_set_port_info (2): Setting port info for port 'Universal Serial Bus' at 'usb:000,005'... 0.045174 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds. 0.045177 gp_port_set_settings (2): Setting settings... 0.045179 gp_libusb1_update (2): (old int=0, conf=-1, alt=-1) port usb:000,005, (new int=0, conf=-1, alt=-1) port usb:000,005 0.045180 gp_libusb1_update (2): lowlevel libusb1 port not yet opened, no need for libusb changes 0.045182 gp_setting_set (2): Setting key 'port' to value 'usb:000,005' (gphoto2) 0.045184 save_settings (2): Saving 2 setting(s) to file "/Users/marcel/.gphoto/settings" 0.045748 gp_camera_init (2): Initializing camera... 0.045766 gp_libusb1_find_device_lib (2): Looking for USB device (vendor 0x4a9, product 0x31ea)... found. 0.045770 gp_libusb1_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01 0.045772 gp_camera_init (2): Loading '/opt/homebrew/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ptp2'... 0.046270 gp_port_open (2): Opening USB port... 0.046277 gp_libusb1_open (2): () 0.046339 gp_libusb1_open (2): Device has a kernel driver attached (1), detaching it now. 0.046360 gp_port_set_error gphoto2-port.c:1177: Could not detach kernel driver of camera device. 0.046362 gp_libusb1_open (2): claiming interface 0 0.046512 gp_libusb1_open libusb1.c:415: 'libusb_claim_interface (port->pl->dh, port->settings.usb.interface)' failed: Access denied (insufficient permissions) (-3) 0.046518 gp_port_set_error gphoto2-port.c:1177: Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. 0.046580 gp_context_error (0): An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error (-53: 'Could not claim the USB device') ***

0.046746 gp_camera_free (2): Freeing camera... 0.046750 gp_port_free (2): Freeing port... 0.046751 gp_port_close (2): Closing port... 0.047911 gp_port_set_error gphoto2-port.c:1177: Could not release interface 0 (No such file or directory). 0.048146 gp_filesystem_reset (2): resetting filesystem 0.048150 gp_filesystem_lru_clear (2): Clearing fscache LRU list... 0.048151 gp_filesystem_lru_clear (2): fscache LRU list already empty 0.048153 delete_all_folders (2): Internally deleting all folders from '/'... 0.048155 lookup_folder (2): Lookup folder '/'... 0.048157 lookup_folder (2): Found! / is 0x600001cc8d80 0.048159 recurse_delete_folder (2): Recurse delete folder 0x600001cc8d80// 0.048160 delete_all_files (2): Delete all files in folder 0x600001cc8d80//

marcelmatula avatar Jan 18 '23 15:01 marcelmatula