input/powermac: Cleanup of mac_hid and support for ctrl+click and command+click
This patch cleans up mac_hid and adds support for Ctrl+Click (right click) and Command+Click (middle click) emulation. The latter is similar to Mac OS X.
Signed-off-by Michael Hanselmann <[email protected]>
---
drivers/char/keyboard.c +5 -5
@@ -40,6 +40,10 @@#include <linux/sysrq.h> #include <linux/input.h> +#ifdef CONFIG_MAC_EMUMOUSEBTN +#include <asm/mac_hid.h> +#endif +static void kbd_disconnect (struct input_handle *handle);extern void ctrl_alt_del (void );
@@ -1052,10 +1056,6 @@ static unsigned short x86_keycodes[256]308 ,310 ,313 ,314 ,315 ,317 ,318 ,319 ,320 ,357 ,322 ,323 ,324 ,325 ,276 ,330 , 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; -#ifdef CONFIG_MAC_EMUMOUSEBTN -extern int mac_hid_mouse_emulate_buttons (int ,int ,int ); -#endif /* CONFIG_MAC_EMUMOUSEBTN */ -#ifdef CONFIG_SPARC static int sparc_l1_a_state =0 ;extern void sun_do_break (void );
@@ -1151,7 +1151,7 @@ static void kbd_keycode(unsigned int key rep = (down ==2 );#ifdef CONFIG_MAC_EMUMOUSEBTN -if (mac_hid_mouse_emulate_buttons (1 , keycode, down)) +if (mac_hid_mouse_emulate_buttons (keycode, down))return ;#endif /* CONFIG_MAC_EMUMOUSEBTN */
drivers/input/input.c +14 -2
@@ -24,6 +24,10 @@#include <linux/device.h> #include <linux/mutex.h> +#ifdef CONFIG_MAC_EMUMOUSEBTN +#include <asm/mac_hid.h> +#endif +MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Input core" );MODULE_LICENSE ("GPL" );
@@ -194,8 +198,16 @@ static void input_repeat_key(unsigned loif (!test_bit (dev->repeat_key, dev->key))return ; -input_event (dev,EV_KEY , dev->repeat_key,2 ); -input_sync (dev); +#ifdef CONFIG_MAC_EMUMOUSEBTN +if (!mac_hid_repeat_key (dev->repeat_key)) { +#endif + +input_event (dev,EV_KEY , dev->repeat_key,2 ); +input_sync (dev); + +#ifdef CONFIG_MAC_EMUMOUSEBTN + } +#endif if (dev->rep[REP_PERIOD ])mod_timer (&dev->timer, jiffies +msecs_to_jiffies (dev->rep[REP_PERIOD ]));
drivers/input/mousedev.c +8 -1
@@ -27,6 +27,9 @@#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX #include <linux/miscdevice.h> #endif +#ifdef CONFIG_MAC_EMUMOUSEBTN +#include <asm/mac_hid.h> +#endif MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>" );MODULE_DESCRIPTION ("Mouse (ExplorerPS/2) device interfaces" );
@@ -316,8 +319,12 @@ static void mousedev_event(struct input_if (value !=2 ) {if (code ==BTN_TOUCH &&test_bit (BTN_TOOL_FINGER , handle->dev->keybit))mousedev_touchpad_touch (mousedev, value); -else +else { +#ifdef CONFIG_MAC_EMUMOUSEBTN + code =mac_hid_mouse_click (code, value); +#endif mousedev_key_event (mousedev, code, value); + } }break ;
drivers/macintosh/Kconfig +4 -0
@@ -144,6 +144,10 @@ config MAC_EMUMOUSEBTN /proc/sys/dev/mac_hid/mouse_button_emulation /proc/sys/dev/mac_hid/mouse_button2_keycode /proc/sys/dev/mac_hid/mouse_button3_keycode + /proc/sys/dev/mac_hid/key_click + + When key_click is enabled by writing a value other than 0 into it, + Ctrl+Click is for right click and Command+Click for middle click. If you have an Apple machine with a 1-button mouse, say Y here.
drivers/macintosh/mac_hid.c +103 -37
190 lines not on this page · raw message
include/asm-powerpc/mac_hid.h +13 -0
@@ -0,0 +1,13 @@ +/* +* HID support stuff for Macintosh computers. +*/ +#ifndef __ASM_POWERPC_MAC_HID_H +#define __ASM_POWERPC_MAC_HID_H +#ifdef __KERNEL__ + +extern int mac_hid_mouse_emulate_buttons (unsigned int keycode,int down); +extern int mac_hid_mouse_click (unsigned int code,int value); +extern int mac_hid_repeat_key (unsigned int keycode); + +#endif +#endif
include/linux/sysctl.h +2 -1
@@ -870,7 +870,8 @@ enum {DEV_MAC_HID_MOUSE_BUTTON_EMULATION =3 ,DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE =4 ,DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE =5 , - DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 +DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES =6 , + DEV_MAC_HID_KEY_CLICK=7, };/* /proc/sys/dev/scsi */