lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 May 2008 19:27:14 +0200
From:	"Néstor Amigo Cairo" <nestorac@...il.com>
To:	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: Fwd: QUESTION: How can I make a driver for a special serial keyboard which also supports output (maybe via serio_raw)?

---------- Forwarded message ----------
From: Néstor Amigo Cairo <nestorac@...il.com>
Date: 2008/5/27
Subject: Re: QUESTION: How can I make a driver for a special serial
keyboard which also supports output (maybe via serio_raw)?
To: Dmitry Torokhov <dmitry.torokhov@...il.com>, Linux Kernel Mailing
List <linux-kernel@...r.kernel.org>


Thanks!! I'm going to do so right now. I send you my current work, as
you can see, I'm adapting an existing driver for this purpose. I would
really appreciate it if you take a look and tell me if I'm doing
right/wrong. I haven't been able to implement write function yet, any
advice would be very helpful also. I'm also sending some schema to
explain me better, but I think you fully understood my ideas.

I hope this time message will arrive also to LKML, everyone's invited
to comment!!

2008/5/27 Dmitry Torokhov <dmitry.torokhov@...il.com>:
>
> 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.

If the serial device is able to work as a keyboard, and also receive
some data from the application via /dev/input/eventX, that would be
perfect!! That's exactly what I was thinking on.
>
>
> 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.

I have been thinking on it, but it's easier to reimplement some
widgets on Qt for just three keys (I can reuse them easily because of
OOP), than managing focus on every widget communicating the
application directly with the serial port (I've been using a switch
structure for this purpose, which is not very kindly). I saw the
device as a keyboard with just three keys and which can also receive
some bytes from the application. This makes debugging and testing much
easier than dealing directly with the serial interface for changing
the focus and managing the application. The only problem is that a
driver must be written for the device, but my long-term idea is to
write some kind of programmable driver, so it could be reused easily
(by instance, assigning a matrix of values to binary data sent to the
serial port, and converting those bytes into Keys using these values,
as in the original driver, but allowing userspace apps to change this
behaviour). I'm not sure if it would be helpful for anyone else. And I
also lack any knowledge of the kernel internals, as you can see.

>
> --
> Dmitry



--
Néstor Amigo Cairo
+34 687 96 74 81
nestorac@...il.com


--
Néstor Amigo Cairo
+34 687 96 74 81
nestorac@...il.com

Download attachment "esquema.png" of type "image/png" (57686 bytes)

View attachment "serenc.c" of type "text/x-csrc" (5898 bytes)

Download attachment "Makefile" of type "application/octet-stream" (167 bytes)

View attachment "inputattach.c" of type "text/x-csrc" (9192 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ