patch-2.1.97 linux/drivers/macintosh/mac_keyb.c

Next file: linux/drivers/macintosh/macio-adb.c
Previous file: linux/drivers/macintosh/imstt.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.96/linux/drivers/macintosh/mac_keyb.c linux/drivers/macintosh/mac_keyb.c
@@ -15,8 +15,8 @@
 #include <linux/mm.h>
 #include <linux/signal.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 
-#include <asm/keyboard.h>
 #include <asm/bitops.h>
 #include <asm/adb.h>
 #include <asm/cuda.h>
@@ -28,6 +28,140 @@
 #define KEYB_LEDREG	2	/* register # for leds on ADB keyboard */
 #define MOUSE_DATAREG	0	/* reg# for movement/button codes from mouse */
 
+static u_short macplain_map[NR_KEYS] = __initdata {
+	0xfb61,	0xfb73,	0xfb64,	0xfb66,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
+	0xfb63,	0xfb76,	0xf200,	0xfb62,	0xfb71,	0xfb77,	0xfb65,	0xfb72,
+	0xfb79,	0xfb74,	0xf031,	0xf032,	0xf033,	0xf034,	0xf036,	0xf035,
+	0xf03d,	0xf039,	0xf037,	0xf02d,	0xf038,	0xf030,	0xf05d,	0xfb6f,
+	0xfb75,	0xf05b,	0xfb69,	0xfb70,	0xf201,	0xfb6c,	0xfb6a,	0xf027,
+	0xfb6b,	0xf03b,	0xf05c,	0xf02c,	0xf02f,	0xfb6e,	0xfb6d,	0xf02e,
+	0xf009,	0xf020,	0xf060,	0xf07f,	0xf200,	0xf01b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf104,	0xf105,	0xf106,	0xf102,	0xf107,	0xf108,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf209,	0xf200,	0xf109,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf103,	0xf117,
+	0xf101,	0xf119,	0xf100,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macshift_map[NR_KEYS] __initdata = {
+	0xfb41,	0xfb53,	0xfb44,	0xfb46,	0xfb48,	0xfb47,	0xfb5a,	0xfb58,
+	0xfb43,	0xfb56,	0xf200,	0xfb42,	0xfb51,	0xfb57,	0xfb45,	0xfb52,
+	0xfb59,	0xfb54,	0xf021,	0xf040,	0xf023,	0xf024,	0xf05e,	0xf025,
+	0xf02b,	0xf028,	0xf026,	0xf05f,	0xf02a,	0xf029,	0xf07d,	0xfb4f,
+	0xfb55,	0xf07b,	0xfb49,	0xfb50,	0xf201,	0xfb4c,	0xfb4a,	0xf022,
+	0xfb4b,	0xf03a,	0xf07c,	0xf03c,	0xf03f,	0xfb4e,	0xfb4d,	0xf03e,
+	0xf009,	0xf020,	0xf07e,	0xf07f,	0xf200,	0xf01b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf10e,	0xf10f,	0xf110,	0xf10c,	0xf111,	0xf112,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf203,	0xf200,	0xf113,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf20b,	0xf116,	0xf10d,	0xf117,
+	0xf10b,	0xf20a,	0xf10a,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macaltgr_map[NR_KEYS] __initdata = {
+	0xf914,	0xfb73,	0xf917,	0xf919,	0xfb68,	0xfb67,	0xfb7a,	0xfb78,
+	0xf916,	0xfb76,	0xf200,	0xf915,	0xfb71,	0xfb77,	0xf918,	0xfb72,
+	0xfb79,	0xfb74,	0xf200,	0xf040,	0xf200,	0xf024,	0xf200,	0xf200,
+	0xf200,	0xf05d,	0xf07b,	0xf05c,	0xf05b,	0xf07d,	0xf07e,	0xfb6f,
+	0xfb75,	0xf200,	0xfb69,	0xfb70,	0xf201,	0xfb6c,	0xfb6a,	0xf200,
+	0xfb6b,	0xf200,	0xf200,	0xf200,	0xf200,	0xfb6e,	0xfb6d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf90a,	0xf90b,	0xf90c,	0xf90d,	0xf90e,	0xf90f,
+	0xf910,	0xf911,	0xf200,	0xf912,	0xf913,	0xf200,	0xf200,	0xf200,
+	0xf510,	0xf511,	0xf512,	0xf50e,	0xf513,	0xf514,	0xf200,	0xf516,
+	0xf200,	0xf10c,	0xf200,	0xf202,	0xf200,	0xf515,	0xf200,	0xf517,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf50f,	0xf117,
+	0xf50d,	0xf119,	0xf50c,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macctrl_map[NR_KEYS] __initdata = {
+	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
+	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
+	0xf019,	0xf014,	0xf200,	0xf000,	0xf01b,	0xf01c,	0xf01e,	0xf01d,
+	0xf200,	0xf200,	0xf01f,	0xf01f,	0xf07f,	0xf200,	0xf01d,	0xf00f,
+	0xf015,	0xf01b,	0xf009,	0xf010,	0xf201,	0xf00c,	0xf00a,	0xf007,
+	0xf00b,	0xf200,	0xf01c,	0xf200,	0xf07f,	0xf00e,	0xf00d,	0xf20e,
+	0xf200,	0xf000,	0xf000,	0xf008,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf104,	0xf105,	0xf106,	0xf102,	0xf107,	0xf108,	0xf200,	0xf10a,
+	0xf200,	0xf10c,	0xf200,	0xf204,	0xf200,	0xf109,	0xf200,	0xf10b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf103,	0xf117,
+	0xf101,	0xf119,	0xf100,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macshift_ctrl_map[NR_KEYS] __initdata = {
+	0xf001,	0xf013,	0xf004,	0xf006,	0xf008,	0xf007,	0xf01a,	0xf018,
+	0xf003,	0xf016,	0xf200,	0xf002,	0xf011,	0xf017,	0xf005,	0xf012,
+	0xf019,	0xf014,	0xf200,	0xf000,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf01f,	0xf200,	0xf200,	0xf200,	0xf00f,
+	0xf015,	0xf200,	0xf009,	0xf010,	0xf201,	0xf00c,	0xf00a,	0xf200,
+	0xf00b,	0xf200,	0xf200,	0xf200,	0xf200,	0xf00e,	0xf00d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf10c,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf200,	0xf117,
+	0xf200,	0xf119,	0xf200,	0xf700,	0xf701,	0xf702,	0xf200,	0xf20c,
+};
+
+static u_short macalt_map[NR_KEYS] __initdata = {
+	0xf861,	0xf873,	0xf864,	0xf866,	0xf868,	0xf867,	0xf87a,	0xf878,
+	0xf863,	0xf876,	0xf200,	0xf862,	0xf871,	0xf877,	0xf865,	0xf872,
+	0xf879,	0xf874,	0xf831,	0xf832,	0xf833,	0xf834,	0xf836,	0xf835,
+	0xf83d,	0xf839,	0xf837,	0xf82d,	0xf838,	0xf830,	0xf85d,	0xf86f,
+	0xf875,	0xf85b,	0xf869,	0xf870,	0xf80d,	0xf86c,	0xf86a,	0xf827,
+	0xf86b,	0xf83b,	0xf85c,	0xf82c,	0xf82f,	0xf86e,	0xf86d,	0xf82e,
+	0xf809,	0xf820,	0xf860,	0xf87f,	0xf200,	0xf81b,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf210,	0xf211,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf900,	0xf901,	0xf902,	0xf903,	0xf904,	0xf905,
+	0xf906,	0xf907,	0xf200,	0xf908,	0xf909,	0xf200,	0xf200,	0xf200,
+	0xf504,	0xf505,	0xf506,	0xf502,	0xf507,	0xf508,	0xf200,	0xf50a,
+	0xf200,	0xf10c,	0xf200,	0xf209,	0xf200,	0xf509,	0xf200,	0xf50b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf503,	0xf117,
+	0xf501,	0xf119,	0xf500,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+static u_short macctrl_alt_map[NR_KEYS] __initdata = {
+	0xf801,	0xf813,	0xf804,	0xf806,	0xf808,	0xf807,	0xf81a,	0xf818,
+	0xf803,	0xf816,	0xf200,	0xf802,	0xf811,	0xf817,	0xf805,	0xf812,
+	0xf819,	0xf814,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf80f,
+	0xf815,	0xf200,	0xf809,	0xf810,	0xf201,	0xf80c,	0xf80a,	0xf200,
+	0xf80b,	0xf200,	0xf200,	0xf200,	0xf200,	0xf80e,	0xf80d,	0xf200,
+	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf200,	0xf702,	0xf703,
+	0xf700,	0xf207,	0xf701,	0xf601,	0xf602,	0xf600,	0xf603,	0xf200,
+	0xf200,	0xf310,	0xf200,	0xf30c,	0xf200,	0xf30a,	0xf200,	0xf208,
+	0xf200,	0xf200,	0xf200,	0xf30d,	0xf30e,	0xf200,	0xf30b,	0xf200,
+	0xf200,	0xf200,	0xf300,	0xf301,	0xf302,	0xf303,	0xf304,	0xf305,
+	0xf306,	0xf307,	0xf200,	0xf308,	0xf309,	0xf200,	0xf200,	0xf200,
+	0xf504,	0xf505,	0xf506,	0xf502,	0xf507,	0xf508,	0xf200,	0xf50a,
+	0xf200,	0xf10c,	0xf200,	0xf200,	0xf200,	0xf509,	0xf200,	0xf50b,
+	0xf200,	0xf11d,	0xf115,	0xf114,	0xf118,	0xf116,	0xf503,	0xf117,
+	0xf501,	0xf119,	0xf500,	0xf700,	0xf701,	0xf702,	0xf200,	0xf200,
+};
+
+
 static void kbd_repeat(unsigned long);
 static struct timer_list repeat_timer = { NULL, NULL, 0, 0, kbd_repeat };
 static int last_keycode;
@@ -38,8 +172,7 @@
 
 /* XXX: Hook for mouse driver */
 void (*adb_mouse_interrupt_hook) (char *, int);
-int adb_emulate_button2;
-int adb_emulate_button3;
+static int adb_emulate_buttons = 0;
 extern int console_loglevel;
 
 extern struct kbd_struct kbd_table[];
@@ -47,6 +180,9 @@
 extern void handle_scancode(unsigned char);
 extern void put_queue(int);
 
+static struct adb_ids keyboard_ids;
+static struct adb_ids mouse_ids;
+
 /* this map indicates which keys shouldn't autorepeat. */
 static unsigned char dont_repeat[128] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -118,6 +254,10 @@
 	up_flag = (keycode & 0x80);
 	keycode &= 0x7f;
 
+	/* on the powerbook 3400, the power key gives code 0x7e */
+	if (keycode == 0x7e)
+		keycode = 0x7f;
+
 	if (!repeat)
 		del_timer(&repeat_timer);
 
@@ -130,7 +270,8 @@
 	 *	Might also want to know how many buttons need to be emulated.
 	 *	-> hide this as function in arch/m68k/mac ?
 	 */
-	if (adb_mouse_interrupt_hook || console_loglevel == 10) {
+	if ( (adb_emulate_buttons) &&
+	     (adb_mouse_interrupt_hook || console_loglevel == 10) ) {
 		unsigned char button, button2, button3, fake_event;
 		static unsigned char button2state=0, button3state=0; /* up */
 		/* faked ADB packet */
@@ -140,19 +281,19 @@
 		fake_event = 0;
 		switch (keycode) {	/* which 'button' ? */
 			case 0x7c:	/* R-option */
-				button2 = (!up_flag);		/* new state */
-				if (button2 != button2state)	/* change ? */
-					button = 2; 
-				button2state = button2;		/* save state */
-				fake_event = 2;
-				break; 
-			case 0x7d:	/* R-control */
 				button3 = (!up_flag);		/* new state */
 				if (button3 != button3state)	/* change ? */ 
 					button = 3; 
 				button3state = button3; 	/* save state */
 				fake_event = 3;
 				break; 
+			case 0x7d:	/* R-control */
+				button2 = (!up_flag);		/* new state */
+				if (button2 != button2state)	/* change ? */
+					button = 2; 
+				button2state = button2;		/* save state */
+				fake_event = 2;
+				break; 
 		}
 		if (fake_event && console_loglevel >= 8)
 			printk("fake event: button2 %d button3 %d button %d\n",
@@ -365,57 +506,134 @@
 };
 
 static struct adb_request led_request;
-static int leds_pending;
+static int leds_pending[16];
+static int pending_devs[16];
+static int pending_led_start=0;
+static int pending_led_end=0;
+
+static void real_mackbd_leds(unsigned char leds, int device)
+{
+
+    if (led_request.complete) {
+	adb_request(&led_request, leds_done, 0, 3,
+		    ADB_WRITEREG(device, KEYB_LEDREG), 0xff,
+		    ~mac_ledmap[leds]);
+    } else {
+	if (!(leds_pending[device] & 0x100)) {
+	    pending_devs[pending_led_end] = device;
+	    pending_led_end++;
+	    pending_led_end = (pending_led_end < 16) ? pending_led_end : 0;
+	}
+	leds_pending[device] = leds | 0x100;
+    }
+}
 
 void mackbd_leds(unsigned char leds)
 {
-	if (led_request.complete) {
-		adb_request(&led_request, leds_done, 0, 3,
-			     ADB_WRITEREG(ADB_KEYBOARD, KEYB_LEDREG),
-			     0xff, ~mac_ledmap[leds]);
-	} else
-		leds_pending = leds | 0x100;
+    int i;
+
+    for(i = 0; i < keyboard_ids.nids; i++)
+	real_mackbd_leds(leds,keyboard_ids.id[i]);
 }
 
 static void leds_done(struct adb_request *req)
 {
-	int leds;
+    int leds,device;
+
+    if (pending_led_start != pending_led_end) {
+	device = pending_devs[pending_led_start];
+	leds = leds_pending[device] & 0xff;
+	leds_pending[device] = 0;
+	pending_led_start++;
+	pending_led_start = (pending_led_start < 16) ? pending_led_start : 0;
+	real_mackbd_leds(leds,device);
+    }
 
-	if (leds_pending) {
-		leds = leds_pending & 0xff;
-		leds_pending = 0;
-		mackbd_leds(leds);
-	}
 }
 
-void mackbd_init_hw(void)
+__initfunc(void mackbd_init_hw(void))
 {
 	struct adb_request req;
+	int i;
+
+	if ( (_machine != _MACH_chrp) && (_machine != _MACH_Pmac) )
+	    return;
+
+	/* setup key map */
+	memcpy(plain_map, macplain_map, sizeof(plain_map));
+	memcpy(shift_map, macshift_map, sizeof(shift_map));
+	memcpy(altgr_map, macaltgr_map, sizeof(altgr_map));
+	memcpy(ctrl_map, macctrl_map, sizeof(ctrl_map));
+	memcpy(shift_ctrl_map, macshift_ctrl_map, sizeof(shift_ctrl_map));
+	memcpy(alt_map, macalt_map, sizeof(alt_map));
+	memcpy(ctrl_alt_map, macctrl_alt_map, sizeof(ctrl_alt_map));
 
 	/* initialize mouse interrupt hook */
 	adb_mouse_interrupt_hook = NULL;
-	/* assume broken mouse :-) - should be adjusted based on 
-	 * result of the mouse setup !! (or passed as  kernel option) */
-	adb_emulate_button2 = 1;
-	adb_emulate_button3 = 1;
-
-	adb_register(ADB_KEYBOARD, keyboard_input);
-	adb_register(ADB_MOUSE, mouse_input);
-
-	/* turn off all leds */
-	adb_request(&req, NULL, ADBREQ_SYNC, 3,
-		    ADB_WRITEREG(ADB_KEYBOARD, KEYB_LEDREG), 0xff, 0xff);
+
+	adb_register(ADB_KEYBOARD, 5, &keyboard_ids, keyboard_input);
+	adb_register(ADB_MOUSE, 1, &mouse_ids, mouse_input);
+
+	for(i = 0; i < keyboard_ids.nids; i++) {
+	    /* turn off all leds */
+	    adb_request(&req, NULL, ADBREQ_SYNC, 3,
+	    ADB_WRITEREG(keyboard_ids.id[i], KEYB_LEDREG), 0xff, 0xff);
+	}
 
 	/* get the keyboard to send separate codes for
 	   left and right shift, control, option keys. */
-	adb_request(&req, NULL, ADBREQ_SYNC, 3,
-		    ADB_WRITEREG(ADB_KEYBOARD, 3), 0, 3);
+	for(i = 0;i < keyboard_ids.nids; i++) {
+	    /* get the keyboard to send separate codes for
+	    left and right shift, control, option keys. */
+	    adb_request(&req, NULL, ADBREQ_SYNC, 3,
+	    ADB_WRITEREG(keyboard_ids.id[i], 3), 0, 3);
+	}
 
 	led_request.complete = 1;
 
 	/* Try to switch the mouse (id 3) to handler 4, for three-button
 	   mode. (0x20 is Service Request Enable, 0x03 is Device ID). */
-	adb_request(&req, NULL, ADBREQ_SYNC, 3,
-		    ADB_WRITEREG(ADB_MOUSE, 3), 0x23, 4 );
+	for(i = 0; i < mouse_ids.nids; i++) {
+	    adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
+			ADB_READREG(mouse_ids.id[i], 1));
+
+	    if ((req.reply_len) &&
+		(req.reply[1] == 0x9a) && (req.reply[2] == 0x21)) {
+
+		printk("aha, trackball found at %d\n", mouse_ids.id[i]);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i], 3), 0x63, 4 );
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 00,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 01,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 02,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 03,0x38);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 00,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 01,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 02,0x81);
+
+		adb_request(&req, NULL, ADBREQ_SYNC, 3,
+		ADB_WRITEREG(mouse_ids.id[i],1), 03,0x38);
+	    }
+	}
 }
 
+void adb_setup_mouse( char *s, int *ints )
+{
+       if (ints[0] >= 1)
+	       adb_emulate_buttons = ints[1];
+}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov