From: "Lars K.W. Gohlke" <lkwg82@gmx.de>
To: Tilman Schmidt <tilman@imap.cc>
Cc: huang ying <huang.ying.caritas@gmail.com>,
Jan Engelhardt <jengelh@linux01.gwdg.de>,
linux-kernel@vger.kernel.org
Subject: Re: How to access correctly serial port inside module?
Date: Wed, 06 Jun 2007 10:27:04 +0200 [thread overview]
Message-ID: <46666FD8.9010702@gmx.de> (raw)
In-Reply-To: <4665D89E.8080408@imap.cc>
[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tilman Schmidt schrieb:
> Am 03.06.2007 22:28 schrieb Lars K.W. Gohlke:
>> Tilman Schmidt schrieb:
>>> Am 17.05.2007 08:15 schrieb huang ying:
>>>> I think the "serio" (through drivers/input/serio/serport.c) may be a
>>>> choice too, like that in linux/drivers/input/mouse/sermouse.c, which
>>>> is an example to program serial port in kernel space.
>>> Interesting. I wonder if that would have been a better choice for
>>> the Gigaset M101 driver. It seems even to have a probe mechanism
>>> so one could try to determine if the expected device is really
>>> connected to the port.
>>> Is there any documentation on this interface? I find the source a
>>> bit hard to understand, sparsely commented as it is.
>> how can I open ttyS1 with major=4 and minor=65?
>
> a) With "my" approach, ie. writing a line discipline, you open
> /dev/ttyS1 in a user space program and then push your line discipline
> onto it using ioctl(,TIOCSETD,).
>
> b) With the "serio" approach, if the probe mechanism is really what
> I think it is, you register your probe function and wait for it to
> be called for each active serial port, then do your thing to determine
> whether this is a/the port you want to use.
>
>> Does anybody have some code to read from it the first e.g. 2bytes?
>
> That's not how things work in the kernel. You don't "read the first
> <n> bytes" at will. You have to provide means to process whatever
> data happens to arrive on the serial port, as it arrives.
>
> a) With a line discipline, you provide a callback function
> ".receive_buf" which will be called by the serial driver if some
> data has been received, and has to process that data then and there.
> You might just stow it away in a buffer of course, provided you
> are sure to get around to processing it later.
>
> b) With the "serio" interface, it seems the ".interrupt" function
> serves the same purpose - though, as I said, I am not really
> competent on that topic.
>
> HTH
> T.
>
ok because I want to handle it in kernel space I will no take option a)
I will try it the way of b)
anyway thx.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - GPGrelay v0.959
iD8DBQFGZm/aAAomYJ1taN8RAhS1AKC5xZVKXjZPAovXLmz2vuVr7JXssQCgqxs9
PUcqGC5sTzPtEzxuc5nkdes=
=qO4W
-----END PGP SIGNATURE-----
[-- Attachment #2: lkwg82.vcf --]
[-- Type: text/x-vcard, Size: 132 bytes --]
begin:vcard
fn:Lars K.W. Gohlke
n:Gohlke;Lars K.W.
email;internet:lkwg82@gmx.de
x-mozilla-html:FALSE
version:2.1
end:vcard
next prev parent reply other threads:[~2007-06-06 8:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 13:00 How to access correctly serial port inside module? Lars K.W. Gohlke
2007-05-14 17:40 ` Lars K.W. Gohlke
2007-05-14 20:00 ` Jan Engelhardt
2007-05-14 20:25 ` Lars K.W. Gohlke
2007-05-14 23:00 ` Tilman Schmidt
2007-05-15 8:43 ` Jan Engelhardt
2007-05-22 22:17 ` Tilman Schmidt
2007-05-24 10:22 ` Lars K.W. Gohlke
2007-05-24 10:26 ` Jan Engelhardt
2007-05-24 10:45 ` Lars K.W. Gohlke
2007-05-24 10:50 ` Jan Engelhardt
2007-05-24 11:20 ` Lars K.W. Gohlke
2007-05-24 17:03 ` Tilman Schmidt
2007-05-24 17:19 ` Lars K.W. Gohlke
2007-05-24 17:29 ` Jan Engelhardt
2007-05-24 19:15 ` Lars K.W. Gohlke
2007-05-28 17:05 ` Tilman Schmidt
2007-05-28 19:03 ` Jan Engelhardt
2007-05-30 7:07 ` Lars K.W. Gohlke
2007-05-30 7:46 ` Lars K.W. Gohlke
2007-05-30 9:38 ` Tilman Schmidt
[not found] ` <851fc09e0705162315w3380ddabh9b9f0b2198cb8457@mail.gmail.com>
2007-05-22 21:55 ` Tilman Schmidt
2007-06-03 20:28 ` Lars K.W. Gohlke
2007-06-05 21:41 ` Tilman Schmidt
2007-06-06 8:27 ` Lars K.W. Gohlke [this message]
2007-06-07 22:25 ` Lars K.W. Gohlke
2007-06-08 0:27 ` Tilman Schmidt
2007-05-14 22:37 ` Tilman Schmidt
2007-05-24 10:51 ` Lars K.W. Gohlke
-- strict thread matches above, loose matches on Subject: below --
2007-06-05 7:55 Lars K.W. Gohlke
2007-06-07 22:27 Lars K.W. Gohlke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46666FD8.9010702@gmx.de \
--to=lkwg82@gmx.de \
--cc=huang.ying.caritas@gmail.com \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tilman@imap.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.