linux:serial_ports
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:serial_ports [2020/09/30 08:57] – [Serial port basics] utedass | linux:serial_ports [2022/09/12 00:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| * socat -- Command | * socat -- Command | ||
| * fuse -- Filesystem in userspace | * fuse -- Filesystem in userspace | ||
| - | * pipes -- Heave data between processes | + | * < |
| - | ====== | + | ^ Method ^ Description ^ Pros ^ Cons ^ Dependencies ^ |
| + | | pty | Virtual terminal device | Full duplex | ||
| + | | socat | Multipurpose relay | Super flexible | ||
| + | | fuse | Filesystem in userspace | ?? | ???? | libfuse-dev | | ||
| + | | fifo | Named pipes | Simple | ||
| + | ====== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | < | ||
| + | errno | ||
| + | termios | ||
| + | tcgetattr | ||
| + | cfsetospeed | ||
| + | cfsetispeed | ||
| + | tcsetattr | ||
| + | posix_openpt | ||
| + | ioctl_tty | ||
| + | |||
| + | Använd noncanonical input processing mode för att kunna styra RTS och DTR | ||
| + | |||
| + | termios.h är en grej | ||
| + | |||
| + | |||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | gör open på porten | ||
| + | int fd = open (portname, O_RDWR | O_NOCTTY | O_SYNC); | ||
| + | </ | ||
| Get info: | Get info: | ||
| Line 25: | Line 66: | ||
| # Using screen. Exit with c-a k | # Using screen. Exit with c-a k | ||
| $ screen /dev/ttyS0 115200 | $ screen /dev/ttyS0 115200 | ||
| + | |||
| + | # Read current configuration using stty | ||
| + | $ stty -a < /dev/ttyS0 | ||
| + | # or | ||
| + | $ stty -a -F=/ | ||
| + | |||
| + | # Set baud rate and hardware flow control using stty | ||
| + | $ stty -F=/ | ||
| </ | </ | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | |||
| ====== Serial port basics ====== | ====== Serial port basics ====== | ||
| {{ : | {{ : | ||
| - | |||
| - | {{ : | ||
| |DTE | Data terminal equipment (computer/ | |DTE | Data terminal equipment (computer/ | ||
| Line 40: | Line 93: | ||
| |DSR | Data set ready | | |DSR | Data set ready | | ||
| + | {{: | ||
linux/serial_ports.1601456249.txt.gz · Last modified: 2022/09/12 00:30 (external edit)
