LDD3 notes: TTY

My notes while reading Linux Device Drivers 3rd edition, TTY drivers.

TTY drivers are a generic implementation of a serial port interface with loose coupling of hardware access and data formatting.

It is a char device composed of
  • tty core for user space char device interface
  • line discipline for data formatting
  • tty driver for hardware access

write
  • can be called from interrupt context.
  • must succeed for single byte write
write buffer treatment
  • put_char, flush_chars - start sending them, return right away
  • wait_until_sent - start sending, wait until done or timeout
  • flush_buffer - discard write buffered chars.


read

tty_insert_flip_char() for each char

tty_flip_buffer_push()
  • whenever count reaches size
  • at the end of sequence


set_termios()
  • 38400,8n1 -style serial settings
  • handshake mechanism selection

tiocm{g|s}et()
  • access control lines
ioctl()
  • tty driver first, except break
  • fallback to inherit core functionality with -ENOICTLCMD
  • Get Line Status Register LSR: data, overrun, parity, framing, break...
  • Wait on MSR: change in CTS,DSR, ring, carrier..

[un]throttle()
  • rx flow control

start/stop()
  • tx enable/disable
write_wait queue - tty driver wakes up


tty open/close count example? what happens to tty filps on fork?

Comments

Popular posts from this blog

iMovie event library on a network drive, NAS

Proxmox PCIe passthrough on HP gen8 - failed to set iommu for container

Backup and restore observium