libuvc / libuvc

a cross-platform library for USB video devices
https://libuvc.github.io/
Other
995 stars 512 forks source link

Take picture button on UVC camera #230

Open meeeee12 opened 2 years ago

meeeee12 commented 2 years ago

I am using a usb video camera with a button and I would like to take a picture when the user clicks the button. I have asked the camera manufacture about it and they said it is part of the UVC protocol. The button works out of the box using AMCap software, but I can't find much information online about it. Is it possible to detect the button click using libuvc?

FrostKiwi commented 1 year ago

@meeeee12

they said it is part of the UVC protocol.

Piqued my interest. Checked the spec for both v1.5: https://www.usb.org/sites/default/files/USB_Video_Class_1_5.zip and v1.1: https://usb.org/sites/default/files/USB_Video_Class_1_1_090711.zip.

Indeed there is, page 14 for v1.1 and page 15 for v1.5.

Doing a quick grep through libuvc gives back the following: https://github.com/libuvc/libuvc/blob/master/include/libuvc/libuvc.h#L581 uvc_set_button_callback()

According to https://github.com/libuvc/libuvc/blob/master/include/libuvc/libuvc_internal.h#L286 /** Function to call when we receive button events from the camera */

Also documented via doxygen under Modules -> Device handling and enumeration. image