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

Set both cfsetospeed and cfsetispeed #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Sewci0
Copy link

@Sewci0 Sewci0 commented Feb 16, 2024

Trying to run the executable on MacOS with a Baofeng cable results in:

> ./k5prog -p /dev/cu.usbserial-110 -r
Quansheng UV-K5 EEPROM programmer v0.9 (c) 2023 Jacek Lipkowski <[email protected]>

tcsetattr error 22 Invalid argument
Open /dev/cu.usbserial-110 failed

Setting both the output and input baud rate fixes the problem.

@nica-f
Copy link

nica-f commented Mar 13, 2024

Would cfsetspeed() work on MacOS? Setting input and output peed independently is not necessary. cfsetspeed() is supported in Linux and should also be in MacOS.
Just tested it in Linux and works as expected...

@bkmit
Copy link

bkmit commented Mar 16, 2024

Would cfsetspeed() work on MacOS? Setting input and output peed independently is not necessary. cfsetspeed() is supported in Linux and should also be in MacOS. Just tested it in Linux and works as expected...

Confirm, it works on macOS

@agrif
Copy link

agrif commented Apr 18, 2024

Another thing that works is initializing the struct to zero before setting any fields:

memset(&my_termios, 0, sizeof(struct termios));

I guess the root problem here is garbage on the stack being left inside the struct, so either be very sure to set every field or initialize it to 0. Initializing it might be a good idea anyway, uninitialized fields sneak around and cause insane bugs.

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.

4 participants