lkml.org 
[lkml]   [2007]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Writing a driver for a legacy serial device
Date
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-06-21 05:13    [from the cache]
©2003-2011 Jasper Spaans