msi-wmi.c (92f61cbc614fb422759790739cbd3e5a68c9a6fc) | msi-wmi.c (a80e1cd70144fe7727f2e2d838611b6b8cf8a6d5) |
---|---|
1/* 2 * MSI WMI hotkeys 3 * 4 * Copyright (C) 2009 Novell <trenn@suse.de> 5 * 6 * Most stuff taken over from hp-wmi 7 * 8 * This program is free software; you can redistribute it and/or modify --- 29 unchanged lines hidden (view full) --- 38#define DRV_NAME "msi-wmi" 39#define DRV_PFX DRV_NAME ": " 40 41#define MSIWMI_BIOS_GUID "551A1F84-FBDD-4125-91DB-3EA8F44F1D45" 42#define MSIWMI_EVENT_GUID "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2" 43 44#define dprintk(msg...) pr_debug(DRV_PFX msg) 45 | 1/* 2 * MSI WMI hotkeys 3 * 4 * Copyright (C) 2009 Novell <trenn@suse.de> 5 * 6 * Most stuff taken over from hp-wmi 7 * 8 * This program is free software; you can redistribute it and/or modify --- 29 unchanged lines hidden (view full) --- 38#define DRV_NAME "msi-wmi" 39#define DRV_PFX DRV_NAME ": " 40 41#define MSIWMI_BIOS_GUID "551A1F84-FBDD-4125-91DB-3EA8F44F1D45" 42#define MSIWMI_EVENT_GUID "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2" 43 44#define dprintk(msg...) pr_debug(DRV_PFX msg) 45 |
46#define KEYCODE_BASE 0xD0 47#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE 48#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) 49#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) 50#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) 51#define MSI_WMI_MUTE (KEYCODE_BASE + 4) | 46#define SCANCODE_BASE 0xD0 47#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE 48#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) 49#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2) 50#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3) 51#define MSI_WMI_MUTE (SCANCODE_BASE + 4) |
52static struct key_entry msi_wmi_keymap[] = { 53 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 54 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 55 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 56 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 57 { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, 58 { KE_END, 0} 59}; --- 106 unchanged lines hidden (view full) --- 166 int eventcode = obj->integer.value; 167 dprintk("Eventcode: 0x%x\n", eventcode); 168 key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev, 169 eventcode); 170 if (key) { 171 ktime_t diff; 172 cur = ktime_get_real(); 173 diff = ktime_sub(cur, last_pressed[key->code - | 52static struct key_entry msi_wmi_keymap[] = { 53 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 54 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 55 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 56 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 57 { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, 58 { KE_END, 0} 59}; --- 106 unchanged lines hidden (view full) --- 166 int eventcode = obj->integer.value; 167 dprintk("Eventcode: 0x%x\n", eventcode); 168 key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev, 169 eventcode); 170 if (key) { 171 ktime_t diff; 172 cur = ktime_get_real(); 173 diff = ktime_sub(cur, last_pressed[key->code - |
174 KEYCODE_BASE]); | 174 SCANCODE_BASE]); |
175 /* Ignore event if the same event happened in a 50 ms 176 timeframe -> Key press may result in 10-20 GPEs */ 177 if (ktime_to_us(diff) < 1000 * 50) { 178 dprintk("Suppressed key event 0x%X - " 179 "Last press was %lld us ago\n", 180 key->code, ktime_to_us(diff)); 181 return; 182 } | 175 /* Ignore event if the same event happened in a 50 ms 176 timeframe -> Key press may result in 10-20 GPEs */ 177 if (ktime_to_us(diff) < 1000 * 50) { 178 dprintk("Suppressed key event 0x%X - " 179 "Last press was %lld us ago\n", 180 key->code, ktime_to_us(diff)); 181 return; 182 } |
183 last_pressed[key->code - KEYCODE_BASE] = cur; | 183 last_pressed[key->code - SCANCODE_BASE] = cur; |
184 185 if (key->type == KE_KEY && 186 /* Brightness is served via acpi video driver */ 187 (!acpi_video_backlight_support() || 188 (key->code != MSI_WMI_BRIGHTNESSUP && 189 key->code != MSI_WMI_BRIGHTNESSDOWN))) { 190 dprintk("Send key: 0x%X - " 191 "Input layer keycode: %d\n", key->code, --- 105 unchanged lines hidden --- | 184 185 if (key->type == KE_KEY && 186 /* Brightness is served via acpi video driver */ 187 (!acpi_video_backlight_support() || 188 (key->code != MSI_WMI_BRIGHTNESSUP && 189 key->code != MSI_WMI_BRIGHTNESSDOWN))) { 190 dprintk("Send key: 0x%X - " 191 "Input layer keycode: %d\n", key->code, --- 105 unchanged lines hidden --- |