Open mesalagagan opened 5 years ago
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.
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 in uvcc
. (The separate uvcc devices
still needs a fix.)uvc-control
v2 (unreleased): works for some values, but not all. One example is absolute_zoom
, which works in v1 (as absoluteZoom
) but gets LIBUSB_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?
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
./index.js --verbose range absoluteZoom
./index.js --verbose get absoluteZoom
./index.js --verbose set absoluteZoom 150
./index.js --verbose range absolute_zoom
./index.js --verbose get absolute_zoom
./index.js --verbose set absolute_zoom 150
Just getting the runtime values of constants, and printing numbers in decimal/binary/hexadecimal. Helped finding the interface/device fix.
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!
sudo uvcc devices
sudo uvcc --vendor 0xc45 --product 0x6366 set autoWhiteBalance 0
Error: LIBUSB_ERROR_IO