Skip to content

DeviceIoControl use async mode - #1741

Closed
slouken wants to merge 1 commit into
libusb:masterfrom
slouken:nacon-hang-workaround
Closed

slouken wants to merge 1 commit into
libusb:masterfrom
slouken:nacon-hang-workaround

Conversation

@slouken

@slouken slouken commented Jan 12, 2026

Copy link
Copy Markdown

DeviceIoControl() will hang indefinitely when the Nacon PS4 Compact Controller is connected, so use async mode to safely call it with a timeout.

We're running into this when adding support for libusb to Steam, so this is a critical fix for us.

This PR is based on #1127, with the requested changes applied and code reformatted to match libusb style.

@mcuee mcuee added the windows label Jan 13, 2026
@tormodvolden

Copy link
Copy Markdown
Contributor

If this is very much based on someone else's work I'd suggest adding a proper "Co-authored-by:" tag in the commit message and not just @'mention a github user name.

DeviceIoControl() will hang indefinitely when the Nacon PS4 Compact Controller is connected, so use async mode to safely call it with a timeout.

Co-authored-by: shaodiwei <shaodiwei@tencent.com>
@slouken
slouken force-pushed the nacon-hang-workaround branch from d033d50 to a87d5a5 Compare January 16, 2026 16:29
@slouken

slouken commented Jan 16, 2026

Copy link
Copy Markdown
Author

If this is very much based on someone else's work I'd suggest adding a proper "Co-authored-by:" tag in the commit message and not just @'mention a github user name.

Done!

@mcuee mcuee mentioned this pull request Feb 28, 2026
@mcuee mcuee added this to the 1.0.31 milestone Mar 1, 2026
@mcuee

mcuee commented Mar 7, 2026

Copy link
Copy Markdown
Member

I have set this for milestone 1.0.31.

But we need to wait for the review of the other maintainers like @sonatique.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Windows WinUSB backend to avoid indefinite hangs from DeviceIoControl() (notably observed with the Nacon PS4 Compact Controller) by using overlapped I/O with a bounded wait.

Changes:

  • Added an async DeviceIoControl wrapper (device_io_control) with a fixed timeout.
  • Switched hub/root-hub IOCTL queries in device initialization/config caching to use the wrapper.
  • Opened relevant hub/root-hub handles with FILE_FLAG_OVERLAPPED and introduced a per-init io_event.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +747 to +753
CancelIoEx(hDevice, &overlapped);
return FALSE;
}

DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
CancelIoEx(hDevice, &overlapped);

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the error paths in device_io_control(), CancelIoEx() can overwrite the original GetLastError() from DeviceIoControl(), and WaitForSingleObject() timeouts don't set a useful last-error value. Since callers log windows_error_str(0), this can produce misleading diagnostics. Preserve/restore the original error code (store it before cancelling and SetLastError(error) before returning) and set a clear error on timeout (e.g. ERROR_SEM_TIMEOUT).

Suggested change
CancelIoEx(hDevice, &overlapped);
return FALSE;
}
DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
CancelIoEx(hDevice, &overlapped);
CancelIoEx(hDevice, &overlapped);
SetLastError(error);
return FALSE;
}
DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
DWORD wait_error;
if (wret == WAIT_TIMEOUT)
wait_error = ERROR_SEM_TIMEOUT;
else if (wret == WAIT_FAILED)
wait_error = GetLastError();
else
wait_error = ERROR_GEN_FAILURE;
CancelIoEx(hDevice, &overlapped);
SetLastError(wait_error);

Copilot uses AI. Check for mistakes.
Comment on lines +739 to +761

ResetEvent(event);
memset(&overlapped, 0, sizeof(overlapped));
overlapped.hEvent = event;

if (!DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, &overlapped)) {
DWORD error = GetLastError();
if (error != ERROR_IO_PENDING) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
}

DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
} else {
DWORD bytes_written = 0;
if (!GetOverlappedResult(hDevice, &overlapped, &bytes_written, TRUE))
return FALSE;
}
}
return TRUE;

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces an async+timeout wrapper for hub IOCTLs, but winusb_get_device_string() in the same file still opens the hub handle without FILE_FLAG_OVERLAPPED and calls DeviceIoControl(..., NULL) directly for IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION (see around line ~2320). If the hang is triggered by this IOCTL as well, string descriptor queries can still block indefinitely. Consider switching that call site to use the same async wrapper (and an overlapped-capable handle/event) for consistency and to fully address the reported hang.

Suggested change
ResetEvent(event);
memset(&overlapped, 0, sizeof(overlapped));
overlapped.hEvent = event;
if (!DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, &overlapped)) {
DWORD error = GetLastError();
if (error != ERROR_IO_PENDING) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
}
DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
} else {
DWORD bytes_written = 0;
if (!GetOverlappedResult(hDevice, &overlapped, &bytes_written, TRUE))
return FALSE;
}
}
return TRUE;
DWORD error, wret, bytes_written = 0;
ResetEvent(event);
memset(&overlapped, 0, sizeof(overlapped));
overlapped.hEvent = event;
if (lpBytesReturned != NULL)
*lpBytesReturned = 0;
if (DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, &overlapped))
return TRUE;
error = GetLastError();
if (error != ERROR_IO_PENDING)
return FALSE;
wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret == WAIT_OBJECT_0)
return GetOverlappedResult(hDevice, &overlapped, &bytes_written, TRUE);
/*
* CancelIoEx() is asynchronous. Do not return until the pending request
* has reached a terminal state, otherwise the stack-allocated OVERLAPPED
* may be referenced after this function returns.
*/
error = (wret == WAIT_TIMEOUT) ? WAIT_TIMEOUT :
(wret == WAIT_FAILED) ? GetLastError() : ERROR_GEN_FAILURE;
CancelIoEx(hDevice, &overlapped);
if (!GetOverlappedResult(hDevice, &overlapped, &bytes_written, TRUE)) {
DWORD cancel_error = GetLastError();
if (cancel_error != ERROR_OPERATION_ABORTED)
error = cancel_error;
}
SetLastError(error);
return FALSE;

Copilot uses AI. Check for mistakes.
Comment on lines +756 to +759
DWORD bytes_written = 0;
if (!GetOverlappedResult(hDevice, &overlapped, &bytes_written, TRUE))
return FALSE;
}

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device_io_control() doesn't write the async completion byte count back to *lpBytesReturned. In the ERROR_IO_PENDING path you only store into a local bytes_written, so callers like cache_config_descriptors() end up using an uninitialized ret_size and can misbehave. Set *lpBytesReturned = bytes_written on success (and consider zeroing it on failure).

Copilot uses AI. Check for mistakes.
Comment on lines +744 to +755
if (!DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, &overlapped)) {
DWORD error = GetLastError();
if (error != ERROR_IO_PENDING) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
}

DWORD wret = WaitForSingleObject(event, IO_WAIT_TIME);
if (wret != WAIT_OBJECT_0) {
CancelIoEx(hDevice, &overlapped);
return FALSE;
} else {

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device_io_control() returns after calling CancelIoEx() on timeout / non-pending failure while the OVERLAPPED overlapped is stack-allocated. Cancellation is asynchronous, so the I/O may still complete later and write into the now-dead stack OVERLAPPED, leading to memory corruption. After CancelIoEx() you need to wait for the overlapped to complete (e.g., GetOverlappedResult(..., TRUE) expecting ERROR_OPERATION_ABORTED) before returning, or keep the OVERLAPPED alive until completion.

Copilot uses AI. Check for mistakes.
@mcuee
mcuee requested a review from sonatique May 13, 2026 06:10
@mcuee

mcuee commented May 18, 2026 •

Copy link
Copy Markdown
Member

Using the tip from @tormodvolden here.

PS C:\work\libusb\libusb_test> git clone https://github.com/libusb/libusb.git libusb_pr1741_rebase
Cloning into 'libusb_pr741_rebase'...
remote: Enumerating objects: 18596, done.
remote: Counting objects: 100% (285/285), done.
remote: Compressing objects: 100% (170/170), done.
remote: Total 18596 (delta 195), reused 117 (delta 115), pack-reused 18311 (from 4)
Receiving objects: 100% (18596/18596), 5.88 MiB | 22.73 MiB/s, done.
Resolving deltas: 100% (13230/13230), done.

PS C:\work\libusb\libusb_test> cd .\libusb_pr1741_rebase\

PS C:\work\libusb\libusb_test\libusb_pr1741_rebase> git fetch origin pull/1741/head
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 3), reused 3 (delta 3), pack-reused 0 (from 0)
Unpacking objects: 100% (5/5), 41.70 KiB | 5.21 MiB/s, done.
From https://github.com/libusb/libusb
 * branch              refs/pull/1741/head -> FETCH_HEAD
 * 
PS C:\work\libusb\libusb_test\libusb_pr1741_rebase> git checkout -b pr1741_rebase FETCH_HEAD
Switched to a new branch 'pr1741_rebase'

PS C:\work\libusb\libusb_test\libusb_pr1741_rebase> git rebase origin/master
Successfully rebased and updated refs/heads/pr1741_rebase.

@mcuee

mcuee commented May 18, 2026

Copy link
Copy Markdown
Member

Last time I had issues with make check.

This time it seems to be okay.

CLANGARM64 /c/work/libusb/libusb_test/libusb_pr1741_rebase
$ make check
Making check in libusb
make[1]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/libusb'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/libusb'
Making check in examples
make[1]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/examples'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/examples'
Making check in tests
make[1]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
make  check-TESTS
make[2]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
make[3]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
PASS: stress.exe
PASS: stress_mt.exe
PASS: set_option.exe
PASS: init_context.exe
============================================================================
Testsuite summary for libusb-1.0 1.0.30
============================================================================
# TOTAL: 4
# PASS:  4
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
make[2]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
make[1]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase/tests'
make[1]: Entering directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase'
make[1]: Leaving directory '/c/work/libusb/libusb_test/libusb_pr1741_rebase'

@Youw Youw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex reviewed current head a87d5a5d2d5ddce55a165518eff642511ef406be against master and checked Copilot's four unresolved inline threads. The Copilot review is not stale: it was submitted on this same head, every thread is still marked isOutdated: false, and each finding still maps to the current code.

The following blockers remain:

  • The timeout path returns immediately after CancelIoEx() while the stack OVERLAPPED, event, handle, and caller buffers may still be owned by the request. CancelIoEx() does not wait for terminal completion. The state must remain alive and be reaped later, or cancellation must be drained before releasing it.
  • The successful pending-I/O path writes the transferred length only to local bytes_written; callers then read an uninitialized/stale ret_size. Pass lpBytesReturned to GetOverlappedResult() or copy the local value on success.
  • Immediate failures and timeouts lose meaningful GetLastError() state. Preserve the initiating/wait error across cleanup and set an explicit timeout error.
  • winusb_get_device_string() still opens the hub synchronously and invokes the same IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION without an OVERLAPPED, leaving an unbounded path. Route it through the corrected helper with an overlapped handle and manual-reset event.

The inline comment adds a separate auto-reset-event hang not identified by Copilot. The cancellation/lifetime repair cannot safely be expressed as a single-hunk suggestion: blocking until cancellation completes repairs lifetime but can defeat the hard deadline if a driver does not complete cancellation promptly; a strict deadline requires request-owned persistent state/buffers plus eventual completion cleanup.

Codex also checked the closed predecessor, #1127.

References: CancelIoEx, DeviceIoControl, and overlapped I/O synchronization.

Generated by Codex (GPT-5.6 Sol).

if (priv->initialized)
return LIBUSB_SUCCESS;

io_event = CreateEventA(NULL, FALSE, FALSE, NULL);

@Youw Youw Jul 15, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Use a manual-reset event for the two-step wait. WaitForSingleObject() consumes this auto-reset event, and the subsequent GetOverlappedResult(..., TRUE) can then block indefinitely -- exactly the failure mode this PR is meant to prevent. Microsoft documents this combination as unsafe. Create a manual-reset event here and use GetOverlappedResult(..., FALSE) after WAIT_OBJECT_0; reuse the event only after each request reaches a terminal state.

Suggested change
io_event = CreateEventA(NULL, FALSE, FALSE, NULL);
io_event = CreateEventA(NULL, TRUE, FALSE, NULL);

Reference: Synchronization and Overlapped Input and Output.

Generated by Codex (GPT-5.6 Sol).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

io_event is shared between cache_config_descriptors() and the V2 call that follows it in init_device(). A request abandoned by a timeout can therefore signal the event for the next request on the same handle, which returns success with an unfilled buffer. A manual-reset event alone doesn't fix it.

@sonatique sonatique left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is real and worth fixing (an unbounded DeviceIoControl() in init_device() blocks under the device-list lock, so one misbehaving device stalls the whole library).

But I think the issue is broader than the threads already on the PR suggest: as it is written now it would be a regression for every Windows user, not a partial fix for one controller.

Example: The missing byte count that Copilot flagged: whenever a hub IOCTL goes pending (which is the state this patch is specifically designed to create) ret_size is left uninitialized, and both call sites in cache_config_descriptors() gate on it: lines 809/815 and 835/843 on this branch. So config descriptors would silently stop being cached across a wide range of devices. That's not a corner case, and it's the reason I'd rather see the helper rewritten than patched hunk by hunk.

I think 4 things need to be addressed:

  1. Please attach a debug log from the Nacon repro on the current head. FILE_FLAG_OVERLAPPED only helps if usbhub returns STATUS_PENDING. If the hang is inside the driver's dispatch routine, the flag changes nothing, CancelIoEx() has nothing to cancel, and the patch is all risk with no benefit. Not all of us have this device, so a log showing the timeout actually firing and enumeration continuing is what tells us the approach is right at all.

  2. Please rebase onto master, and cover winusb_get_device_string() while you're there. Copilot already flagged the string fetch at line 2320 on this branch: it opens the hub without FILE_FLAG_OVERLAPPED and issues IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION directly, which is exactly the request this patch treats as dangerous, so it should go through the same helper. Master has since added language-ID caching to that function, which introduces a second unbounded call on the same handle (master lines 2337 and 2364), so a rebase is needed for both to be covered. Master has also moved on in other ways since f1af64b.

  3. A timed-out device becomes a permanent stall, not a one-time one. On the timeout path priv->initialized is never set, so the device is re-initialized on every libusb_get_device_list() call and pays the full timeout again, indefinitely. With the Nacon plugged in, an app that polls the device list trades a single hang for a multi-second stall on every iteration. If that trade is intended it should be stated; more likely it needs a cheap "known bad" marker so we don't retry forever.

A design question for the other maintainers, not for @slouken : the backend already has overlapped I/O plus an I/O completion port in windows_open(). This adds a second, hand-rolled async mechanism that then blocks. That may be the right call for enumeration, which is synchronous by design in the core, but I'd like it to be a decision rather than an accident.

#include "libusbi.h"
#include "windows_winusb.h"

#define IO_WAIT_TIME 1000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this bounds all of enumeration, not just the request that hangs: node info, both INFORMATION_EX variants, V2, and every config-descriptor fetch now inherit it.

A hub resuming from selective suspend, or a loaded machine, can legitimately exceed one second — and when it does the failure is silent and severe. init_device() returns LIBUSB_ERROR_NO_DEVICE and the device just disappears from libusb_get_device_list(); init_root_hub() breaks out of the port loop and reports the wrong speed.

Could you justify the value, and add a comment giving the rationale? A named constant with "why 1000" next to it will save the next person this exact question.

And maybe more importantly : I'd also like to see the timeout scoped to the request that actually hangs rather than applied everywhere: the other IOCTLs have no reported problem, and every one we wrap is new risk for no benefit.

@sonatique

Copy link
Copy Markdown
Member

@slouken : any chance you can test this: #1882, thanks!

@mcuee

mcuee commented Aug 11, 2026

Copy link
Copy Markdown
Member

Test results.

 libusb_pr1741  .\build\v145\x64\Release-Hotplug-MT\xusb.exe 1BCF:2BB4
Using libusb v1.0.29.11993

libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
libusb: info [windows_init] UsbDk backend is not available
libusb: info [cache_config_descriptors] unexpected configuration descriptor 1 size (dummy) for 'USB\VID_0BDA&PID_8153\111000001'
Opening device 1BCF:2BB4...

Reading device descriptor:
            length: 18
      device class: 239
               S/N: 3
           VID:PID: 1BCF:2BB4
         bcdDevice: 3481
   iMan:iProd:iSer: 1:2:3
          nb confs: 1

Reading BOS descriptor: 2 caps
    Platform descriptor:
      bLength                : 28
      PlatformCapabilityUUID : {df60ddd8-8945-c74c-9cd2-659d9e648a9f}

  00000000  00 00 03 06 d4 05 01 00                          ........

    Unknown BOS device capability 11:

Reading first configuration descriptor:
              total length: 1059
         descriptor length: 9
             nb interfaces: 5
              interface[0]: id = 0
interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 0E.01.01
       endpoint[0].address: 87
           max packet size: 0010
          polling interval: 08
              interface[1]: id = 1
interface[1].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: 0E.02.01
interface[1].altsetting[1]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 00C0
          polling interval: 01
interface[1].altsetting[2]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0180
          polling interval: 01
interface[1].altsetting[3]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 01
interface[1].altsetting[4]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0280
          polling interval: 01
interface[1].altsetting[5]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0320
          polling interval: 01
interface[1].altsetting[6]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 03B0
          polling interval: 01
interface[1].altsetting[7]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0A80
          polling interval: 01
interface[1].altsetting[8]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0B20
          polling interval: 01
interface[1].altsetting[9]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0BE0
          polling interval: 01
interface[1].altsetting[10]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 13C0
          polling interval: 01
interface[1].altsetting[11]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 13FC
          polling interval: 01
              interface[2]: id = 2
interface[2].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 0E.01.01
       endpoint[0].address: 84
           max packet size: 0010
          polling interval: 08
              interface[3]: id = 3
interface[3].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: 0E.02.01
interface[3].altsetting[1]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 82
           max packet size: 0A80
          polling interval: 01
              interface[4]: id = 4
interface[4].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: FE.01.01

Kernel driver attached for interface 0: (not supported)

Claiming interface 0...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 1: (not supported)

Claiming interface 1...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 2: (not supported)

Claiming interface 2...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 3: (not supported)

Claiming interface 3...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 4: (not supported)

Claiming interface 4...

Reading string descriptors:
   String (0x01): "CN03N9728LU00548DCG8A00"
   String (0x02): "Integrated_Webcam_FHD"
   String (0x03): "01.00.00"

Reading OS string descriptor:

Reading Extended Compat ID OS Feature Descriptor (wIndex = 0x0004):
   Failed: Pipe error
Reading interface association descriptors (IADs) for first configuration:
    nb IADs: 2
      IAD 0:
            bFirstInterface: 0
            bInterfaceCount: 2
             bFunctionClass: 0E
          bFunctionSubClass: 03
          bFunctionProtocol: 00
                  iFunction: 4 (Integrated Webcam)
      IAD 1:
            bFirstInterface: 2
            bInterfaceCount: 2
             bFunctionClass: 0E
          bFunctionSubClass: 03
          bFunctionProtocol: 00
                  iFunction: 11 (Integrated IR Webcam)

Releasing interface 0...
Releasing interface 1...
Releasing interface 2...
Releasing interface 3...
Releasing interface 4...
Closing device...

 libusb_pr1741  .\build\v145\x64\Release-Hotplug-MT\testlibusb.exe
libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
libusb: info [windows_init] UsbDk backend is not available
libusb: info [cache_config_descriptors] unexpected configuration descriptor 1 size (dummy) for 'USB\VID_0BDA&PID_8153\111000001'
Dev (bus 3, device 11): 1A2C - 7FFF speed: 12M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:
  Product:                   2.4G Wireless Device
Dev (bus 1, device 4): 047F - C056 speed: 12M
  Manufacturer:              Plantronics
  Product:                   Plantronics Blackwire 3220 Series
Dev (bus 3, device 7): 413C - B06E speed: 480M
Dev (bus 3, device 10): 413C - B06F speed: 480M
Dev (bus 1, device 1): 1BCF - 2BB4 speed: 480M
  Manufacturer:              CN03N9728LU00548DCG8A00
  Product:                   Integrated_Webcam_FHD
Dev (bus 3, device 15): 7768 - 642C speed: 12M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:              Dongle
  Product:                   Inphic IN9 SLE
Dev (bus 3, device 9): 0BDA - 402E speed: 480M
Dev (bus 3, device 12): 24AE - 4057 speed: 1.5M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:              SEMICO
  Product:                   USB Keyboard
Dev (bus 3, device 13): 0424 - 2740 speed: 480M
  Manufacturer:              Microchip Tech
  Product:                   Hub Controller
Dev (bus 1, device 3): 8087 - 0033 speed: 12M
Dev (bus 1, device 6): 0B95 - 772B speed: 480M
Dev (bus 3, device 5): 0BDA - 8153 speed: 5G
Dev (bus 1, device 10): 16C0 - 05DC speed: 1.5M
  Manufacturer:              www.fischl.de
  Product:                   USBasp
Dev (bus 3, device 2): 0BDA - 0413 speed: 5G
Dev (bus 3, device 1): 0BDA - 0487 speed: 10G
Dev (bus 1, device 5): 05E3 - 0608 speed: 480M
Dev (bus 3, device 0): 8086 - 15F0 speed: 10G
Dev (bus 3, device 3): 0BDA - 5487 speed: 480M
Dev (bus 2, device 0): 8086 - 7EC0 speed: 5G
Dev (bus 3, device 8): 0424 - 2744 speed: 480M
Dev (bus 1, device 0): 8086 - 7E7D speed: 5G
Dev (bus 3, device 6): 0BDA - 5413 speed: 480M
Dev (bus 3, device 4): 0424 - 5744 speed: 5G

@mcuee

mcuee commented Aug 11, 2026

Copy link
Copy Markdown
Member

libusb git testlibusb output is a bit different -- probably due to the changes in git.

The warning is not present in latest git.

libusb: info [cache_config_descriptors] unexpected configuration descriptor 1 size (dummy) for 'USB\VID_0BDA&PID_8153\111000001'
 libusb  .\build\v145\x64\Release-Hotplug-MT\testlibusb.exe
libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
libusb: info [windows_init] UsbDk backend is not available
Dev (bus 3, device 11): 1A2C - 7FFF speed: 12M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:
  Product:                   2.4G Wireless Device
Dev (bus 1, device 4): 047F - C056 speed: 12M
  Manufacturer:              Plantronics
  Product:                   Plantronics Blackwire 3220 Series
Dev (bus 3, device 7): 413C - B06E speed: 480M
Dev (bus 3, device 10): 413C - B06F speed: 480M
Dev (bus 1, device 1): 1BCF - 2BB4 speed: 480M
  Manufacturer:              CN03N9728LU00548DCG8A00
  Product:                   Integrated_Webcam_FHD
Dev (bus 3, device 15): 7768 - 642C speed: 12M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:              Dongle
  Product:                   Inphic IN9 SLE
Dev (bus 3, device 9): 0BDA - 402E speed: 480M
Dev (bus 3, device 12): 24AE - 4057 speed: 1.5M
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
libusb: warning [hid_open] could not open HID device in R/W mode (keyboard or mouse?) - trying without
  Manufacturer:              SEMICO
  Product:                   USB Keyboard
Dev (bus 3, device 13): 0424 - 2740 speed: 480M
  Manufacturer:              Microchip Tech
  Product:                   Hub Controller
Dev (bus 1, device 3): 8087 - 0033 speed: 12M
Dev (bus 1, device 6): 0B95 - 772B speed: 480M
Dev (bus 3, device 5): 0BDA - 8153 speed: 5G
Dev (bus 1, device 10): 16C0 - 05DC speed: 1.5M
  Manufacturer:              www.fischl.de
  Product:                   USBasp
Dev (bus 3, device 2): 0BDA - 0413 speed: 5G
Dev (bus 3, device 1): 0BDA - 0487 speed: 10G
Dev (bus 1, device 5): 05E3 - 0608 speed: 480M
Dev (bus 3, device 0): 8086 - 15F0 speed: 10G
Dev (bus 3, device 3): 0BDA - 5487 speed: 480M
Dev (bus 2, device 0): 8086 - 7EC0 speed: 5G
Dev (bus 3, device 8): 0424 - 2744 speed: 480M
Dev (bus 1, device 0): 8086 - 7E7D speed: 5G
Dev (bus 3, device 6): 0BDA - 5413 speed: 480M
Dev (bus 3, device 4): 0424 - 5744 speed: 5G
 libusb  .\build\v145\x64\Release-Hotplug-MT\xusb.exe 1BCF:2BB4
Using libusb v1.0.30.12037

libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
libusb: info [windows_init] UsbDk backend is not available
Opening device 1BCF:2BB4...

Reading device descriptor:
            length: 18
      device class: 239
               S/N: 3
           VID:PID: 1BCF:2BB4
         bcdDevice: 3481
   iMan:iProd:iSer: 1:2:3
          nb confs: 1

Reading BOS descriptor: 2 caps
    Platform descriptor:
      bLength                : 28
      PlatformCapabilityUUID : {df60ddd8-8945-c74c-9cd2-659d9e648a9f}

  00000000  00 00 03 06 d4 05 01 00                          ........

    Unknown BOS device capability 11:

Reading first configuration descriptor:
              total length: 1059
         descriptor length: 9
             nb interfaces: 5
              interface[0]: id = 0
interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 0E.01.01
       endpoint[0].address: 87
           max packet size: 0010
          polling interval: 08
              interface[1]: id = 1
interface[1].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: 0E.02.01
interface[1].altsetting[1]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 00C0
          polling interval: 01
interface[1].altsetting[2]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0180
          polling interval: 01
interface[1].altsetting[3]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 01
interface[1].altsetting[4]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0280
          polling interval: 01
interface[1].altsetting[5]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0320
          polling interval: 01
interface[1].altsetting[6]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 03B0
          polling interval: 01
interface[1].altsetting[7]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0A80
          polling interval: 01
interface[1].altsetting[8]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0B20
          polling interval: 01
interface[1].altsetting[9]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 0BE0
          polling interval: 01
interface[1].altsetting[10]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 13C0
          polling interval: 01
interface[1].altsetting[11]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 81
           max packet size: 13FC
          polling interval: 01
              interface[2]: id = 2
interface[2].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 0E.01.01
       endpoint[0].address: 84
           max packet size: 0010
          polling interval: 08
              interface[3]: id = 3
interface[3].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: 0E.02.01
interface[3].altsetting[1]: num endpoints = 1
   Class.SubClass.Protocol: 0E.02.01
       endpoint[0].address: 82
           max packet size: 0A80
          polling interval: 01
              interface[4]: id = 4
interface[4].altsetting[0]: num endpoints = 0
   Class.SubClass.Protocol: FE.01.01

Kernel driver attached for interface 0: (not supported)

Claiming interface 0...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 1: (not supported)

Claiming interface 1...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 2: (not supported)

Claiming interface 2...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 3: (not supported)

Claiming interface 3...
   Failed (error -12) Operation not supported or unimplemented on this platform

Kernel driver attached for interface 4: (not supported)

Claiming interface 4...

Reading string descriptors:
   String (0x01): "CN03N9728LU00548DCG8A00"
   String (0x02): "Integrated_Webcam_FHD"
   String (0x03): "01.00.00"

Reading OS string descriptor:

Reading Extended Compat ID OS Feature Descriptor (wIndex = 0x0004):
   Failed: Pipe error
Reading interface association descriptors (IADs) for first configuration:
    nb IADs: 2
      IAD 0:
            bFirstInterface: 0
            bInterfaceCount: 2
             bFunctionClass: 0E
          bFunctionSubClass: 03
          bFunctionProtocol: 00
                  iFunction: 4 (Integrated Webcam)
      IAD 1:
            bFirstInterface: 2
            bInterfaceCount: 2
             bFunctionClass: 0E
          bFunctionSubClass: 03
          bFunctionProtocol: 00
                  iFunction: 11 (Integrated IR Webcam)

Releasing interface 0...
Releasing interface 1...
Releasing interface 2...
Releasing interface 3...
Releasing interface 4...
Closing device...

@sonatique

Copy link
Copy Markdown
Member

@mcuee : the idea is to drop this one (not maintained anymore) and replace it with #1882.

@sonatique

Copy link
Copy Markdown
Member

Closing this PR since its replacement PR #1882 is merged.

@sonatique sonatique closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants