Thread (5 messages) flat view 5 messages, 2 authors, 2011-10-08

Re: Busted keyboard, fix, and Question about default HID device plumbing

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-10-08 00:25:32

On Fri, Oct 07, 2011 at 04:01:19PM -0700, Terry Lambert wrote:
Thanks for replying, Dmitry...

I guess I need to clarify a point or two.

On Fri, Oct 7, 2011 at 3:07 PM, Dmitry Torokhov
[off-list ref] wrote:
quoted
Hi Terry,

On Fri, Oct 07, 2011 at 01:44:29PM -0700, Terry Lambert wrote:
quoted
I have a USB keyboard that needs a workaround.  I know what the
workaround is, but not where to plumb it in.

This is apparently an issue with a number of keyboards from a number
of vendors, and Mac OS X and Windows both work around it.  It impacts
all Linux desktops, Android, and Chrome OS for a number of popular
folding keyboards, as well as other keyboards.

I'm perfectly able to write the workaround, and have done so using the
boot protocol, but now I want to fix the issue in the default stack
used for the console.

I don't care about the UHCI/EHCI plumbing, or anything up to hiddev;
but from there it gets murky as to how an event in the raw driver ends
up getting turned into a keyboard key.  It appears to be lost in
callbacks I'm having a hard time tracing through.

I've read three books on the Linux USB system, two of them very out of
date, and they're all written from the perspective of "So, you want to
write a device driver", rather than the perspective of "This book
documents the plumbing between the driver and userspace and how to
figure it out".

So the question is: how are things plumbed between hiddev and the
console driver,

They aren't. Or maybe we are talking about different "hiddev"s. The
generic HID driver binds devices to hid-input which registers them with
input core as separate input devices. The legacy console registers a
separate input handler (see drivers/tty/vt/keyboard.c) that binds to all
keyboard-like devices, listens to input events and converts them to
keystrokes and sends them to tty.
My question is "who processes USB report packets from a USB keyboard
into EV_KEY events?"
drivers/hid/hid-input.c
I understand that there's a separate evdev handler that publishes raw
events as /dev/input/eventX.  It's handling the events from somewhere,
but it's not clear to me how a hidraw1 event turns into a console
input event.

Somewhere someone is translating a USB 1.11 section 8.3 report into an
EV_KEY, and I need to do the modifier magic to alter the contents of
the reports before it gets to whoever that is.
You seem to be saying hid-input.c ... but I'm not seeing the modifier
bits being processed out of the report?
I do not believe we pay attention to these modifier bits as we keep
track of keys pressed ourselves (and keys could be remapped anyway).

Anyway, it looks like the devicde should not be reportign LeftShift
together with 1 in the 2nd report as it makes hhid-input think that
(accounding to the rules of 8.3) it is being released.

I wonder if the fix is to not replrt released when we get newly pressed
keys in the report.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help