-
Notifications
You must be signed in to change notification settings - Fork 27
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
Several settings could not be updated #8
Comments
Similar story here thanks for this CLI and also here first time Objective-C ... but luckily with success! We had the same issue with Fix / hackThis is a patch you can apply with We now added a different data type to handle the bitmap scheme (ignoring the stepsize which makes no sense for a mask) Disclaimerno warranty it works for everything, we tested esp. with the exposure mode. Also we changed the output of the Examplesread the exposure mode
set the exposure mode to manual (manual=
|
@constant-flow please go ahead and submit a pull request, I'd be happy to look over the changes (adding 8-bit bitmap type) and integrate them into the repository. |
I love open source projects. This is great! @constant-flow: hilarious that we ran into the exact same issue on a project that has been quiet for so long. Thank you for putting in the extra effort that I didn't, in order to solve the problem and contribute it for the rest of us. @jtfrey: thank you again for sharing this project, and for coming back to it to review the PR. |
Please checkout the 714cd34 commit (bitmap8 branch). It has the bitmap types implemented as directed in the v1.5 specification. I also added the new Terminal and Processing Unit attributes that arrived in the v1.5 specification. Let me know if it works — I have no USB video devices with which to test this anymore. |
Wow, you are fast. I just tested your code. From what i see does it behave as before. All (few) settings, my cam lists do work as expected (
|
@dhughes-xumak Once auto-exposure-mode is changed to 1 (manual) some of the other controls should be usable (e.g. exposure time, iris). |
Yup, seems to work for me now. I was able to set my camera to auto-exposure-mode 1 (Manual) or 8 (VVUVCKit reports this as Aperture Priority). The VVUVCKit test app also has options for Auto and Shutter Priority, but VVUVCKit allows me to set several settings which are not available to me with uvc-util, such as brightness and contrast. However, after setting auto-exposure-mode=1, I'm able to set my camera's exposure-time-abs to some values, most notably 39, 78, and 117 [edit: updated list in my next comment] seemed to result in decent video with varying light levels. From the spec doc, I don't see any significance to these numbers.
This update was sufficient to get me to where I wanted to take this. Thank you again, both. -- I've added a launch agent to poll for a UVC camera every 5 seconds, and set some default settings when one is found:
https://medium.com/swlh/how-to-use-launchd-to-run-services-in-macos-b972ed1e352 |
I pushed another update just now, this one with how control resolution is handled. The VVUVCKit doesn't seem to bother with control resolution. The implementation in uvc-util does check it, but was using the wrong formulation. It was checking (value % resolution) and rounding up/down to the nearest value that is cleanly divisible by resolution. But the UVC specification is such that ((value - minimum) % resolution) is rounded up/down to the nearest cleanly-divisible value. So given
valid values should be 1, 21, 41, 61, 81, 101. But choosing 21:
and the previous implementation would subtract 1 from value to yield 20. So just as for bitmap values incorrectly applying resolution to round (when it was actually a bitmask to be AND'ed), the integer controls with resolution were being resolved to incorrect values. Let me know if all previous tests continue to produce the same results, and if additional controls now work properly. |
@jtfrey, thanks again. Unfortunately, I don't think that helped me. This setting actually has a resolution of 1, so the resolution-fixing doesn't apply.
The possible values seem to (more or less) follow a doubling series. Any other value seems to be treated like the max value; 624 looks the same as anything >312. |
Does VVUVCKit allow a continuous range of values for that control, or the same distinct values? The UVC 1.5 specification indicates that control over exposure-time-abs is partly a function of the frame interval for the device. My guess would be that what you're observing with the series is dependency on the frame rate (which can itself be dependent on other factors). The value 0 is supposed to be a reserved value with no defined meaning in the specification. |
So, I spent some time with the spec and identified that my missing settings (eg, brightness) are processing unit settings (vs camera terminal settings, which I can access). I've tracked the missing PU settings to here: While debugging I found that I was also able to set these PU values after making a corresponding change to EDIT: and with a little more effort, I located table A-5 in the spec (which already has corresponding constants in UVCController). Based on this, I undid my prior changes and set |
Please see my comments on the UVC_PROCESSING_UNIT_ID fix. I've pushed another commit to the bitmap8-patch branch that should work regardless of what unit id the PU has for a specific device. E.g. with the default unitId changed to 0xFF and the actual unit now being noted by the UVCController class, the program still works on an Apeman 4K:
Please try it with your devices. |
Hmm, with your latest commit, now the util reports no controls for my device. It chugs along for a while, but eventually reports no controls.
The device is a Microsoft® LifeCam Cinema. |
I added a chunk of code to dump the entire UVC interface header to a file (e.g. uvc-header-#.bin). Can you collect that for the LifeCam Cinema and get it to me so I can take a look at it? |
|
The PU record wasn't the length I was expecting, until I checked the version: that's a UVC 1.0 device! There really was nothing wrong with the UVC header, but there was a botched stringify directive in the UVC_CONTROL_INIT macro. Every control had a unit type string of @"U" rather than @"UVC_INPUT_TERMINAL_ID" versus @"UVC_PROCESSING_UNIT_ID", so lookup of the unit when interacting with the device (GET_CUR, et al.) was failing. It should be fixed now. |
It was, indeed, UVC 1.0. Interestingly, looking back through this issue, it looks like all three of us had UVC 1.0 devices, at least based on the Anyways, I've tested it out and it seems to be working well. I'm going to go ahead and close this issue now. Thanks again @jtfrey and @constant-flow! |
PS, don't forget to merge branch bitmap8-patch into master. 😄 |
Let me start with thank you. Thank you for making this open source and contributing it to the world.
I have nearly 20 years of development experience, and this was the first Objective C project I ever compiled. So there's that.
Unfortunately, the tool only worked for setting some of my camera's controls.
I also got this for exposure-time-abs. I suspect the issue may have been in the type handling (U8Int and U32Int), possibly related to the endian swap for some int types. I put a couple hours into trying to debug the issue, but again... first time with Objective C.
In addition to not accepting some of the values for certain settings, I also noticed that some settings/controls aren't accessible for my camera, such as brightness and contrast. These values can be set with other apps, however.
--
So, I ended up moving on and finding https://github.com/mrRay/VVUVCKit, which has a "Test App" with a GUI for configuring the camera's settings. Aside from the Test App, that project contains a framework. I don't have the Objective C chops to do this, but it would be awesome if somebody built a CLI like this project, using the VVUVCKit framework.
With a working CLI, I suspect you could create a service similar to https://github.com/pirj/noclamshell, which could poll ioreg to see if a particular camera is connected, and set the desired config programmatically.
The text was updated successfully, but these errors were encountered: