From: Dmitry Torokhov <dtor@insightbb.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Vojtech Pavlik <vojtech@ucw.cz>
Subject: Re: Writing a driver for a legacy serial device
Date: Wed, 20 Jun 2007 23:11:32 -0400 [thread overview]
Message-ID: <200706202311.33326.dtor@insightbb.com> (raw)
In-Reply-To: <20070620105648.6d18ad66@hyperion.delvare>
On Wednesday 20 June 2007 04:56, Jean Delvare wrote:
> Hi Dmitry,
>
> Thanks for your answer, very much appreciated.
>
> On Tue, 19 Jun 2007 14:59:34 -0400, Dmitry Torokhov wrote:
> >
> > You need to load serport modue and play with inputattach utility.
>
> Ah, I see. There's no way to detect what device is connected to the
> serial port, so we need a user-space tool to bind the port to the right
> driver? Makes some sense, even though it's a but strange that I need
> something called inputattach for a device which isn't an input device.
Because serio interface is mostly used with input devices. For all other
devices I think universal answer is "userspace" but with input devices
we want to do processing in kernel so we can route events into console
and other standard interfaces (although one coudl use uinput to achieve
similar result).
>
> So I've set CONFIG_SERIO_SERPORT=m, compiled and loaded serport. Then I
> added a new protocol number in <linux/serio.h>:
>
> #define SERIO_TAOSEVM 0x40
>
> Then I added the following entry to inputattach and recompiled it:
>
> { "--taos-evm", "-taos", B1200, CS8, SERIO_TAOSEVM, 0, 0, 0, NULL },
>
> Then I changed my driver code to:
>
> static struct serio_device_id taos_serio_ids[] = {
> {
> .type = SERIO_RS232,
> .proto = SERIO_TAOSEVM,
> .id = SERIO_ANY,
> .extra = SERIO_ANY,
> },
> { 0 }
> };
>
> And lastly I ran, as root:
>
> ./inputattach -taos /dev/ttyS0
>
> I see the following line in the logs as a result:
>
> serio: Serial port ttyS0
>
> But unfortunately, my driver's .connect function is still not called.
> I guess that I missed one step? Any idea what it would be?
>
Not sure. Could you check /sys/bus/serio/devices/serioX/id/* and verify
that inputattach sets up serio port properly?
--
Dmitry
next prev parent reply other threads:[~2007-06-21 3:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-19 17:05 Writing a driver for a legacy serial device Jean Delvare
2007-06-19 18:59 ` Dmitry Torokhov
2007-06-20 8:56 ` Jean Delvare
2007-06-21 3:11 ` Dmitry Torokhov [this message]
2007-06-21 9:33 ` Jean Delvare
2007-06-21 14:47 ` David Woodhouse
2007-06-21 18:38 ` Jean Delvare
2007-06-21 23:31 ` Arnd Bergmann
2007-06-22 19:47 ` Dmitry Torokhov
2007-06-23 8:34 ` Jean Delvare
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=200706202311.33326.dtor@insightbb.com \
--to=dtor@insightbb.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@ucw.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox