2002-03-14 16:40:47

by Hansen Martin

[permalink] [raw]
Subject: Accessing serial device from within

I am writing a module, that will communicate with a device attached to the
serial port.

How can I do that from inside a module, using the present uart driver?
I want to do something like finding and calling the read/write routine that
is called by the kernel when a process from user space accesses the
/dev/ttyS1.

The reason I want to do it this way is that I don't want my module to only
fit one uart.

--
Martin Hansen
Student at SDU S?nderborg. http://www.sdu.dk
Writing final project at Danfoss drives. http://www.danfossdrives.com

Tlf: 74 88 54 62


2002-03-14 16:50:07

by Ben Collins

[permalink] [raw]
Subject: Re: Accessing serial device from within

On Thu, Mar 14, 2002 at 05:40:12PM +0100, Hansen Martin wrote:
> I am writing a module, that will communicate with a device attached to the
> serial port.
>
> How can I do that from inside a module, using the present uart driver?
> I want to do something like finding and calling the read/write routine that
> is called by the kernel when a process from user space accesses the
> /dev/ttyS1.
>
> The reason I want to do it this way is that I don't want my module to only
> fit one uart.

The question is, why do this in the kernel, when it is more easily
handled in userspace?

--
.----------=======-=-======-=========-----------=====------------=-=-----.
/ Ben Collins -- Debian GNU/Linux -- WatchGuard.com \
` [email protected] -- [email protected] '
`---=========------=======-------------=-=-----=-===-======-------=--=---'

2002-03-14 16:51:47

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: Accessing serial device from within

On Thu, Mar 14, 2002 at 05:40:12PM +0100, Hansen Martin wrote:
> I am writing a module, that will communicate with a device attached to the
> serial port.
>
> How can I do that from inside a module, using the present uart driver?
> I want to do something like finding and calling the read/write routine that
> is called by the kernel when a process from user space accesses the
> /dev/ttyS1.
>
> The reason I want to do it this way is that I don't want my module to only
> fit one uart.

You have to write what's called a line discipline driver.

--
Vojtech Pavlik
SuSE Labs