-
Notifications
You must be signed in to change notification settings - Fork 142
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
libserialport issue under macOS 14.3 with CH340 #1644
Comments
libserialport example output.
|
ch340 cannot be recognized by name.
ft231x is similarly not recognized by name.
|
Please take a look if we can improve on the current behavior. If it is not easy, then I will still close this issue but update the Wiki. This is just a nice-to-have feature and not a must. |
Does it work if you use a different serial chip?Also, it looks like you're using the WCH driver, and not the default one that Macos provides, hence the name cu.wchusbserial |
No, it is the default driver from Apple now. I have not installed any driver from WCH in the Mac Mini. |
Ok. And what was the previous macos version that it worked with? |
@MCUdude But at least it works on your Mac. What is the macOS version you are using? |
@mcuee I'm not at home right now, so can't look into it. But try other libserialport examples as well, and see if you can get it to print the USB vid/pid and SN. This is what Avrdude use to identify a port |
I will carry out tests tomorrow. |
In any case, this is not a big issue and we may not want to do anything. |
So you don't have the slightest idea what ran before you upgraded? Was it a major update, or just a minor/patch?
Well, that means that @mcuee can you try to run the This should be the output when reading a CH340 chip:
|
The macos conceptual code described here works fine in my environment. So it doesn't seem to be a driver issue.
And it's not just the naming that doesn't work. The
|
You are right that
Now it is listed as a native port...
|
I am not so sure if we can fix this using libserialport. pyserial seems to work fine.
|
Sorry I have not tested urclock under macOS for a while. I was doing a minor upgrade from macOS 14.2 to 14.3. But macOS 14 itself is a major upgrade. My Mac Mini M1 (2020 version) came with macOS 11 Big Sur and now it is running macOS 14 Sonoma. |
The driver (and macOS version) is not the issue per se. But I think libserialport relies on certain driver behavior to be able to work for avrdude. So it is rather a libserialport limitation. As this is not a real avrdude issue, I will keep the label as |
@askn37 |
@dl8dtl |
@MCUdude
Affected: CH340 or similar, FTDI USB to Serial may be affected (need to check). |
iMac 24-inch, M1, 2021 macos Sonoma 14.2.1
I agree that this may be a limitation of libserialport (1.0.0). On CH340 and FT231X, I think |
I saw that you were involved in some discussions in the PRs for libserialport. I will try those PRs under macOS.
For Linux, the following PR may be useful. |
Thanks for testing the port_info example. There is a compatibility issue with the latest macOS version and libserialport. @mcuee can you try the suggested fix here libserialport#14 and try the port_info example again? Since there have been some changes to the driver, 16 characters isn't enough to hold the descriptor string, and a side effect of this is that the port is flagged as native. |
@mcuee It would be great if you had time to test sigrokproject/libserialport#14 asap. |
sigrokproject/libserialport#14 works fine for CH340.
Original binary without your patch.
|
Personally I like sigrokproject/libserialport#9 better. It works fine with CH340.
|
Excellent! This means that the bus is a new descriptor sting that's longer than 16 bytes. A simple fix.
Yes, sigrokproject/libserialport#9 will resolve the issue too. But the intention for the PR was to fix the CP2102 issue that's been there for many, many years. The root cause for the issue is the buffer overflow. sigrokproject/libserialport#9 doesn't check the descriptor string at all. I'm not qualified to tell whether this is safe or not. But sigrokproject/libserialport#14 just resolves the actual bug without changing any behavior. |
I can also confirm that your PR works with FT232R and CP2102 where libserialport git does not work. The following PR works fine with FT232R and CP2102 as well. But you are right that your PR is simpler and easier to be accepted by the maintainer. |
@mcuee I think we can close this issue, now that we know that it's an isolated libserialport issue, and there already exist two PRs that will fix the issue. But thank you for the extensive testing! I was worried for a second that the Avrdude implementation suddenly didn't work. And that's not the case. It's Apple that doing changes, and the libserialport source code that isn't hardened against things like this. |
Just upgraded my Mac Mini M1 2020 to latest macOS 14.3 and it seems to me avrdude can not recognize
-P ch340
now.The text was updated successfully, but these errors were encountered: