[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: interacting with serial driver




>Can anyone please tell me how do i send chatacters over a serial line (say
>ttyS0). I want to make use of the serial driver (serial.c) functions. But

It  can be happen by using ttyS0 device. First open the device file and
then follow read/write operations.
.
.
fd = open("/dev/ttyS0", O_RDWR|O_NOCTTY);
write(fd, char, 1);
.
.
when you access node /dev/ttyS0,  it is directly associated with the driver
"serial.c" through the major number, therefore you need not worry about
using serial.c
You require root permissions for doing this.

>serious kernel hacking, but i think i'll need to generate some kind of
>software interrupt, isn't it?

Also you need not worry about handling interrupts while writing a user
level prg. the driver does it for you itself.

For more info see Linux Device Drivers by Rubini.


prateek