USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
Asked Answered
W

8

16

We recently upgraded our Windows 10 test environment with ChromeDriver v87.0.4280.20 and Chrome v87.0.4280.66 (Official Build) (64-bit) and after the up-gradation even the minimal program is producing this ERROR log:

[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)

Minimum Code Block:

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')

Console Output:

DevTools listening on ws://127.0.0.1:64170/devtools/browser/2fb4bb93-79ab-4131-9e4a-3b65c08dbffb
[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)
[9848:10684:1201/013233.172:ERROR:device_event_log_impl.cc(211)] [01:32:33.173] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)

Anyone facing the same? Was there any change in ChromeDriver/Chrome v87 with respect to ChromeDriver/Chrome v86?

Any clues will be helpful.

Workhouse answered 30/11, 2020 at 20:27 Comment(0)
W
20

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:

  1. Start supporting some transfers in the new Windows USB backend
  2. Fix bulk/interrupt transfers in the new Windows USB backend
  3. [usb] Read BOS descriptors from the hub driver on Windows
  4. [usb] Collect all composite devices paths during enumeration on Windows
  5. [usb] Remove out parameters in UsbServiceWin helper functions
  6. [usb] Support composite devices in the new Windows backend
  7. [usb] Detect USB functions as Windows enumerates them
  8. [usb] Support composite devices with multiple functions
  9. [usb] Hold interface requests until Windows enumerates functions
  10. [usb] Add direction parameter to ClearHalt
  11. [usb] Count references to a WINUSB_INTERFACE_HANDLE
  12. [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:

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:

Workhouse answered 3/12, 2020 at 21:45 Comment(3)
The libusb issue you mention at the beginning of this answer is irrelevant to the reason why Chrome is switching away from libusb. Chrome will continue to require the standard WinUSB driver provided by Windows. This is the same driver which libusb supports. libusb also supports some non-standard drivers (libusbk, etc.) which are not currently supported by Chrome.Perfume
Thanks a lot, I followed chrome://flags and enabled Enable new USB backend option, after that the log message disappeared. Hope the changes will be added in Chrome 90 by default.Trefoil
I'm uising Chromedriver V90 with newest Win 10, and I get the same error mesage when running the driver. The only difference is that in my case the error message says ...win.cc:1054 not 1020. I enabled the Chrome flag mentioned in the above comment, but the error persists.Baucis
W
22

However these log messages can be supressed from appearing on the console through an easy hack i.e. by adding an argument through add_experimental_option() as follows:

options.add_experimental_option('excludeSwitches', ['enable-logging'])

Code Block:

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
# to supress the error messages/logs
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')
Workhouse answered 24/12, 2021 at 20:12 Comment(0)
W
20

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:

  1. Start supporting some transfers in the new Windows USB backend
  2. Fix bulk/interrupt transfers in the new Windows USB backend
  3. [usb] Read BOS descriptors from the hub driver on Windows
  4. [usb] Collect all composite devices paths during enumeration on Windows
  5. [usb] Remove out parameters in UsbServiceWin helper functions
  6. [usb] Support composite devices in the new Windows backend
  7. [usb] Detect USB functions as Windows enumerates them
  8. [usb] Support composite devices with multiple functions
  9. [usb] Hold interface requests until Windows enumerates functions
  10. [usb] Add direction parameter to ClearHalt
  11. [usb] Count references to a WINUSB_INTERFACE_HANDLE
  12. [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:

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:

Workhouse answered 3/12, 2020 at 21:45 Comment(3)
The libusb issue you mention at the beginning of this answer is irrelevant to the reason why Chrome is switching away from libusb. Chrome will continue to require the standard WinUSB driver provided by Windows. This is the same driver which libusb supports. libusb also supports some non-standard drivers (libusbk, etc.) which are not currently supported by Chrome.Perfume
Thanks a lot, I followed chrome://flags and enabled Enable new USB backend option, after that the log message disappeared. Hope the changes will be added in Chrome 90 by default.Trefoil
I'm uising Chromedriver V90 with newest Win 10, and I get the same error mesage when running the driver. The only difference is that in my case the error message says ...win.cc:1054 not 1020. I enabled the Chrome flag mentioned in the above comment, but the error persists.Baucis
P
18

My apologies for the log spam. If you aren't having issues connecting to a device with WebUSB you can ignore these warnings. They are triggered by Chrome attempting to read properties of USB devices that are currently suspended.

Perfume answered 30/11, 2020 at 22:2 Comment(3)
Anyway we can not show this in the log or hide it?Pfosi
Thank you @DebanjanB for the summary of my work in your answer however your conclusion here is incorrect. I think 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.Perfume
Sorry and how can I set to ignore the warnings? Maybe I'm to new to selenium, but can you tell? Thanks!Vitriol
S
2

The solution to suppress the error messages in C# is:

var chromeDriverService = ChromeDriverService.CreateDefaultService();
var chromeOptions = new ChromeOptions();
chromeOptions.AddExcludedArguments("excludeSwitches", "enable-logging");
var chromeDriver = new ChromeDriver(chromeDriverService, chromeOptions);

This way the messages won't appear in the Console.

Subdeacon answered 28/3, 2023 at 7:30 Comment(0)
C
0

I encounered this problem yesterday,and I has fixed it by update all available windows update.

https://support.microsoft.com/en-us/windows/what-to-try-if-your-touchscreen-doesn-t-work-f159b366-b3ef-99ad-24a4-31a4c62ab46d

Cosmonaut answered 3/3, 2021 at 1:12 Comment(0)
D
0

A partial solution that worked for me

I was getting this error too. It was stopping my program running.

  1. I unplugged all my USB devices, ran the program, with no error.
  2. Plugged the devices back in, ran the program. I am still getting the error, however, the program finished without the error stopping the program.
Disappear answered 8/9, 2021 at 3:21 Comment(0)
G
0

Note: For WebdriverIO on Windows 10, this suppresses the error messages for me:

"goog:chromeOptions": { "excludeSwitches": ["enable-logging"] }
Gybe answered 22/9, 2022 at 20:58 Comment(0)
E
0

This code works for me to suppress the USB device error messages.

Browser 111.0.5563.65 Chrome Driver 111.0.5563.65

The experimental option does not seem to work on its own.

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions #as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import time

options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
options.add_argument("--ignore-certificate-errors")
options.add_argument("--disable-webgl")
options.add_experimental_option("excludeSwitches", ["enable-logging"])
service = Service("chromedriver.exe")
driver = webdriver.Chrome(service=service,options=options)
driver.get("https://www.google.com")
time.sleep(5)
WebDriverWait(driver, 20).until(expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, "button[id='L2AGLb']"))).click()
time.sleep(5)
driver.close
Eckart answered 20/3, 2023 at 20:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.