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

Support custom rates #30

Open
wsakernel opened this issue Jun 10, 2022 · 1 comment
Open

Support custom rates #30

wsakernel opened this issue Jun 10, 2022 · 1 comment

Comments

@wsakernel
Copy link

Using 'struct termios2' with the 'TCGETS2' ioctl, custom baud rates could be supported. I need 1384200 for one board. My quick fix was to switch to picocom but custom rates would be nice for microcom as well. I'd be available for testing.

@ukleinek
Copy link
Contributor

ukleinek commented Sep 7, 2022

I looked into that for a while now and this is very ugly. The problem is: I want to #include <linux/termios.h> to get the (architecture dependant!) definition of struct termios2. However this header cannot be used in the same translation unit as <termios.h> or <sys/ioctl.h>:

uwe@taurus:~$ printf '#include <termios.h>\n#include <linux/termios.h>' | gcc -xc  -
In file included from /usr/include/x86_64-linux-gnu/asm/termbits.h:1,
                 from /usr/include/asm-generic/termios.h:12,
                 from /usr/include/x86_64-linux-gnu/asm/termios.h:1,
                 from /usr/include/linux/termios.h:6,
                 from <stdin>:2:
/usr/include/asm-generic/termbits.h:12:8: error: redefinition of ‘struct termios’
   12 | struct termios {
      |        ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/termios.h:27,
                 from /usr/include/termios.h:39,
                 from <stdin>:1:
/usr/include/x86_64-linux-gnu/bits/termios-struct.h:24:8: note: originally defined here
   24 | struct termios
      |        ^~~~~~~
uwe@taurus:~$ printf '#include <sys/ioctl.h>\n#include <linux/termios.h>' | gcc -xc  -
In file included from /usr/include/x86_64-linux-gnu/asm/termios.h:1,
                 from /usr/include/linux/termios.h:6,
                 from <stdin>:2:
/usr/include/asm-generic/termios.h:15:8: error: redefinition of ‘struct winsize’
   15 | struct winsize {
      |        ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/ioctl.h:29,
                 from <stdin>:1:
/usr/include/x86_64-linux-gnu/bits/ioctl-types.h:27:8: note: originally defined here
   27 | struct winsize
      |        ^~~~~~~
/usr/include/asm-generic/termios.h:23:8: error: redefinition of ‘struct termio’
   23 | struct termio {
      |        ^~~~~~
/usr/include/x86_64-linux-gnu/bits/ioctl-types.h:36:8: note: originally defined here
   36 | struct termio
      |        ^~~~~~

I see no at least half-pretty way to manage that.

picocom duplicates the definition of struct termios2, see https://github.com/npat-efault/picocom/blob/master/termbits2.h

plan44 added a commit to plan44/p44utils that referenced this issue Jun 18, 2024
… glibc user land -> do not try

- while `TCGETS2` is defined, `struct termios2`, which would be needed to actually use `TCGETS2`, is not defined via <termios.h>.
- including <linux/termios.h> which would get us `termios2`, on the other side causes redefinitions of `termio` and `winsize`
- As [this](pengutronix/microcom#30 (comment)) comment puts it - "I see no halfway pretty way to manage that", so we forget about termios2 on standard linux glibc user land.
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

No branches or pull requests

2 participants