Re: QUESTION: How can I make a driver for a special serialkeyboard which also supports output (maybe via serio_raw)?

From: Dmitry Torokhov
Date: Tue May 27 2008 - 08:53:44 EST


Hi,

On Sun, May 25, 2008 at 06:52:26PM +0200, N?stor Amigo Cairo wrote:
> Hello!
>
> I'm trying to make a driver for a special keyboard with just three keys, for
> an embedded application. This really is a PIC attached to a serial interface
> which sends some bytes to the computer to manage an application, and then
> receives some others to control an embedded device using the same cable. So
> there's a two way connection between them.
> For now, I have been able to customize the newtonkbd driver to adapt it to
> receive some bytes and translate them to keys, but I'm not able to send any
> data. /dev/ttyS0 gets blocked when setting up the driver with a customized
> version of `inputattach`, an application which ioctl's the serial device to
> the driver. Write() does not work, since it's not implemented in the driver.
> Is there any way of implementing access to this device using the same
> Write() calls as in other apps?
> Or is there any other way of doing it?? Some documentation??
>

You would need to implement ->event() handler in your 'keyboard' that
would call serio->write() on the underlying serio port. Then, by
opening /dev/input/eventX and writing into it you can send input
events back to the device.

Although I wonder if your device really useable as a generic
keyboard/button device. You may be better off just using the serial
port from the userspace.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/