Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 12348

How does a serial driver get attached with a tty port

$
0
0

I am looking at Linux sample UART driver code here

https://github.com/martinezjavier/ldd3/blob/master/tty/tiny_serial.c

Below is snipped from the code where UART driver is sending data to the tty port

static void tiny_timer(unsigned long data){    struct uart_port *port;    struct tty_struct *tty;    struct tty_port *tty_port;    port = (struct uart_port *)data;    if (!port)        return;    if (!port->state)        return;    tty = port->state->port.tty;    if (!tty)        return;    tty_port = tty->port;    /* add one character to the tty port */    /* this doesn't actually push the data through unless tty->low_latency is set */    tty_insert_flip_char(tty_port, TINY_DATA_CHARACTER, 0);    tty_flip_buffer_push(tty_port);    /* resubmit the timer again */    timer->expires = jiffies + DELAY_TIME;    add_timer(timer);    /* see if we have any data to transmit */    tiny_tx_chars(port);}

However, what I am not clear about, looking at the code, is how is the coupling between UART port and tty port ever established. Is that something that has to be configured manually in Linux?


Viewing all articles
Browse latest Browse all 12348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>