node-uvc-control
node-uvc-control copied to clipboard
Setting UVCC autoWhiteBalance to 0 Getting LIBUSB_ERROR_IO
sudo uvcc devices
Optical Mouse [ vId: 0x458 / pId: 0x3a ]
USB Keyboard [ vId: 0x4d9 / pId: 0x1702 ]
EHCI Host Controller [ vId: 0x1d6b / pId: 0x2 ]
EHCI Host Controller [ vId: 0x1d6b / pId: 0x2 ]
USB 2.0 Camera [ vId: 0xc45 / pId: 0x6366 ]
sudo uvcc --vendor 0xc45 --product 0x6366 set autoWhiteBalance 0
Error: LIBUSB_ERROR_IO
I've seen IO error before, but it meant I didn't have permission to use the usb device.
@GaganMeesala: I can confirm the problem -- am also getting LIBUSB_ERROR_IO
on ubuntu. The same webcam works on macOS without any issue. Looks like the problem isn't in uvcc
though, but in upstream code. Perhaps a change in libusb
's nodejs wrapper?
@positlabs: I've set permissions according to the (newly added) link in README.md
, but it didn't fix this LIBUSB_ERROR_IO
issue.
- https://github.com/makenai/node-uvc-control/blob/ca1e2c963e98b309ad3b65c5fc538f052ea5fd64/README.md#notes
- https://askubuntu.com/questions/978552/how-do-i-make-libusb-work-as-non-root
Note that the suggested fix is for LIBUSB_ERROR_ACCESS
, not LIBUSB_ERROR_IO
. Running as a superuser (in my case in a sudo su -
shell) still gives LIBUSB_ERROR_IO
. Looked through issues in node-usb
, but didn't come up with anything substantial so far.
Did some more testing in ubuntu 19 with a c920 webcam.
Note: seems usb
v1.6.0 is required in node
v12.11.1 -- or at least it's more convenient as it uses prebuild
.
Looking at the constants in uvc-control
and usb
, it seems (based on bmRequestType
) that uvc-control
reads/writes using a camera interface rather than the camera device. Writing to an interface (on linux) requires claiming ("locking"?) the interface first. While it is possible to do so when another application (or the kernel?) is using the webcam, it will basically kill their interface and sort of crash the camera so it can't be opened (for video) again. Unplugging/plugging in the device makes it usable again, although a software reset might also work.
I have pushed unfinished patches for the two "current" uvc-control
versions.
-
uvc-control
v1.0.2: seems to fix usage inuvcc
. (The separateuvcc devices
still needs a fix.) -
uvc-control
v2 (unreleased): works for some values, but not all. One example isabsolute_zoom
, which works in v1 (asabsoluteZoom
) but getsLIBUSB_TRANSFER_STALL
in v2.
Added various (temporary) branches in case you'd like to check them out already. Tested on ubuntu 19 and macos 10.14. Does it work for you @GaganMeesala, @positlabs?
Targeting the device in controlTransfer
You can install and run tests from the uvcc
branches. Run ./index.js
to use the local branch version and configure --verbose
to see debug logs/warnings.
cd uvcc
rm -r node_modules
npm install
# NOTE: might need to configure your vendor/product.
./index.js --verbose export
./index.js --verbose ranges
v1-next
- https://github.com/joelpurra/node-uvc-control/tree/v1-control-transfer-target-device
- https://github.com/joelpurra/uvcc/tree/feature/uvc-control-v1-next
./index.js --verbose range absoluteZoom
./index.js --verbose get absoluteZoom
./index.js --verbose set absoluteZoom 150
v2-next
- https://github.com/joelpurra/node-uvc-control/tree/v2-control-transfer-target-device
- https://github.com/joelpurra/uvcc/tree/feature/uvc-control-v2-next
./index.js --verbose range absolute_zoom
./index.js --verbose get absolute_zoom
./index.js --verbose set absolute_zoom 150
Constant value debugging
Just getting the runtime values of constants, and printing numbers in decimal/binary/hexadecimal. Helped finding the interface/device fix.
- https://github.com/joelpurra/node-uvc-control/tree/v1-debug-constants
- https://github.com/joelpurra/node-uvc-control/tree/v2-debug-constants
Print constants to the console.
-
./test/constants/usb-expanded.js
-
./test/constants/uvc-control-expanded.js
@joelpurra Looking forward to the fix. Thanks for your effort.
Did anyone test the experimental branches so far? Might use the forked version of node-uvc-control
to get uvcc
running on linux, so a new version can be published on npm
. It'd be nice to have someone else confirm the functionality first though.
See #64.
@gaganmesala: this should be fixed in uvcc
v2.0.0, which was just released. Let me know if it works!
- https://joelpurra.com/projects/uvcc/