how to create a serial device as /dev/ttyXYZ

7 views
Skip to first unread message

AJ ONeal

unread,
Nov 6, 2010, 9:50:23 PM11/6/10
to
I've got a RS232 UART sitting behind a SPI with a chip select.

I've tested that my driver works the way I expect in terms of
raw functionality (using echo "blah" > /dev/my_uart and cat /dev/my_uart, etc),
and it's currently sitting in /dev/my_uart.

But now I'd like it to function just like anything else in /dev/ttyXYZ

Is there some sort of thin wrapper or interface that I can implement
so that I could control it with stty?

I was expecting that it stty.c I would see something like

switch (user_baud) {
   case 96000:
      baud = B96000;
      break;
  .......
}

int fd = open(device_name, baud_rate | );
send(fd, data, len);

and I would be able to implement that on my side of the driver to make use
of the same #defines

but when I was fishing around in stty.c it looked much more complicated.

Any pointers on how to go about that?

AJ ONeal
Reply all
Reply to author
Forward
0 new messages