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

set_to_(minimum|maximum) and (in|de)crease might fail for ControlType.MENU #12

Closed
otaku42 opened this issue Mar 15, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@otaku42
Copy link
Owner

otaku42 commented Mar 15, 2023

0x009a0901: <Control auto_exposure type=menu min=0 max=3 step=1 default=3 value=3> <--
 - <MenuItem index=1 name=Manual Mode>
 - <MenuItem index=3 name=Aperture Priority Mode>

Trying to set auto_exposure on this camera to 0 (which according to the driver should be acceptable, see min=0) results in an error, since no menu item with index 0 is defined. Calling decrease() would fail for the same reason: there is no menu item with index 2.

One possible solution would be to not rely on the minimum and maximum values announced by the driver when dealing with menu controls, but rather determine the lowest/highest index of all items that are defined for that menu control; similar for increasing/decreasing the control.

But.. what about other control types, such as string or boolean? While a boolean may be considered having a minimum of 0 (False) and a maximum of 1 (True), and trying to increase/decrease it may be ignored, how would that apply to a string? It appears now that introducing these helpers in c352385 as currently implemented was not well thought, since they each make sense only for certain control types, but not for others. Hmm.

@otaku42 otaku42 added the bug Something isn't working label Mar 15, 2023
@otaku42 otaku42 self-assigned this Mar 15, 2023
@otaku42
Copy link
Owner Author

otaku42 commented Mar 22, 2023

Note to self; take v4l2_ctrl_type documentation into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant