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

From: Jörgen Overgaard (overgaard@mailbox.ffc.se)
Date: Mon Feb 21 2000 - 17:35:53 EST


Hi Greg,

and thanks for your answer.

I'll try to answer your question as good as I can. Hihi.
I'm running a program called SatTrack that can write some information (like position, frequency, etc)
to any TTY or even a file.
Maybe you have run into this program or even using it.
Anyway... I needed some way of controlling my radios frequency aswell as my antennas automagicly from
the Linux box. The radios can be controlled via a serial port. The protocol they use is CI-V.

I've come so far that my "program / driver" gets the data (SatTrack writes to /dev/ci-v) and does some
formatting / protocol,etc.

I bet you and all you others out there know some other way to to this, but since I got interested in kernel programming /
device drivers I decided to try and solve my problem, and at the same time broaden my knowlage in Linux. :-)

I'm still open for all suggestions though! Hihi :-)

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

I'm not sure I'm following you quite there. (Could be my understanding of english language), but please take your time
to explain. I'm here to learn! :-)

Regards / Jörgen

-----Ursprungligt meddelande-----
Från: Greg KH <greg@kroah.com>
Till: Jörgen Overgaard <jorgen@naxos.se>
Kopia: 'linux-kernel@vger.rutgers.edu' <linux-kernel@vger.rutgers.edu>; 'linux-c-programming@vger.rutgers.edu' <linux-c-programming@vger.rutgers.edu>; 'linux-hams@vger.rutgers.edu' <linux-hams@vger.rutgers.edu>
Datum: den 21 februari 2000 23:40
Ämne: Re: Accessing serial ports from a loadable module (from kernel space)

>
>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:29 EST