Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOs Gphoto2 running only under sudo #562

Open
marcelmatula opened this issue Jan 18, 2023 · 23 comments
Open

MacOs Gphoto2 running only under sudo #562

marcelmatula opened this issue Jan 18, 2023 · 23 comments

Comments

@marcelmatula
Copy link

marcelmatula commented Jan 18, 2023

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//

@rubenbroman
Copy link

rubenbroman commented Jan 19, 2023

Same problem here, happened after upgrading to MacOS Ventura so might be some permission change or anything like PTPCam stealing the camera?

Name the camera
Canon EOS 2000D (reported as Canon EOS 1500D by gphoto)

libgphoto2 and gphoto2 version
gphoto2 2.5.28
libgphoto2 2.5.30

gphoto2 --capture-preview --debug
0.000061 main                        (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.000072 main                        (2): gphoto2 2.5.28
0.000080 main                        (2): gphoto2 has been compiled with the following options:
0.000083 main                        (2):  + clang (C compiler used)
0.000085 main                        (2):  + popt (mandatory, for handling command-line parameters)
0.000087 main                        (2):  + exif (for displaying EXIF information)
0.000089 main                        (2):  + no cdk (for accessing configuration options)
0.000090 main                        (2):  + no aa (for displaying live previews)
0.000092 main                        (2):  + jpeg (for displaying live previews in JPEG format)
0.000093 main                        (2):  + readline (for easy navigation in the shell)
0.000099 main                        (2): libgphoto2 2.5.30
0.000102 main                        (2): libgphoto2 has been compiled with the following options:
0.000104 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.000106 main                        (2):  + clang (C compiler used)
0.000108 main                        (2):  + no ltdl (for portable loading of camlibs)
0.000110 main                        (2):  + EXIF (for special handling of EXIF files)
0.000112 main                        (2): libgphoto2_port 0.12.1
0.000114 main                        (2): libgphoto2_port has been compiled with the following options:
0.000117 main                        (2):  + iolibs: disk ptpip serial usb1
0.000119 main                        (2):  + clang (C compiler used)
0.000121 main                        (2):  + no ltdl (for portable loading of iolibs)
0.000122 main                        (2):  + EXIF (for vusb)
0.000124 main                        (2):  + USB (libusb1, for USB cameras)
0.000126 main                        (2):  + serial (for serial cameras)
0.000127 main                        (2):  + no resmgr (serial port access and locking)
0.000129 main                        (2):  + no ttylock (serial port locking)
0.000131 main                        (2):  + no lockdev (serial port locking)
0.000133 main                        (2): CAMLIBS env var not set, using compile-time default instead
0.000134 main                        (2): IOLIBS env var not set, using compile-time default instead
0.000136 main                        (2): invoked with following arguments:
0.000138 main                        (2):   --capture-preview
0.000140 main                        (2):   --debug
0.000149 load_settings               (2): Creating gphoto config directory ('/Users/XXXX/.gphoto')
0.000186 load_settings               (2): Loading settings from file '/Users/XXXX/.gphoto/settings'.
0.000219 main                        (2): The user has not specified both a model and a port. Try to figure them out.
0.000227 gp_port_init_localedir      (2): localedir has been set to /usr/local/Cellar/libgphoto2/2.5.30_1/share/locale (compile-time default)
0.000230 gp_port_info_list_load      (2): Using ltdl to load io-drivers from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1'...
0.000293 foreach_func                (2): Called for filename '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/disk'.
0.000704 foreach_func                (2): Loaded '' ('^disk:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/disk'.
0.000711 foreach_func                (2): Called for filename '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'.
0.001089 foreach_func                (2): Loaded 'PTP/IP Connection' ('ptpip:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'.
0.001096 foreach_func                (2): Loaded '' ('^ptpip:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'.
0.001099 foreach_func                (2): Loaded 'IP Connection' ('ip:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'.
0.001101 foreach_func                (2): Loaded '' ('^ip:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/ptpip'.
0.001104 foreach_func                (2): Called for filename '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'.
0.003972 foreach_func                (2): Loaded 'Serial Port Device' ('serial:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'.
0.003979 foreach_func                (2): Loaded '' ('^serial:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/serial'.
0.003981 foreach_func                (2): Called for filename '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'.
0.010623 foreach_func                (2): Loaded '' ('^usb:') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'.
0.010637 foreach_func                (2): Loaded 'Universal Serial Bus' ('usb:020,010') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'.
0.010640 foreach_func                (2): Loaded 'Universal Serial Bus' ('usb:020,009') from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2_port/0.12.1/usb1'.
0.010647 gp_port_info_list_count     (2): Counting entries (10 available)...
0.010649 gp_port_info_list_count     (2): 5 regular entries available.
0.010659 gp_port_init_localedir      (2): ignoring late call (localedir value NULL)
0.010662 gp_init_localedir           (2): localedir has been set to /usr/local/Cellar/libgphoto2/2.5.30_1/share/locale (compile-time default)
0.010668 gp_abilities_list_load_dir  (2): Using ltdl to load camera libraries from '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30'...
0.010769 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ax203'.
0.010774 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/canon'.
0.010776 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/digigr8'.
0.010779 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/dimagev'.
0.010781 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/directory'.
0.010782 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/docupen'.
0.010784 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/jl2005a'.
0.010786 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/jl2005c'.
0.010788 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/kodak_dc240'.
0.010790 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/lumix'.
0.010792 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/mars'.
0.010794 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/pentax'.
0.010796 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ptp2'.
0.010797 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ricoh_g3'.
0.010835 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sierra'.
0.010840 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sonix'.
0.010842 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/sq905'.
0.010844 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/st2205'.
0.010846 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/topfield'.
0.010848 foreach_func                (2): Found '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/tp6801'.
0.010853 gp_abilities_list_load_dir  (2): Found 20 camera drivers.
0.064282 gp_port_info_list_count     (2): Counting entries (10 available)...   
0.064294 gp_port_info_list_count     (2): 5 regular entries available.
0.064296 gp_port_new                 (2): Creating new device...
0.064300 gp_port_info_list_get_info  (2): Getting info of entry 0 (10 available)...
0.064691 gp_port_set_settings        (2): Setting settings...
0.064698 gp_port_info_list_get_info  (2): Getting info of entry 1 (10 available)...
0.065069 gp_port_set_settings        (2): Setting settings...
0.065076 gp_port_info_list_get_info  (2): Getting info of entry 2 (10 available)...
0.065564 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.065570 gp_port_set_settings        (2): Setting settings...
0.065573 gp_port_info_list_get_info  (2): Getting info of entry 3 (10 available)...
0.069519 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.069526 gp_port_set_settings        (2): Setting settings...
0.069534 gp_libusb1_update           (2): (old int=0, conf=-1, alt=-1) port usb:020,010, (new int=0, conf=-1, alt=-1) port usb:020,010
0.069537 gp_libusb1_update           (2): lowlevel libusb1 port not yet opened, no need for libusb changes
0.069542 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.069737 gp_libusb1_find_device_lib  (2): Looking for USB device (vendor 0x4a9, product 0x32e1)... found.
0.069748 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.069751 gp_abilities_list_detect_usb(2): Found 'Canon EOS 1500D' (0x4a9,0x32e1)
0.069754 gp_port_info_list_get_info  (2): Getting info of entry 4 (10 available)...
0.073908 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.073916 gp_port_set_settings        (2): Setting settings...
0.073924 gp_libusb1_update           (2): (old int=0, conf=-1, alt=-1) port usb:020,009, (new int=0, conf=-1, alt=-1) port usb:020,009
0.073927 gp_libusb1_update           (2): lowlevel libusb1 port not yet opened, no need for libusb changes
0.073929 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.074666 gp_libusb1_find_device_by_class_lib(2): Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)...
0.075233 gp_libusb1_find_device_by_class_lib(2): Looking for USB device (class 0x6, subclass, 0x1, protocol 0x1)...
0.075273 gp_port_free                (2): Freeing port...
0.075275 gp_port_close               (2): Closing port...
0.075730 gp_camera_set_abilities     (2): Setting abilities ('Canon EOS 1500D')...
0.075738 gp_setting_set              (2): Setting key 'model' to value 'Canon EOS 1500D' (gphoto2)
0.075742 save_settings               (2): Saving 3 setting(s) to file "/Users/XXXX/.gphoto/settings"
0.075980 gp_port_info_list_lookup_path(2): Looking for path 'usb:020,010' (10 entries available)...
0.075986 gp_port_info_list_get_info  (2): Getting info of entry 3 (10 available)...
0.075989 gp_camera_set_port_info     (2): Setting port info for port 'Universal Serial Bus' at 'usb:020,010'...
0.080311 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.080322 gp_port_set_settings        (2): Setting settings...
0.080332 gp_libusb1_update           (2): (old int=0, conf=-1, alt=-1) port usb:020,010, (new int=0, conf=-1, alt=-1) port usb:020,010
0.080335 gp_libusb1_update           (2): lowlevel libusb1 port not yet opened, no need for libusb changes
0.080339 gp_setting_set              (2): Setting key 'port' to value 'usb:020,010' (gphoto2)
0.080342 save_settings               (2): Saving 3 setting(s) to file "/Users/XXXX/.gphoto/settings"
0.080676 gp_camera_init              (2): Initializing camera...
0.080705 gp_libusb1_find_device_lib  (2): Looking for USB device (vendor 0x4a9, product 0x32e1)... found.
0.080715 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.080718 gp_camera_init              (2): Loading '/usr/local/Cellar/libgphoto2/2.5.30_1/lib/libgphoto2/2.5.30/ptp2'...
0.081616 gp_port_open                (2): Opening USB port...
0.081623 gp_libusb1_open             (2): ()
0.081759 gp_libusb1_open             (2): Device has a kernel driver attached (1), detaching it now.
0.081793 gp_port_set_error [gphoto2-port.c:1177](0): Could not detach kernel driver of camera device.
0.081797 gp_libusb1_open             (2): claiming interface 0
0.082255 gp_libusb1_open [libusb1.c:415](0): 'libusb_claim_interface (port->pl->dh, port->settings.usb.interface)' failed: Access denied (insufficient permissions) (-3)
0.082267 gp_port_set_error [gphoto2-port.c:1177](0): Could not claim interface 0 (Invalid argument). 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.082422 gp_context_error            (0): An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Invalid argument). 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 (Invalid argument). 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.082861 gp_camera_free              (2): Freeing camera...
0.082865 gp_port_free                (2): Freeing port...
0.082867 gp_port_close               (2): Closing port...
0.084034 gp_port_set_error [gphoto2-port.c:1177](0): Could not release interface 0 (Invalid argument).
0.084461 gp_filesystem_reset         (2): resetting filesystem
0.084471 gp_filesystem_lru_clear     (2): Clearing fscache LRU list...
0.084474 gp_filesystem_lru_clear     (2): fscache LRU list already empty
0.084476 delete_all_folders          (2): Internally deleting all folders from '/'...
0.084479 lookup_folder               (2): Lookup folder '/'...
0.084481 lookup_folder               (2): Found! / is 0x6000005a0780
0.084485 recurse_delete_folder       (2): Recurse delete folder 0x6000005a0780//
0.084487 delete_all_files            (2): Delete all files in folder 0x6000005a0780//

@dantchapman
Copy link

I'm having the exact same issue - also impacts on kstars (uses gphoto in the background)

@arkellr
Copy link

arkellr commented Feb 14, 2023

Ditto here. Updated to OSX ventura triggered this. I cant seem to figure out what.
Running as sudo works though as mentioned.
(with current master).

Any clues?

gphoto2 --list-files --debug
0.000022 main (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.000033 main (2): gphoto2 2.5.28.1
0.000036 main (2): gphoto2 has been compiled with the following options:
0.000038 main (2): + gcc (C compiler used)
0.000041 main (2): + popt (mandatory, for handling command-line parameters)
0.000043 main (2): + exif (for displaying EXIF information)
0.000044 main (2): + no cdk (for accessing configuration options)
0.000046 main (2): + aa (for displaying live previews)
0.000047 main (2): + jpeg (for displaying live previews in JPEG format)
0.000048 main (2): + no readline (for easy navigation in the shell)
0.000053 main (2): libgphoto2 2.5.30
0.000055 main (2): libgphoto2 has been compiled with the following options:
0.000058 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.000060 main (2): + gcc (C compiler used)
0.000061 main (2): + no ltdl (for portable loading of camlibs)
0.000063 main (2): + EXIF (for special handling of EXIF files)
0.000066 main (2): libgphoto2_port 0.12.1
0.000068 main (2): libgphoto2_port has been compiled with the following options:
0.000070 main (2): + iolibs: disk ptpip serial usb1
0.000071 main (2): + gcc (C compiler used)
0.000073 main (2): + no ltdl (for portable loading of iolibs)
0.000074 main (2): + EXIF (for vusb)
0.000076 main (2): + USB (libusb1, for USB cameras)
0.000077 main (2): + serial (for serial cameras)
0.000078 main (2): + no resmgr (serial port access and locking)
0.000080 main (2): + no ttylock (serial port locking)
0.000081 main (2): + no lockdev (serial port locking)
0.000083 main (2): CAMLIBS env var not set, using compile-time default instead
0.000085 main (2): IOLIBS env var not set, using compile-time default instead
0.000087 main (2): invoked with following arguments:
0.000088 main (2): --list-files
0.000090 main (2): --debug
0.000097 load_settings (2): Creating gphoto config directory ('/Users/arkell/.gphoto')
0.000356 load_settings (2): Loading settings from file '/Users/arkell/.gphoto/settings'.
0.000431 main (2): The user has not specified both a model and a port. Try to figure them out.
0.000446 gp_port_init_localedir (2): localedir has been set to /Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/share/locale (compile-time default)
0.000449 gp_port_info_list_load (2): Using ltdl to load io-drivers from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1'...
0.000562 foreach_func (2): Called for filename '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/disk'.
0.002073 foreach_func (2): Loaded '' ('^disk:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/disk'.
0.002081 foreach_func (2): Called for filename '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/ptpip'.
0.003739 foreach_func (2): Loaded 'PTP/IP Connection' ('ptpip:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/ptpip'.
0.003749 foreach_func (2): Loaded '' ('^ptpip:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/ptpip'.
0.003752 foreach_func (2): Loaded 'IP Connection' ('ip:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/ptpip'.
0.003754 foreach_func (2): Loaded '' ('^ip:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/ptpip'.
0.003757 foreach_func (2): Called for filename '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/serial'.
0.007289 foreach_func (2): Loaded 'Serial Port Device' ('serial:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/serial'.
0.007296 foreach_func (2): Loaded '' ('^serial:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/serial'.
0.007298 foreach_func (2): Called for filename '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/usb1'.
0.031687 foreach_func (2): Loaded '' ('^usb:') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/usb1'.
0.031703 foreach_func (2): Loaded 'Universal Serial Bus' ('usb:000,014') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/usb1'.
0.031708 foreach_func (2): Loaded 'Universal Serial Bus' ('usb:020,001') from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2_port/0.12.1/usb1'.
0.031717 gp_port_info_list_count (2): Counting entries (10 available)...
0.031722 gp_port_info_list_count (2): 5 regular entries available.
0.031734 gp_port_init_localedir (2): ignoring late call (localedir value NULL)
0.031740 gp_init_localedir (2): localedir has been set to /Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/share/locale (compile-time default)
0.031754 gp_abilities_list_load_dir (2): Using ltdl to load camera libraries from '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30'...
0.032099 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/ax203'.
0.032110 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/canon'.
0.032114 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/digigr8'.
0.032118 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/dimagev'.
0.032122 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/directory'.
0.032125 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/docupen'.
0.032129 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/jl2005a'.
0.032183 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/jl2005c'.
0.032195 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/kodak_dc240'.
0.032200 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/lumix'.
0.032204 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/mars'.
0.032208 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/pentax'.
0.032211 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/ptp2'.
0.032216 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/ricoh_g3'.
0.032221 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/sierra'.
0.032224 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/sonix'.
0.032228 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/sq905'.
0.032231 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/st2205'.
0.032235 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/topfield'.
0.032239 foreach_func (2): Found '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/tp6801'.
0.032248 gp_abilities_list_load_dir (2): Found 20 camera drivers.
0.121985 gp_port_info_list_count (2): Counting entries (10 available)...
0.121991 gp_port_info_list_count (2): 5 regular entries available.
0.121992 gp_port_new (2): Creating new device...
0.121996 gp_port_info_list_get_info (2): Getting info of entry 0 (10 available)...
0.123404 gp_port_set_settings (2): Setting settings...
0.123411 gp_port_info_list_get_info (2): Getting info of entry 1 (10 available)...
0.124894 gp_port_set_settings (2): Setting settings...
0.124901 gp_port_info_list_get_info (2): Getting info of entry 2 (10 available)...
0.126395 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds.
0.126401 gp_port_set_settings (2): Setting settings...
0.126404 gp_port_info_list_get_info (2): Getting info of entry 3 (10 available)...
0.138206 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds.
0.138213 gp_port_set_settings (2): Setting settings...
0.138221 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.138446 gp_abilities_list_detect_usb(2): Found 'Canon EOS R5' (0x4a9,0x32f4)
0.138452 gp_port_info_list_get_info (2): Getting info of entry 4 (10 available)...
0.158733 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds.
0.158743 gp_port_set_settings (2): Setting settings...
0.158753 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.160308 gp_port_free (2): Freeing port...
0.160314 gp_port_close (2): Closing port...
0.165323 gp_camera_set_abilities (2): Setting abilities ('Canon EOS R5')...
0.165340 gp_setting_set (2): Setting key 'model' to value 'Canon EOS R5' (gphoto2)
0.165347 save_settings (2): Saving 4 setting(s) to file "/Users/arkell/.gphoto/settings"
0.166585 gp_port_info_list_lookup_path(2): Looking for path 'usb:000,014' (10 entries available)...
0.166604 gp_port_info_list_get_info (2): Getting info of entry 3 (10 available)...
0.166611 gp_camera_set_port_info (2): Setting port info for port 'Universal Serial Bus' at 'usb:000,014'...
0.181217 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds.
0.181226 gp_port_set_settings (2): Setting settings...
0.181235 gp_setting_set (2): Setting key 'port' to value 'usb:000,014' (gphoto2)
0.181238 save_settings (2): Saving 4 setting(s) to file "/Users/arkell/.gphoto/settings"
0.181839 foreach (2): Executing action 'List Files' for folder '/'.
0.181850 gp_camera_folder_list_files (2): Listing files in '/'...
0.181853 gp_camera_init (2): Initializing camera...
0.181888 gp_camera_init (2): Loading '/Users/arkell/git/arasiah_src/prebuilt/DARWIN-X86-64/gphoto2/2.5.30.1/lib/libgphoto2/2.5.30/ptp2'...
0.184183 gp_port_open (2): Opening USB port...
0.185073 gp_context_error (0): An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Invalid argument). 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 (Invalid argument). 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.185593 gp_camera_free (2): Freeing camera...
0.185598 gp_port_free (2): Freeing port...
0.185600 gp_port_close (2): Closing port...
0.190710 gp_filesystem_reset (2): resetting filesystem
0.190727 gp_filesystem_lru_clear (2): Clearing fscache LRU list...
0.190730 gp_filesystem_lru_clear (2): fscache LRU list already empty
0.190733 delete_all_folders (2): Internally deleting all folders from '/'...
0.190735 lookup_folder (2): Lookup folder '/'...
0.190738 lookup_folder (2): Found! / is 0x600001244ba0
0.190741 recurse_delete_folder (2): Recurse delete folder 0x600001244ba0//
0.190743 delete_all_files (2): Delete all files in folder 0x600001244ba0//

@arkellr
Copy link

arkellr commented Feb 14, 2023

Grasping...
Not sure if this might be the reason but I see a launchAgent daemon ie /usr/libexec/ptpcamerad running. Cant recall if this was there prior to Ventura.
/System/Library/LaunchAgents/com.apple.ptpcamerad.plist
Not sure Im willing to edit this plist to disable... yet.

@kettenbach-it
Copy link

kettenbach-it commented Feb 27, 2023

I don't think it has to do with ptpcamerad. I killed it and still access from a non-root account is not possible.

I think that this is due to the further tightened security settings under the current mac os.
https://support.novationmusic.com/hc/en-gb/articles/8380114076434--How-to-Disable-USB-Restricted-Mode-on-macOS-Ventura

Unfortunately, I have not yet figured out how to assign higher privileges to a single program.

@kettenbach-it
Copy link

Btw: my EOS Utility doesn't work either. How's it with yours?

@arkellr
Copy link

arkellr commented Feb 28, 2023

I hvnt tried using EOS utility yet (dont really use it so what version I hv is pretty dated). BTW I tried to kill -9 ptpcamerad but it would always restart instantly... so I couldnt really test if the problem remained without a running ptpcamerad.

@kettenbach-it
Copy link

ptpcamerad did that here, too.

I used the mac os activity monitor to permanently end it and then it stays that way

@adamhill
Copy link

It is no longer possible to keep ptpcamerad killed from Activity Monitor or using the enable.sh and disable.sh scripts (the database is gone / moved) in Ventura. Simple querying works, but no image capture is possible even with --wait-event=Xs

Passing thru the USB to a VM avoids this, but is annoying.

Any ideas? Any diagnostics I can provide?

@thewoz
Copy link

thewoz commented May 15, 2023

Hi, same problem here.
any news?

@nicolashahn
Copy link

Seeing the same problem. @adamhill @thewoz did you ever solve it?

@nicolashahn
Copy link

I'm not sure what changed but I repeatedly spammed kill -9 ptpcamerad until the command wasn't succeeding anymore, unplugged and replugged in the camera, and then it worked.

@thewoz
Copy link

thewoz commented May 30, 2023

Seeing the same problem. @adamhill @thewoz did you ever solve it?

@nicolashahn nope!

@jimmybutton
Copy link

Same problem here, any clues anyone?

@msmeissn
Copy link
Contributor

apparently killing ptpcamerad repeatedly helped?

@jardof
Copy link

jardof commented Jun 29, 2023

Hi all,
I'm facing same issue as you. And I have found workaround that work for me, hopefully It will help you as well.
Idea is to connect to camera via gphoto2 before ptpcamera. So in my case I will find pid of ptcamerad by
ps aux | grep ptpcamerad
and then in one line command run
kill -9 [pid_of_process]; gphoto2 --capture-preview;
Then I am able to access camera either via command line or from Python code I'm developing.
This will remains until you disconnect camera either from USB or turn It off and back On.
Hope It helps and hopefully there will be some permanent fix soon.

@ghost
Copy link

ghost commented Jul 7, 2023

Hi,
Im not familiar with the ptpcamerad process and stuff so the following solution might need a clear review before use.

-Save this as a .plist file in /Library/LaunchDaemons/ (open -a Finder /Library/LaunchDaemons/)


<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>Label</key>
     <string>com.example.ptpcamerad</string>
     <key>Program</key>
     <string>/usr/bin/ptpcamerad</string> 
     <key>RunAtLoad</key>
     <true/>
     <key>KeepAlive</key>
     <false/>
</dict>
 </plist>

Be sure to replace /usr/bin/ptpcamerad with your actual path of ptpcamerad (ps aux | grep ptpcamerad retrieves it)

  • In terminal
    sudo chown root:wheel /Library/LaunchDaemons/com.example.ptpcamerad.plist
    sudo chmod 644 /Library/LaunchDaemons/com.example.ptpcamerad.plist
    To set permissions

  • In terminal
    sudo launchctl load /Library/LaunchDaemons/com.example.ptpcamerad.plist

So basically what it does it sets the property KeepAlive of ptpcamera to False which prevents the process to respawn when killed. You can know kill it once (still spawns once when your computer boots) and you should be fine.

Again, i'm not familiar with this stuff. I found this solution thanks to chatgpt and it works for me. So if you find any issues or reason not to do it please let us know.

@arkellr
Copy link

arkellr commented Jul 17, 2023

Excellent find. Thanks.

Your soln works for me too. (running OSX 13.4.1).

@Yizhou-Li-CV
Copy link

Yizhou-Li-CV commented Jul 21, 2023

Thank you jardof, your solution works completely fine for me. I am running macOS 13.1.

@henrybetts
Copy link

Unfortunately it looks like Apple is pushing developers to use their Camera Extensions. I'm not sure how feasible it is for gphoto to implement this?

Fortunately, Apple have provided a workaround to "Restore legacy video device support", but I can imagine they may remove this ability at some point in the future.

It looks like this has affected quite a few apps/manufacturers, so not just gphoto.

@tide1109
Copy link

I found out, that the app Preview is at least one issue for gphoto.

When Preview is opened in the background (icon in dock), gphoto fails claim my Canon EOS M50 camera. The camera also shows the icon for remote access on the display.
If Preview is opened and I use gphoto2 with root access (sudo), it works fine.

If Preview is fully closed (use cmd + Q), gphoto can use the camera without root access. The camera screen also shows the preview again, because the remote access ended.

I used gphoto2 2.5.28 and libgphoto2 2.5.31 with MacOS 14.5.

@aldofebriii
Copy link

I found out, that the app Preview is at least one issue for gphoto.

When Preview is opened in the background (icon in dock), gphoto fails claim my Canon EOS M50 camera. The camera also shows the icon for remote access on the display. If Preview is opened and I use gphoto2 with root access (sudo), it works fine.

If Preview is fully closed (use cmd + Q), gphoto can use the camera without root access. The camera screen also shows the preview again, because the remote access ended.

I used gphoto2 2.5.28 and libgphoto2 2.5.31 with MacOS 14.5.

I use this solution and it works like magic!
Thank you

@ndim
Copy link
Member

ndim commented Sep 29, 2024

There might be a Macos API/protocol arbitrating between different apps wanting access to the same camera device.

A bit like Pulseaudio and Jack used to do with sound devices on Linux before pipewire.

We just do not have anybody doing actual Macos development, much less someone who is familiar with this specific area of Macos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests