Skip to content
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

macOS fixes (#49) #133

Closed
wants to merge 22 commits into from
Closed

macOS fixes (#49) #133

wants to merge 22 commits into from

Conversation

astraw
Copy link
Contributor

@astraw astraw commented Nov 15, 2023

Hi, this PR updates the changes made by @berkus in #49 to v4.2.2.

The git history is messy because I simply merged @berkus' original patch through the git history and kept it working. I'm fine to rewrite the history if requested.

The remaining changes with main could be further cleaned up. In particular, the iOS code looks to me like it won't compile, but I have not tested it. As I did this work already I wanted to leave it here in the hopes it could be merged or could help someone.

@astraw
Copy link
Contributor Author

astraw commented Nov 15, 2023

Now I fixed the compilation errors on iOS (in 103a023 ). There is a test failing on x86_64-apple-darwin which I have not investigated further.

@eldruin
Copy link
Contributor

eldruin commented Nov 16, 2023

Thank you! This looks fine to me. Only that failing CI test left.

@astraw
Copy link
Contributor Author

astraw commented Nov 16, 2023

Yes, I noticed that test, too. I have not dug too deeply but I started to have a look. It will be some days before I can get back to this - if someone wants to jump in, I guess the issue is fairly localized and I'd be grateful. There is various baud_rate handling stuff with various #[cfg] compile-time switches which I think must be involved somehow, but I haven't dug deeper.

Actually, I just now noticed that the test also fails on my machine when compiled natively (aarch64-apple-darwin) but apparently this test doesn't get run with that architecture in CI.

@astraw
Copy link
Contributor Author

astraw commented Nov 27, 2023

This is superseded by #142.

@astraw astraw closed this Nov 27, 2023
@KaSroka
Copy link

KaSroka commented Mar 18, 2024

Why was this closed? Those changes are still required to make baudrate setting work on M1/2/3 macs.

@astraw
Copy link
Contributor Author

astraw commented Mar 18, 2024

@KaSroka does #142 (released in 4.3.0 AFAIK) fix the issue for you? What problem are you seeing? I was testing on an M1 mac when I made that PR and it Worked For Me. As stated in PR #142, however, I do not understand things deeply enough to know why it resolved my issue, so there could indeed still be something left to resolve.

@astraw
Copy link
Contributor Author

astraw commented Mar 18, 2024

And to your question

Why was this closed? Those changes are still required to make baudrate setting work on M1/2/3 macs.

Because (to the best of my understanding) #142 does the same thing, but much simpler.

@KaSroka
Copy link

KaSroka commented Mar 18, 2024

I'm still seeing problems with setting the baud rate on my M1 mac on latest version. When I have switched to this PR it worked like a charm. And the only thing I'm changing is the version of serialport crate.

@astraw
Copy link
Contributor Author

astraw commented Mar 19, 2024

Can you please describe the steps to reproduce your problem?

@KaSroka
Copy link

KaSroka commented Mar 19, 2024

I'm opening serial port like this:

let port = serialport::new(port_path, 115200)
            .baud_rate(115200)
            .open()
            .unwrap();

On the v4.3.0 it results in my USB<>UART converter running on 9600 baud rate
On the latest version from this PR it correctly sets 115200 baud rate (I have found baud_rate extra call to be necessary on this version, it does nothing on v4.3.0)

@sirhcel
Copy link
Contributor

sirhcel commented Apr 10, 2024

Thank you for this snippet @KaSroka! I tried to reproduce the issue of the baud rate not being actually used with pr49_baud_rate_not_changed.rs, but the baud rate I'm setting appeared on the wire in my setup so far. For example

$ cargo run --release --example pr49_baud_rate_not_changed -- /dev/tty.usbserial-112110 19200

gives me the expected 19,200 baud on the wire.

I acutally checked the data on the wire with a logic analyzer. I'm running this on an M1 Mac with a SiLabs CP2102N USB serial adapter.

How does your setup looks like? Especialy, which serial adapter are you using? What does pr49_baud_rate_not_changed.rs give for results with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants