MarsTechHAN / ch552tool

An open sourced python tool for flashing WCH CH55x series USB microcontroller with bootloader v2.30, v2.31 & v2.40.
GNU General Public License v3.0
154 stars 24 forks source link

USB_ERROR_CANNOT_SET_CONFIG error on CH552 #13

Open suda-morris opened 3 years ago

suda-morris commented 3 years ago

Hi there, I would like to flash CH552 on linux, then your tool seems be a good option. When I just run python ch55xtool.py I always get the USB_ERROR_CANNOT_SET_CONFIG error.

BTW, usb rules has been added, and I can see the USB device from lsusb:

Bus 001 Device 007: ID 4348:55e0 WinChipHead
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Any hint to debug on this?

MarsTechHAN commented 3 years ago

Which OS you are using? Can you try just remove the set config section and see will it work?

 try:
        dev.set_configuration()
    except usb.core.USBError:
        return (None, 'USB_ERROR_CANNOT_SET_CONFIG')
suda-morris commented 3 years ago

Thanks @MarsTechHAN I'm using Manjaro, with python 3.8.6 After comment out the "set_configuration", it will fails at clain_interface.

MarsTechHAN commented 3 years ago

Do you have the right privilege to access usb devices? Maybe you can remove the try block and take a screen shot of the exact error it throw? (Both with and without set_configuration, and with and without set_configuration and claim_interface)