On Mon, Sep 01, 2008 at 12:38:56AM +0200, Ângelo Miguel Arrifano wrote: > On Thu, 28 Aug 2008 14:40:55 +0100 > Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote: > + else if (event == QUICKSTART_EVENT_RUNTIME) { > + input_report_key(quickstart_input, quickstart->btn->id, 1); > + input_sync(quickstart_input); > + input_report_key(quickstart_input, quickstart->btn->id, 0); > + input_sync(quickstart_input); > > The button usage ID is used as key code. Right, that's probably not how you want to do it. Keycodes should be the things in include/linux/input.h. The problem you have is that there's no way of mapping the usage ID to the keycode without knowing the specific laptop layout. The right way of doing this is to use the usage ID as a scancode, and then implement the get and setkeycode functions. Userspace can then alter the keymap. Check the wistron_btns driver for an example of this. > Buffer dump: > QBTN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 > DBTN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 > MUBN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 > PIBN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 > WEBN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 > LVBN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 > VOBN: 03 00 00 00 01 00 00 00 58 78 6c 4c 00 81 ff ff 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 > +---------------------+ > Does it return a QWORD?? Why is it at the end of the buffer? This is the raw dump of what GHID returns? I'm not quite clear on what's going on here. > + /* <<The GHID method can return a BYTE, WORD, or DWORD. > + * The value must be encoded in little-endian byte > + * order (least significant byte first).>> */ > + ACPI_MOVE_32_TO_32(&usageid, buffer.pointer + (buffer.length - 8)); > + quickstart->btn->id = usageid; > > I need your help in here, I doubt this code runs for anyone but me. Right. For instance, GHID on another system I have here is just: Method (GHID, 0, NotSerialized) { Acquire (MUT1, 0xFFFF) And (MBTB, 0x02, Local0) Release (MUT1) If (Local0) { Notify (DAL2, 0x02) } Return (Buffer (One) { 0x02 }) which doesn't look like your code would cope at all. -- Matthew Garrett | mjg59@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html