Re: Opening a /dev file from Kernel space
- From: John Reiser <jreiser@xxxxxxxxxxxx>
- Date: Mon, 23 Oct 2006 10:18:45 -0700
I want to open the serilal driver (/dev/ttyS0) from the kernel space.
I need to write a character driver in the kernel (the requirements of
the project insist that it will be inside the kernel) that gets special
strings from user and pass them to the serial.
In order to implement that I thought of opening the serial driver as if
I was a user and with the file descriptor to read()/write()/ioctl()
etc...
Can I do this from the kernel space?
Do you have maybe a better idea how to implement?
This sounds like a "line discipline" for a serial device: a special way
to interpret the byte stream flowing between the user and the device:
something other than uninterpreted, 1-for-1 transport.
The most common line discipline is the code for a VGA text console
which performs character echoing (so you can see what you type), handles
backspace-as-delete, rings the bell for control-G, sends SIGINT for
control-C, turns <Enter> ('\r') into newline ('\n') on input, turns
newline ('\n') into carriage_return + linefeed ("\r\n") on ouput, etc.
The user opens the device, performs an ioctl() to choose the line
discipline, then transfers data using read() or write(). The line
discipline is a "filter" which resides inside the kernel, instead
of in a shell pipeline. See linux/Documentation/tty.txt.
--
.
- Follow-Ups:
- Re: Opening a /dev file from Kernel space
- From: hagit
- Re: Opening a /dev file from Kernel space
- References:
- Opening a /dev file from Kernel space
- From: hagit
- Opening a /dev file from Kernel space
- Prev by Date: Re: Open and Read functions
- Next by Date: Re: a patch for more virtual consoles?
- Previous by thread: Opening a /dev file from Kernel space
- Next by thread: Re: Opening a /dev file from Kernel space
- Index(es):
Relevant Pages
|