aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-30 04:44:20 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-30 04:48:03 -0500
commit429722e19dff319aa87ee552beadee71d41a3655 (patch)
treeb0d760de09f128ae674b0f318386e5cefd0758c3 /drivers
parent99b089c3c38a83ebaeb1cc4584ddcde841626467 (diff)
Input: Mac button emulation - allow compiling as a module
Not all systems require Mac-style button emulation, however distributions enable it by default so it is readily available. Allow compiling it as a module so it can be loaded only on systems that actually require it. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/macintosh/Kconfig8
-rw-r--r--drivers/macintosh/mac_hid.c13
2 files changed, 16 insertions, 5 deletions
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index aa3c27e5255d..fd85bde283a0 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -171,9 +171,8 @@ config INPUT_ADBHID
171 If unsure, say Y. 171 If unsure, say Y.
172 172
173config MAC_EMUMOUSEBTN 173config MAC_EMUMOUSEBTN
174 bool "Support for mouse button 2+3 emulation" 174 tristate "Support for mouse button 2+3 emulation"
175 depends on SYSCTL 175 depends on SYSCTL && INPUT
176 select INPUT
177 help 176 help
178 This provides generic support for emulating the 2nd and 3rd mouse 177 This provides generic support for emulating the 2nd and 3rd mouse
179 button with keypresses. If you say Y here, the emulation is still 178 button with keypresses. If you say Y here, the emulation is still
@@ -185,6 +184,9 @@ config MAC_EMUMOUSEBTN
185 184
186 If you have an Apple machine with a 1-button mouse, say Y here. 185 If you have an Apple machine with a 1-button mouse, say Y here.
187 186
187 To compile this driver as a module, choose M here: the
188 module will be called mac_hid.
189
188config THERM_WINDTUNNEL 190config THERM_WINDTUNNEL
189 tristate "Support for thermal management on Windtunnel G4s" 191 tristate "Support for thermal management on Windtunnel G4s"
190 depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64 192 depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 0b210a90aef5..e943d2a29253 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -14,6 +14,8 @@
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/module.h> 15#include <linux/module.h>
16 16
17MODULE_LICENSE("GPL");
18
17static int mouse_emulate_buttons; 19static int mouse_emulate_buttons;
18static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ 20static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
19static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ 21static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
@@ -252,7 +254,6 @@ static ctl_table mac_hid_root_dir[] = {
252 254
253static struct ctl_table_header *mac_hid_sysctl_header; 255static struct ctl_table_header *mac_hid_sysctl_header;
254 256
255
256static int __init mac_hid_init(void) 257static int __init mac_hid_init(void)
257{ 258{
258 mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir); 259 mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir);
@@ -261,5 +262,13 @@ static int __init mac_hid_init(void)
261 262
262 return 0; 263 return 0;
263} 264}
265module_init(mac_hid_init);
264 266
265device_initcall(mac_hid_init); 267static void __exit mac_hid_exit(void)
268{
269 unregister_sysctl_table(mac_hid_sysctl_header);
270
271 if (mouse_emulate_buttons)
272 mac_hid_stop_emulation();
273}
274module_exit(mac_hid_exit);