Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
After a week of finding an answer to my error, I ended up with a solution that you just need to install pywin32 library and it will not gives you an error
open cmd and type
pip install pywin32
and you are good to go.....!
Python Selenium Webdriver/Chromedriver (Device attached is not functioning...)
This is not an error , but a warnign and it doesn't affect the run.
Browser closing is because python garbage collector is closing the chromedriver once the code execution completes
you can just add time.sleep()
, or ask some user input("Enter any key to exit:")
to stop code from exiting
USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
After going through quite a few discussions, documentations and Chromium issues here are the details related to the surfacing of the log message:
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Details
It all started with the reporting of chromium issue Remove WebUSB's dependency on libusb on Windows as:
- For Linux (probably Mac as well), both WebUSB notification and communication works correctly (after allowing user access to the device in udev rules).
- For Windows, it seems that libusb only works with a non-standard WinUsb driver (https://github.com/libusb/libusb/issues/255).
When the hardware is inserted and the VID/PID is unknown to the system, windows 10 correctly loads it's CDC driver for the CDC part and the WinUSB driver (version 10) for the WebUSB part (no red flags). However, it seems that chrome never finds the device until I manually force an older WinUSB driver (version 6 - probably modified also) on the interface.
The solution was implemented in a step-wise manner as follows:
- Start supporting some transfers in the new Windows USB backend
- Fix bulk/interrupt transfers in the new Windows USB backend
- [usb] Read BOS descriptors from the hub driver on Windows
- [usb] Collect all composite devices paths during enumeration on Windows
- [usb] Remove out parameters in UsbServiceWin helper functions
- [usb] Support composite devices in the new Windows backend
- [usb] Detect USB functions as Windows enumerates them
- [usb] Support composite devices with multiple functions
- [usb] Hold interface requests until Windows enumerates functions
- [usb] Add direction parameter to ClearHalt
- [usb] Count references to a WINUSB_INTERFACE_HANDLE
- [usb] Implement blocking operations in the Windows backend
These changes ensured that the new backend was ready to be tested and was available through Chrome Canary and chrome-dev-channel which you can access manually through:
chrome://flags#enable-new-usb-backend
More change requests were submitted as follows:
- [usb] Mark calls to SetupDiGetDeviceProperty as potentially blocking: According to hang reports this function performs an RPC call which may take some time to complete. Mark calls with a base::ScopedBlockingCall so that the thread pool knows this task may be busy for a while.
- variations: Enable NewUsbBackend in field trial testing config: This flag was experimental as beta-channel uses this change configuration as the default for testing.
As the experimental launch of the new backend appeared to be stable, finally these configuration was enabled by default so that the chanege rolls out to all users of Chrome 87 through usb: Enable new Windows USB backend by default. Revision / Commit
The idea was once this configuration becomes the default for a few milestones, Chromium Team will start removing the Windows-specific code from the old back-end and remove the flag.
Road Ahead
Chromium Team have already merged the revision/commit to Extend new-usb-backend flag expiration within Chrome v90 which will be available soon.
Update
As per @ReillyGrant's [Committer, WebDriver for Google Chrome] comment :
..." it would be good to reduce the log level for these messages so they don't appear on the console by default but we haven't landed code to do that yet"...
References
You can find a couple of relevant detailed discussions in:
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Chrome through Selenium
Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Chrome through Selenium
This error message...
DevTools listening on ws://127.0.0.1:60683/devtools/browser/9b15c32e-ddc1-4ddd-9abe-bcf597ad4821
[4888:9376:1120/223739.924:ERROR:device_event_log_impl.cc(211)]
[22:37:39.924] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
...implies that the ChromeDriver raised an error while in trying to initiate/spawn a new Browsing Context i.e. google-chrome session.
Analysis
This error surfaces on windows-10 systems due to an error in callback of an attached USB device which isn't functioning properly.
This error is defined within usb_device_handle_win.cc as follows:
void UsbDeviceHandleWin::GotDescriptorFromNodeConnection(
TransferCallback callback,
scoped_refptr<base::RefCountedBytes> request_buffer,
scoped_refptr<base::RefCountedBytes> original_buffer,
Request* request_ptr,
DWORD win32_result,
size_t bytes_transferred) {
std::unique_ptr<Request> request = UnlinkRequest(request_ptr);
if (win32_result != ERROR_SUCCESS) {
SetLastError(win32_result);
USB_PLOG(ERROR) << "Failed to read descriptor from node connection";
std::move(callback).Run(UsbTransferStatus::TRANSFER_ERROR, nullptr, 0);
return;
}
Solution
This error isn't harmful and doesn't blocks the spawning of the new Browsing Context
i.e. the Chrome Browser session. So you can safely ignore the error.
References
You can find a couple of relevant detailed discussions in:
- USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
Related Topics
Running Jupyter via Command Line on Windows
Can Pandas Groupby Aggregate into a List, Rather Than Sum, Mean, etc
Generate Permutations of List with Repeated Elements
Use a Library Locally Instead of Installing It
Django Equivalent for Count and Group By
What's the Cleanest Way to Extract Urls from a String Using Python
Smtpauthenticationerror When Sending Mail Using Gmail and Python
Pandas Deleting Row with Df.Drop Doesn't Work
Differencebetween I = I + 1 and I += 1 in a 'For' Loop