Hi, back again with a patch for the quickstart driver that implements a keymap for the runtime events that quickstart generates. A custom keymap can be assigned via a simple udev rule. Background for this: Fujitsu is going to ship very small systems with no direct eject button for the optical drive. Instead you have a hotkey that is recognized by the quickstart driver. This patch now allows to map the key event (0x1) to the keycode "ejectcd" and then react to this in your desktop manager software. Signed-off-by: Rainer Koenig <Rainer.Koenig@xxxxxxxxxxxxxx> --- upstream/drivers/staging/quickstart/quickstart.c 2012-03-19 08:25:33.000000000 +0100 +++ new/drivers/staging/quickstart/quickstart.c 2012-03-19 09:03:02.000000000 +0100 @@ -216,6 +216,8 @@ static void quickstart_acpi_notify(acpi_handle handle, u32 event, void *data) { struct quickstart_acpi *quickstart = data; + unsigned int key; + struct input_keymap_entry ke; if (!quickstart) return; @@ -223,9 +225,13 @@ if (event == QUICKSTART_EVENT_WAKE) quickstart_data.pressed = quickstart->btn; else if (event == QUICKSTART_EVENT_RUNTIME) { - input_report_key(quickstart_input, quickstart->btn->id, 1); + ke.flags = INPUT_KEYMAP_BY_INDEX; + ke.index = quickstart->btn->id; + quickstart_input->getkeycode(quickstart_input, &ke); + key = ke.keycode; + input_report_key(quickstart_input, key, 1); input_sync(quickstart_input); - input_report_key(quickstart_input, quickstart->btn->id, 0); + input_report_key(quickstart_input, key, 0); input_sync(quickstart_input); } return; @@ -374,8 +380,9 @@ static int __init quickstart_init_input(void) { struct quickstart_btn **ptr = &quickstart_data.btn_lst; - int count; int ret; + int maxkey = 0, id; + unsigned int *keymap; quickstart_input = input_allocate_device(); @@ -386,11 +393,30 @@ quickstart_input->id.bustype = BUS_HOST; while (*ptr) { - count++; set_bit(EV_KEY, quickstart_input->evbit); set_bit((*ptr)->id, quickstart_input->keybit); + if ((*ptr)->id > maxkey) + maxkey = (*ptr)->id; ptr = &((*ptr)->next); } + + /* build a character map that at the moment maps GHID ids to keycodes */ + /* this map can be replaced from userspace to map the correct keycodes */ + maxkey++; + quickstart_input->keycodemax = maxkey; + quickstart_input->keycodesize = sizeof(unsigned int); + quickstart_input->keycode = kzalloc(quickstart_input->keycodemax*quickstart_input->keycodesize, GFP_KERNEL); + if (!quickstart_input->keycode) + return -ENOMEM; + + keymap = quickstart_input->keycode; + + ptr = &quickstart_data.btn_lst; + while(*ptr) { + id = (*ptr)->id; + keymap[id] = id; + ptr = &((*ptr)->next); + } ret = input_register_device(quickstart_input); if (ret) { -- Dipl.-Inf. (FH) Rainer Koenig Project Manager Linux Clients Dept. PDG WPS R&D SW OSE Fujitsu Technology Solutions Bürgermeister-Ullrich-Str. 100 86199 Augsburg Germany Telephone: +49-821-804-3321 Telefax: +49-821-804-2131 Mail: mailto:Rainer.Koenig@xxxxxxxxxxxxxx Internet ts.fujtsu.com Company Details ts.fujitsu.com/imprint.html -- 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