thebino / libgphoto2android

📸 Android Wrapper around libgphoto2 to connect and remote control digital cameras via usb.
27 stars 8 forks source link

Android USB Permissions and libgphoto2 #7

Closed artyom-beilis closed 1 year ago

artyom-beilis commented 1 year ago

Latest android (>=10) requires getting permissions to access USB device.

for libuvc for example I can access USB device, get file descriptor and pass it to libuvc on Android.

How is it managed here?

laheller commented 1 year ago

@artyom-beilis This permission request is there since the beginning of Android API USB support (Android 3). But this is also the same/similar in any Linux OS.

Passing the USB device file descriptor got from Android API to the libgphoto2 is not supported (yet), as far as I know.

The only working way is to build both gphoto2 client and libgphoto2 library (plus all the dependencies) using Android NDK and from your application call the gphoto2 client with the necessary parameters as root!

Without root you can only access WiFi cameras, the USB ones won't work.

artyom-beilis commented 1 year ago

Actually I managed to port it to Android: https://github.com/artyom-beilis/libgphoto2_android_support