Re: Input driver for Twinhan USB 6253:0100 remote control

From: Jiri Kosina
Date: Mon Jul 13 2009 - 07:21:30 EST


On Mon, 13 Jul 2009, Bruno Prémont wrote:

> > > + // set_bit(EV_REP, hi->input->evbit);
> > Why is this commented out?
> That was a remaining line from basing on hid-gyration.c Don't know what
> it does, looks like related to key repeating but I've not read enough of
> HID/Input code to find out. (all my tests were run with it commented
> out, so I will drop it unless there is a good reason to uncomment it)

Yes, EV_REP is a flag which signals whether the keys produced by the
device in question should be auto-repreated.

> With my patch it seems the mappings don't show up for EVIOCGKEYCODE:
>
> int codes[2];
> for (codes[0] = 0; codes[0] < 1024; codes[0]++)
> if (ioctl(evdev, EVIOCGKEYCODE, codes) >= 0) {
> // display
> } else
> break;
>
> Code block above only displays for codes[0] == 0:
> codes = { 0, 388 /* KEY_TEXT */ }
>
> For all other values of codes[0] ioctl returns EINVAL.
>
> Is this expected or should complete mapping table be returned
> as it is for generic PS2 PC keyboard (if so, what changes does the
> patch need for it)?

The HID core's perception of scancode is the actual HID usage as reported
by the device, inlcuding the page number.

I.e. for your device, the usages would be in 0x70004 - 0x70052 range, not
0-1024 (which is what your current code is checking for).

Also, looking at the patch again -- could you please keep the usage
numbers sorted in the switch-case in twinhan_input_mapping(), so that it's
more readable and compatible with other drivers?

Thanks,

--
Jiri Kosina
SUSE Labs