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

LIBUSB errors when running on windows #31

Open
r-bt opened this issue Oct 31, 2024 · 1 comment
Open

LIBUSB errors when running on windows #31

r-bt opened this issue Oct 31, 2024 · 1 comment

Comments

@r-bt
Copy link

r-bt commented Oct 31, 2024

Firstly, thanks for the library. I've been using it without issue on macOS but now I'm trying to get some code running on windows and it doesn't work.

Specifically I have a Logitech C930e connected but when I run uvcc devices I just get []

I tried following the advice at #7 (comment) however when I do uvcc --vendor 0x46d --product 0x843 which corresponds to my device vendor and product I get the following error:

WrappedError: Could create uvc-control object: {"pid":2115,"vid":1133} ("Error: LIBUSB_ERROR_NOT_FOUND")
    at CameraFactory.createWrappedError (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/camera-factory.js:93:30)
    at CameraFactory.get (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/camera-factory.js:74:43)
    at CommandManager.execute (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/command-manager.js:73:47)
    at async mainAsync (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/index.js:73:9) {
  innerError: Error: LIBUSB_ERROR_NOT_FOUND
      at Device.open (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\usb\dist\usb\device.js:63:14)
      at UVCControl.init (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:81:19)
      at new UVCControl (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:22:10)
      at CameraFactory.get (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/camera-factory.js:54:28)
      at CommandManager.execute (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/command-manager.js:73:47)
      at async mainAsync (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/index.js:73:9) {
    errno: -5
  }
}

I then tried replacing the driver with WinUSB and libusbK using Zadig as recommended in the https://github.com/node-usb/node-usb however I then got this error:

Error: LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED
    at Device.controlTransfer (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\usb\dist\usb\device.js:155:22)
    at Device.getStringDescriptor (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\usb\dist\usb\device.js:197:14)
    at C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:325:16
    at new Promise (<anonymous>)
    at UVCControl.validate (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:313:10)
    at Array.map (<anonymous>)
    at C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:299:36
    at new Promise (<anonymous>)
    at UVCControl.discover (C:\Users\Steve\AppData\Roaming\npm\node_modules\uvcc\node_modules\uvc-control\index.js:298:10)
    at UvcDeviceLister.get (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/uvc-device-lister.js:33:47)
    at DevicesCommand.execute (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/command-handlers/devices.js:35:52)
    at CommandHandlers.execute (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/command-handlers.js:48:38)
    at CommandManager.execute (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/command-manager.js:86:55)
    at async mainAsync (file:///C:/Users/Steve/AppData/Roaming/npm/node_modules/uvcc/dist/index.js:73:9) {
  errno: 0
}
(node:22432) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=true to handle those exceptions properly.
(Use `node --trace-deprecation ...` to show where the warning was created)
@joelpurra
Copy link
Owner

@r-bt: glad to hear that Logitech c930e works with uvcc in macOS, since it rules out a lot of potential hardware and (general) uvcc issues.

FYI I'm no longer using neither Windows nor macOS, so am unable to debug; below suggestions are based on guesses.

Oh, and uvcc dependencies haven't been updated in over a year. Perhaps there are upstream bugfixes. Pull requests welcome!


I then tried replacing the driver with WinUSB and libusbK using Zadig as recommended in the node-usb/node-usb however I then got this error:

Did camera streaming work with WinUSB/libusbK? Someone else had a similar issue where WinUSB would help when using uvc-control (which uvcc uses) but then also disable video streaming. Note that #7 doesn't use Zadig in the end.

Given that the c930e works in macOS, I am unsure what LIBUSB_ERROR_NOT_FOUND implies. My guess is something has gained exclusive camera access, either directly on a USB level or through a Windows API/driver.

Try to run uvcc before any other camera software starts a video stream. Physically reconnecting the camera and/or rebooting may help.

If you have issues using uvcc while another program is streaming video, which has gained exclusive webcam access, you might need to use/implement camera controls and video streaming in the same application. For nodejs development, here's a UVC software/library overview written in 2021:


Firstly, thanks for the library. I've been using it without issue on macOS but now I'm trying to get some code running on windows and it doesn't work.

Which version of macOS are you using? A few years ago macOS changed camera access controls, for privacy and shared resource management. Applications were forced to adapt and use a new API for camera access (afaik) . Am actually surprised that uvcc+c930e works in macOS for you -- perhaps something changed again.

Which version of Windows are you using? If it's Windows 11, camera access is more locked down (afairc) for similar reasons (privacy, shared resource management). Access to webcams may be gated; may need to either "grant access" somewhere, or perhaps uvcc needs to use more modern camera APIs.

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

2 participants