Hello,
I am using uvc-gadget to build a RPi Zero 2 based webcam and I am trying to incorporate a status LED.
I am wondering if it is possible to add a callback function for the UVC_EVENT_STREAMON and UVC_EVENT_STREAMOFF UVC events.
This would be similar to the LED indicator in showmewebcam.
I have made a preliminary attempt at modifying main.c buy linking the pigpio library (pigpio.h) and sending a GPIO write high command after the stream = uvc_stream_new(fc->video); here call. The result is as expected, the pin goes to high so long as the program is running, independent of whether or not the camera is active.
It is unclear on whether uvc-gadget can report back on the status/event related to the camera being active.
Looking at ring buffer messages using dmesg | grep uvc I've identified uvc_function_set_alt(1, 0) and uvc_function_set_alt(1, 1) as messages relating to the camera being inactive/active. I haven't yet identified how uvc-gadget could throw an interrupt so I could then send the correct GPIO signal.
Looking to get advice and be guided in the right direction. I wouldn't mind incorporating the changes myself.
Currently the only solution would be polling, but I would like to avoid this.
Hello,
I am using uvc-gadget to build a RPi Zero 2 based webcam and I am trying to incorporate a status LED.
I am wondering if it is possible to add a callback function for the
UVC_EVENT_STREAMONandUVC_EVENT_STREAMOFFUVC events.This would be similar to the LED indicator in showmewebcam.
I have made a preliminary attempt at modifying
main.cbuy linking the pigpio library (pigpio.h) and sending a GPIO write high command after thestream = uvc_stream_new(fc->video);here call. The result is as expected, the pin goes to high so long as the program is running, independent of whether or not the camera is active.It is unclear on whether uvc-gadget can report back on the status/event related to the camera being active.
Looking at ring buffer messages using
dmesg | grep uvcI've identifieduvc_function_set_alt(1, 0)anduvc_function_set_alt(1, 1)as messages relating to the camera being inactive/active. I haven't yet identified how uvc-gadget could throw an interrupt so I could then send the correct GPIO signal.Looking to get advice and be guided in the right direction. I wouldn't mind incorporating the changes myself.
Currently the only solution would be polling, but I would like to avoid this.