Skip to content

Set both cfsetospeed and cfsetispeed#24

Open
Sewci0 wants to merge 1 commit intosq5bpf:mainfrom
Sewci0:patch-1
Open

Set both cfsetospeed and cfsetispeed#24
Sewci0 wants to merge 1 commit intosq5bpf:mainfrom
Sewci0:patch-1

Conversation

@Sewci0
Copy link
Copy Markdown

@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 <sq5bpf@lipkowski.org>

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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