-
Notifications
You must be signed in to change notification settings - Fork 116
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
Comments
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 libgphoto2 and gphoto2 version
|
I'm having the exact same issue - also impacts on kstars (uses gphoto in the background) |
Ditto here. Updated to OSX ventura triggered this. I cant seem to figure out what. Any clues? gphoto2 --list-files --debug *** Error *** 0.185593 gp_camera_free (2): Freeing camera... |
Grasping... |
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. Unfortunately, I have not yet figured out how to assign higher privileges to a single program. |
Btw: my EOS Utility doesn't work either. How's it with yours? |
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. |
ptpcamerad did that here, too. I used the mac os activity monitor to permanently end it and then it stays that way |
It is no longer possible to keep Passing thru the USB to a VM avoids this, but is annoying. Any ideas? Any diagnostics I can provide? |
Hi, same problem here. |
I'm not sure what changed but I repeatedly spammed |
@nicolashahn nope! |
Same problem here, any clues anyone? |
apparently killing ptpcamerad repeatedly helped? |
Hi all, |
Hi, -Save this as a .plist file in /Library/LaunchDaemons/ (open -a Finder /Library/LaunchDaemons/)
Be sure to replace /usr/bin/ptpcamerad with your actual path of ptpcamerad (ps aux | grep ptpcamerad retrieves it)
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. |
Excellent find. Thanks. Your soln works for me too. (running OSX 13.4.1). |
Thank you jardof, your solution works completely fine for me. I am running macOS 13.1. |
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. |
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 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! |
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. |
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//
The text was updated successfully, but these errors were encountered: