Re: Accessing serial ports from a loadable module (from kernel space)

From: Greg KH (greg@kroah.com)
Date: Mon Feb 21 2000 - 14:40:41 EST


On Mon, Feb 21, 2000 at 05:32:46PM +0100, Jörgen Overgaard wrote:
> Hi,
>
> I'm relatively new to the concept of writing loadable drivers (modules) for Linux.
> I'm trying to write a driver that will control some hardware via the serial port. (radios, etc)
>
> I've come so far as the driver can be read from and written to. It handles all the neccesary processing needed before
> passing it on to the serial port. That's where my problem arrives.
> How can I access (for example /dev/ttyS0 from kernel space)
> Since I cannot use standard libraries and running within kernel space, I can't just access them usuall way
> with open("/dev/ttyS0", O_RDWR), etc,etc.
>
> I found some info (and trying to studie some existing char drivers in kernel source) that could be a trail in the right direction.
> tty_open() etc....
>
> It get's a bit frustrating when I've come this far.
> I've tried to search the net for info,but eitherway I'm searching wrong,or there is no info (at least not very informant).
>
> Anyone out there with knowlage about accessing the serial ports from kernel space??
>
Hi,

The first question that everyone is going to have is, why don't you do
this in userspace? That way you can talk to whatever type of serial port
that you have in the machine (serial, multiport serial card, usb to
serial device, etc.) without tying your driver to a specific type of
hardware.

That being said, you could have your driver implement the tty interface,
thereby looking like a serial port to any user applications.

greg k-h
greg@kroah.com
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:28 EST