-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to get device for CH559 #16
Comments
Thanks for the issue. I don't currently have CH559 by my hand. I will try to get a device and take a try. |
As you mentioned, as for thie tool.
Can you add some print here to know where it is exited? ( I will fix this in next version) ch552tool/ch55xtool/ch55xtool.py Line 84 in 8bf717d
Also, is that possibile for you to check the USB ID, to make sure the device's vendor id and product id is correct. I dont see a real differecnt between this and the vnproch55x you mentioned. ummmm... |
If I add a
in the error printf I get output
If I additionally do a
And I print the the exception traceback in
Device has libUSB drivers loaded (it says libusb0 but that's the result I get after I replace it with libusb-win32 on the right). Device manager shows the device. |
Hi, thanks for your additional information! Can you try just remove the dev.set_configuration() line, and see will it work? If that still make it error, can you try run the program with PYUSB_DEBUG=debug enviroment virable.
I see a similar issue here: I think that's a pyusb or libusb issue, but we can try to workaround at here. :p |
If I comment out the I added import os
os.environ['PYUSB_DEBUG'] = 'debug' at the top of the script and got debug output and program return value
The I will forward the device to a Linux virtual machine to see if the error is Windows-specific.. |
Very interesting: If I just rename the
file to something else, it falls back to the libusb0 backend, but throws an exception
later. If I re-comment in the setting of the usb device configuration, it works!
or with less debug output
So this has something to do with the used backend or libusb1.0 dll version. I'll try out linux + different libusb1 versions. |
I think I have a similar problem on linux. It seems like the bootloader doesn't respond properly to multiple set_configuration requests and the default usb driver sets a configuration automatically. I found a workaround here. I put this code at the start of import fcntl, array
USBDEVFS_CLAIM_PORT = -2147199720 # printf("0x%d\n", USBDEVFS_CLAIM_PORT);
port = array.array('i', [1]) # For port 1 which i identified using udevadm info -t
fcntl.ioctl(os.open("/dev/bus/usb/002/001", os.O_RDWR), USBDEVFS_CLAIM_PORT, port)
input('Connect the device and press ENTER to continue') I haven't tried a lot so far but it seems promising.
I did a test in C first which did not require root. I don't know why I need to run python with sudo. This requires me to use the same usb port every time and start the tool before plugging the device in which is a bit of a hassle. I'll see if I can prevent the automatic configuration using device/authorized in a udev rule. EDIT: I've tried setting OWNER and ATTRS{authorized}:=0 in udev but it doesn't help |
Oh, I just realized it has nothing to do with what I just wrote. If I ran the tool immediately (without any modifications) it worked. I also noticed that running it multiple times in a row sometimes helps. |
I've put my device into USB bootloader mode and I've previously installed libusb-win32 drivers via Zadig.
When I try to upload the firmware I get
When I call into the tool by https://github.com/LoveMHz/vnproch55x, directly after that, with no USB device reconnected or anything
It can do it, as well as when I use the Python version of
but when I use the precompile .exe version
(a related bug for that is opened at atc1441/chflasher#4)
In any case, with the tool in this repository I can't get my device recognized.
It is interesting that the chflasher tool is also written in Python and the script also doesn't see my device..
Any ideas?
Running on Windows 10, Python 3.8.6, pyUSB 1.1.1, Zadig libusb-win32 drivers were installed for the device.
The text was updated successfully, but these errors were encountered: