Why control_in_blocking
for my UVC device returns Err(Cancelled)
on Windows
#43
-
I think nusb is cool, so I'm willing to replace I'm pretty sure that the following parameters work, with respect to the framework of rusb/libus. However, they failed with nusb. let request = 0x86;
let wvalue = 0x0100;
let windex = 0x01;
let timeout = std::time::Duration::from_secs(1);
let mut buf = [0; 50]; rusb /* with rusb, these parameters work */
let size = device_handle
.read_control(request_type, request, wvalue, windex, &mut buf, timeout)
.unwrap(); nusb /* with nusb, these parameters fails*/
let control = Control {
control_type: ControlType::Class,
recipient: Recipient::Interface,
request: request,
value: wvalue,
index: windex,
};
let result = interface.control_in_blocking(control, &mut buf, timeout); I've replaced the driver of my usb device to Could you give me some guidlines to get over it? Thank you very much. log
Updated
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
The log It's hard to tell why that would be different than rusb, though. One limitation to be aware of is that with |
Beta Was this translation helpful? Give feedback.
-
Hi! After investigated, my problem appears to be related to two low-level issues.
Would you consider resolving these two issues at |
Beta Was this translation helpful? Give feedback.
-
Emm... I think Yes, I mean the UVC-specific request can be detected by firmware, when using
Yes you're right, and you've mentioned it before. But I wonder if it is essentially related to issue 1 (UVC-specific request). But seems that I took an inappropriate example, and I'd like to have taken another example
Yes, I can control the firmware and change its inner logic. Actually, I'm not expert in USB standard but a user at best, so I'm not sure what is its should-be state, and I'd appreciate the discussion and the guideline you've provided. But what made me most confused is the interoperability. In fact, for developping the firmware of the device (UVC device), several common video played (e.g. the OS out-of-the-box video player, PotPlayer, and ffmpeg) were used to test and check the interoperability. The device firmware has passed the check. Note that in this stage, there's no programmed software nor user-installed driver. Only default uvc drivers/frameworks (such as MSMF, DirectShow, V4L2) were used. So I assume that, after this stage, the firmware logic is compatible with uvc standard. Then later, I focused on Windows and found that the OS framework (MSMF and DirectShow) seemed to be less performant since frames would drop/miss every hundreds of frames. So I turned to the way of reading raw data of usb and decoding w.r.t uvc. To achieve this, I installed After these stages, the uvc device turns out to be has interoperability with all these common players and libusb-win32 driver. So I feel strange why it would fail with WinUSB. Doesn't the Windows-default uvc driver not depend on Windows-default usb driver WinUSB? However, although I assume the firmware should better keep its current state to keep interoperability, I still tested modifying its inner logic to accept any DEBUG nusb::platform::windows_winusb::enumeration: Driver is "WinUSB"
INFO nusb::platform::windows_winusb::device: Blocking control In, 50 bytes
INFO nusb::platform::windows_winusb::device: Blocking control In, 50 bytes
INFO nusb::platform::windows_winusb::device: Blocking control In, 50 bytes
INFO nusb::platform::windows_winusb::device: Blocking control Out, 34 bytes
INFO nusb::platform::windows_winusb::device: Blocking control In, 50 bytes
INFO nusb::platform::windows_winusb::device: Blocking control Out, 34 bytes
DEBUG nusb::platform::windows_winusb::transfer: Submit transfer 0x1985f385790 on endpoint 83 for 102400 bytes IN
DEBUG nusb::platform::windows_winusb::transfer: Submit transfer 0x1985f385610 on endpoint 83 for 102400 bytes IN
DEBUG nusb::platform::windows_winusb::transfer: Handling completion for transfer 0x1985f385790
DEBUG nusb::platform::windows_winusb::transfer: Submit transfer 0x1985f3857f0 on endpoint 83 for 102400 bytes IN
DEBUG nusb::platform::windows_winusb::transfer: Handling completion for transfer 0x1985f385610
DEBUG nusb::platform::windows_winusb::transfer: Transfer 0x1985f385790 on endpoint 83 failed: 87, 0 bytes transferred At last, although |
Beta Was this translation helpful? Give feedback.
Ah, ok, didn't realize that it was UVC. By "control" and "stream" you were also referring to the
VideoControl
andVideoStreaming
interfaces defined in the UVC specification. In your descriptor you posted above, your interface number 0 has subclass=1 so is the VideoControl interface, and your interface number 1 has subclass=2 so is the VideoStreaming interface.You should
claim_interface(0)
andclaim_interface(1)
to open both of these interfaces, and makeVideoControl
requests using interface 0, andVideoStreaming
requests using interface 1. Then WinUSB will set the least significant byte of index to 0 or 1 to match the interface number used.I think UVC will have an interface association …