You make a very good point on the key remapping. ... Are we sure that there isn't a field in the keyboard information in the USB that reports the keyboard does this? The only other alternative seems to be to quirk the keyboard as reporting keys down when they are down, up when they are up, and generating pseudo events for "keycode not present in report". I guess I'm willing to write a "hosed keyboard driver" driver if necessary. This apparently effects about 5-10% of keyboards, predominantly laptops with internal USB (some dell inspiron, some samsung), and the folding keyboards people like to use with android tablets. I'm willing to take any advice about where I can get a handle on all the keys in a given report to implement a general quirk on this hardware. If necessary, we can always write a driver, I suppose, if you can point me at an example? Thanks, -- Terry On Fri, Oct 7, 2011 at 5:25 PM, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote: > > 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 > > <dmitry.torokhov@xxxxxxxxx> wrote: > > > > > > Hi Terry, > > > > > > On Fri, Oct 07, 2011 at 01:44:29PM -0700, Terry Lambert wrote: > > > > 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html