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

Add event callback for status LED (RPi GPIO) #4

Open
TankyFranky opened this issue Oct 15, 2024 · 0 comments
Open

Add event callback for status LED (RPi GPIO) #4

TankyFranky opened this issue Oct 15, 2024 · 0 comments

Comments

@TankyFranky
Copy link

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.

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

1 participant