Loading...
1/*
2 * Asus Notebooks WMI hotkey driver
3 *
4 * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/init.h>
26#include <linux/input.h>
27#include <linux/input/sparse-keymap.h>
28
29#include "asus-wmi.h"
30
31#define ASUS_NB_WMI_FILE "asus-nb-wmi"
32
33MODULE_AUTHOR("Corentin Chary <corentincj@iksaif.net>");
34MODULE_DESCRIPTION("Asus Notebooks WMI Hotkey Driver");
35MODULE_LICENSE("GPL");
36
37#define ASUS_NB_WMI_EVENT_GUID "0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C"
38
39MODULE_ALIAS("wmi:"ASUS_NB_WMI_EVENT_GUID);
40
41/*
42 * WAPF defines the behavior of the Fn+Fx wlan key
43 * The significance of values is yet to be found, but
44 * most of the time:
45 * Bit | Bluetooth | WLAN
46 * 0 | Hardware | Hardware
47 * 1 | Hardware | Software
48 * 4 | Software | Software
49 */
50static uint wapf;
51module_param(wapf, uint, 0444);
52MODULE_PARM_DESC(wapf, "WAPF value");
53
54static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
55{
56 driver->wapf = wapf;
57}
58
59static const struct key_entry asus_nb_wmi_keymap[] = {
60 { KE_KEY, 0x30, { KEY_VOLUMEUP } },
61 { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
62 { KE_KEY, 0x32, { KEY_MUTE } },
63 { KE_KEY, 0x33, { KEY_DISPLAYTOGGLE } }, /* LCD on */
64 { KE_KEY, 0x34, { KEY_DISPLAY_OFF } }, /* LCD off */
65 { KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
66 { KE_KEY, 0x41, { KEY_NEXTSONG } },
67 { KE_KEY, 0x43, { KEY_STOPCD } },
68 { KE_KEY, 0x45, { KEY_PLAYPAUSE } },
69 { KE_KEY, 0x4c, { KEY_MEDIA } },
70 { KE_KEY, 0x50, { KEY_EMAIL } },
71 { KE_KEY, 0x51, { KEY_WWW } },
72 { KE_KEY, 0x55, { KEY_CALC } },
73 { KE_KEY, 0x5C, { KEY_F15 } }, /* Power Gear key */
74 { KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
75 { KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
76 { KE_KEY, 0x5F, { KEY_WLAN } }, /* Wireless console Disable */
77 { KE_KEY, 0x60, { KEY_SWITCHVIDEOMODE } },
78 { KE_KEY, 0x61, { KEY_SWITCHVIDEOMODE } },
79 { KE_KEY, 0x62, { KEY_SWITCHVIDEOMODE } },
80 { KE_KEY, 0x63, { KEY_SWITCHVIDEOMODE } },
81 { KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } },
82 { KE_KEY, 0x7D, { KEY_BLUETOOTH } },
83 { KE_KEY, 0x7E, { KEY_BLUETOOTH } },
84 { KE_KEY, 0x82, { KEY_CAMERA } },
85 { KE_KEY, 0x88, { KEY_RFKILL } },
86 { KE_KEY, 0x8A, { KEY_PROG1 } },
87 { KE_KEY, 0x95, { KEY_MEDIA } },
88 { KE_KEY, 0x99, { KEY_PHONE } },
89 { KE_KEY, 0xb5, { KEY_CALC } },
90 { KE_KEY, 0xc4, { KEY_KBDILLUMUP } },
91 { KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
92 { KE_END, 0},
93};
94
95static struct asus_wmi_driver asus_nb_wmi_driver = {
96 .name = ASUS_NB_WMI_FILE,
97 .owner = THIS_MODULE,
98 .event_guid = ASUS_NB_WMI_EVENT_GUID,
99 .keymap = asus_nb_wmi_keymap,
100 .input_name = "Asus WMI hotkeys",
101 .input_phys = ASUS_NB_WMI_FILE "/input0",
102 .quirks = asus_nb_wmi_quirks,
103};
104
105
106static int __init asus_nb_wmi_init(void)
107{
108 return asus_wmi_register_driver(&asus_nb_wmi_driver);
109}
110
111static void __exit asus_nb_wmi_exit(void)
112{
113 asus_wmi_unregister_driver(&asus_nb_wmi_driver);
114}
115
116module_init(asus_nb_wmi_init);
117module_exit(asus_nb_wmi_exit);
1/*
2 * Asus Notebooks WMI hotkey driver
3 *
4 * Copyright(C) 2010 Corentin Chary <corentin.chary@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/init.h>
26#include <linux/input.h>
27#include <linux/input/sparse-keymap.h>
28#include <linux/fb.h>
29
30#include "asus-wmi.h"
31
32#define ASUS_NB_WMI_FILE "asus-nb-wmi"
33
34MODULE_AUTHOR("Corentin Chary <corentincj@iksaif.net>");
35MODULE_DESCRIPTION("Asus Notebooks WMI Hotkey Driver");
36MODULE_LICENSE("GPL");
37
38#define ASUS_NB_WMI_EVENT_GUID "0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C"
39
40MODULE_ALIAS("wmi:"ASUS_NB_WMI_EVENT_GUID);
41
42/*
43 * WAPF defines the behavior of the Fn+Fx wlan key
44 * The significance of values is yet to be found, but
45 * most of the time:
46 * Bit | Bluetooth | WLAN
47 * 0 | Hardware | Hardware
48 * 1 | Hardware | Software
49 * 4 | Software | Software
50 */
51static uint wapf;
52module_param(wapf, uint, 0444);
53MODULE_PARM_DESC(wapf, "WAPF value");
54
55static struct quirk_entry quirk_asus_unknown = {
56};
57
58static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
59{
60 driver->quirks = &quirk_asus_unknown;
61 driver->quirks->wapf = wapf;
62 driver->panel_power = FB_BLANK_UNBLANK;
63}
64
65static const struct key_entry asus_nb_wmi_keymap[] = {
66 { KE_KEY, 0x30, { KEY_VOLUMEUP } },
67 { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
68 { KE_KEY, 0x32, { KEY_MUTE } },
69 { KE_KEY, 0x33, { KEY_DISPLAYTOGGLE } }, /* LCD on */
70 { KE_KEY, 0x34, { KEY_DISPLAY_OFF } }, /* LCD off */
71 { KE_KEY, 0x40, { KEY_PREVIOUSSONG } },
72 { KE_KEY, 0x41, { KEY_NEXTSONG } },
73 { KE_KEY, 0x43, { KEY_STOPCD } },
74 { KE_KEY, 0x45, { KEY_PLAYPAUSE } },
75 { KE_KEY, 0x4c, { KEY_MEDIA } },
76 { KE_KEY, 0x50, { KEY_EMAIL } },
77 { KE_KEY, 0x51, { KEY_WWW } },
78 { KE_KEY, 0x55, { KEY_CALC } },
79 { KE_IGNORE, 0x57, }, /* Battery mode */
80 { KE_IGNORE, 0x58, }, /* AC mode */
81 { KE_KEY, 0x5C, { KEY_F15 } }, /* Power Gear key */
82 { KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
83 { KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
84 { KE_KEY, 0x5F, { KEY_WLAN } }, /* Wireless console Disable */
85 { KE_KEY, 0x60, { KEY_SWITCHVIDEOMODE } },
86 { KE_KEY, 0x61, { KEY_SWITCHVIDEOMODE } },
87 { KE_KEY, 0x62, { KEY_SWITCHVIDEOMODE } },
88 { KE_KEY, 0x63, { KEY_SWITCHVIDEOMODE } },
89 { KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } },
90 { KE_KEY, 0x7D, { KEY_BLUETOOTH } },
91 { KE_KEY, 0x7E, { KEY_BLUETOOTH } },
92 { KE_KEY, 0x82, { KEY_CAMERA } },
93 { KE_KEY, 0x88, { KEY_RFKILL } },
94 { KE_KEY, 0x8A, { KEY_PROG1 } },
95 { KE_KEY, 0x95, { KEY_MEDIA } },
96 { KE_KEY, 0x99, { KEY_PHONE } },
97 { KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
98 { KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
99 { KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
100 { KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */
101 { KE_KEY, 0xb5, { KEY_CALC } },
102 { KE_KEY, 0xc4, { KEY_KBDILLUMUP } },
103 { KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
104 { KE_END, 0},
105};
106
107static struct asus_wmi_driver asus_nb_wmi_driver = {
108 .name = ASUS_NB_WMI_FILE,
109 .owner = THIS_MODULE,
110 .event_guid = ASUS_NB_WMI_EVENT_GUID,
111 .keymap = asus_nb_wmi_keymap,
112 .input_name = "Asus WMI hotkeys",
113 .input_phys = ASUS_NB_WMI_FILE "/input0",
114 .detect_quirks = asus_nb_wmi_quirks,
115};
116
117
118static int __init asus_nb_wmi_init(void)
119{
120 return asus_wmi_register_driver(&asus_nb_wmi_driver);
121}
122
123static void __exit asus_nb_wmi_exit(void)
124{
125 asus_wmi_unregister_driver(&asus_nb_wmi_driver);
126}
127
128module_init(asus_nb_wmi_init);
129module_exit(asus_nb_wmi_exit);