Skip to contentSkip to conversation

MacAlly 2-buttons mouse support for 2.2.14

PATCH In review Giuliano Pochini 4 participants 7 messages Jan 6, 2000 – Jan 10, 2000

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MacAlly 2-buttons mouse support for 2.2.14

Does anyone read my msgs ?? I posted these ones for ages but they still are not been included into official kernels...

Bye.

macintosh/mac_keyb.c renamed from macintosh/mac_keyb.old +27 -0
@@ -24,6 +24,7 @@
  * - Hunter digital (NoHandsMouse)
  * - Kensignton TurboMouse 5 (needs testing)
  * - Mouse Systems A3 mice and trackballs <[email protected]>
+ * - MacAlly 2-buttons mouse (needs testing) <[email protected]>
  *
  * To do:
  *
@@ -272,6 +273,7 @@
 #define ADBMOUSE_MICROSPEED	6	/* Microspeed mouse (&trackball ?), MacPoint */
 #define ADBMOUSE_TRACKBALLPRO	7	/* Trackball Pro (special buttons) */
 #define ADBMOUSE_MS_A3		8	/* Mouse systems A3 trackball (handler 3) */
+#define ADBMOUSE_MACALLY2	9	/* MacAlly 2-button mouse */
 
 static int adb_mouse_kinds[16];
 
@@ -490,6 +492,18 @@
     data[3] = byyy bxxx Third button and fourth button.  Y is additional
 	      high bits of y-axis motion.  XY is additional
 	      high bits of x-axis motion.
+
+    MacAlly 2-button mouse protocol.
+
+    For MacAlly 2-button mouse protocol the data array will contain the
+    following values:
+
+		BITS    COMMENTS
+    data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd.
+    data[1] = bxxx xxxx Left button and x-axis motion.
+    data[2] = byyy yyyy Right button and y-axis motion.
+    data[3] = ???? ???? unknown
+    data[4] = ???? ???? unknown
   */
 	struct kbd_struct *kbd;
 
@@ -521,6 +535,11 @@
 		data[2] = (data[2] & 0x7f) | ((data[3] & 0x02) << 6);
 		data[3] = ((data[3] & 0x04) << 5);
 		break;
+            case ADBMOUSE_MACALLY2:
+		data[3] = (data[2] & 0x80) ? 0x80 : 0x00;
+		data[2] |= 0x80;	/* Right button is mapped as button 3 */
+		nb=4;
+                break;
 	}
 
 	if (adb_mouse_interrupt_hook)
@@ -825,6 +844,14 @@
 			    (req.reply[1] == 0x4b) && (req.reply[2] == 0x4d) &&
 			    (req.reply[3] == 0x4c) && (req.reply[4] == 0x31))
 				init_turbomouse(id);
+			else if ((req.reply_len == 9) &&
+			    (req.reply[1] == 0x4b) && (req.reply[2] == 0x4f) &&
+			    (req.reply[3] == 0x49) && (req.reply[4] == 0x54)){
+				if (adb_try_handler_change(id, 0x42)) {
+					printk("\nADB MacAlly 2-button mouse at %d, handler set to 0x42", id);
+					adb_mouse_kinds[id] = ADBMOUSE_MACALLY2;
+				}
+			}
 		}
 		printk("\n");
         }
#1 lore raw
Quoted 2 lines · Giuliano Pochini

Does anyone read my msgs ?? I posted these ones for ages but they still are not been included into official kernels...

They look clean. I'll add them to my test kernels in order to get some feedback. If they seem to work fine, they'll end up in the main tree.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 4 lines

They look clean. I'll add them to my test kernels in order to get some feedback. If they seem to work fine, they'll end up in the main tree.

Tnx!

Bye.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to BenH
Quoted 7 lines · BenH
Quoted 2 lines · Giuliano Pochini

Does anyone read my msgs ?? I posted these ones for ages but they still are not been included into official kernels...

They look clean. I'll add them to my test kernels in order to get some feedback. If they seem to work fine, they'll end up in the main tree.

We have also a nice mouse patch :-)

cat zzz_onebutton_mouse.dif :

drivers/char/adbmouse.c +15 -0
diff -urN linux/drivers/char/adbmouse.c linux-2.2.14pre14.SuSE.ppc/drivers/char/adbmouse.c
@@ -50,6 +50,10 @@
 extern int adb_button2_keycode;
 extern int adb_button3_keycode;
 
+extern unsigned char onebutton_keycode;
+extern unsigned char onebutton_upflag;
+extern unsigned char onebutton_clicked;
+
 extern int console_loglevel;
 
 /*
@@ -193,6 +197,17 @@
     dx = mouse.dx;
     dy = mouse.dy;
     buttons = mouse.buttons;
+ 
+    if (buttons == 3) {
+        if (onebutton_keycode == 55)
+            buttons = 5;
+        else if (onebutton_keycode == 54)
+            buttons = 6;
+        if (onebutton_upflag)
+		onebutton_keycode = 0;
+	onebutton_clicked = 1;
+    }                                                       
+
     if (dx > 127)
 	dx = 127;
     else if (dx < -128)
drivers/char/keyboard.c +10 -1
diff -urN linux/drivers/char/keyboard.c linux-2.2.14pre14.SuSE.ppc/drivers/char/keyboard.c
@@ -62,6 +62,9 @@
 #endif
 
 EXPORT_SYMBOL(handle_scancode);
+unsigned char onebutton_keycode = 0;
+unsigned char onebutton_upflag  = 1;
+unsigned char onebutton_clicked = 0;
 
 extern void ctrl_alt_del(void);
 
@@ -240,8 +243,14 @@
 		rep = 0;
 		if(!test_and_clear_bit(keycode, key_down))
 		    up_flag = kbd_unexpected_up(keycode);
-	} else
+	        if (onebutton_clicked)
+			onebutton_keycode = 0;
+	} else {
 		rep = test_and_set_bit(keycode, key_down);
+		onebutton_keycode = keycode;
+		onebutton_clicked = 0;
+	}
+	onebutton_upflag = up_flag;
 
 #ifdef CONFIG_MAGIC_SYSRQ		/* Handle the SysRq Hack */
 	if (keycode == SYSRQ_KEY) {
drivers/usb/mouse.c +14 -0
diff -urN linux/drivers/usb/mouse.c linux-2.2.14pre14.SuSE.ppc/drivers/usb/mouse.c
@@ -40,6 +40,10 @@
 
 #include <asm/spinlock.h>
 
+extern unsigned char onebutton_keycode;
+extern unsigned char onebutton_upflag;
+extern unsigned char onebutton_clicked;                                         
+
 #include "usb.h"
 
 #define USB_MOUSE_MINOR 32
@@ -188,6 +192,16 @@
 				buttons |= 0x10;
 			if (mouse->dy < 0)
 				buttons |= 0x20;
+			if (buttons == 1) {
+				if (onebutton_keycode == 54)
+					buttons = 2;
+				else if (onebutton_keycode == 55)
+					buttons = 4;
+				onebutton_keycode = 0;
+				if (onebutton_upflag)
+					onebutton_keycode = 0;
+				onebutton_clicked = 1;
+			}
 			put_user(buttons, buffer);
 			buffer++;
 			retval++;

Right mouse button is CMND , middle mouse button is CTRL. Would be nice to get some feedback.

Gruss Olaf

Signature · 6 lines
 $ man 1 current_release

BUGS
       Users never read manuals...

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#4 lore raw
Quoted 3 lines · Olaf Hering

We have also a nice mouse patch :-)

.....

Quoted 7 lines

Right mouse button is CMND , middle mouse button is CTRL. Would be nice to get some feedback.

Gruss Olaf

Hmm how are you going to get double clicks with this ?
Also keep in mind that many window managers/programs use ctrl|meta|alt-mousebutton.

I still feel that at least for X it should (and can) be handled from inside X and not from the kernel. We still need something for the console though.

Kostas Gewrgiou

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 10 lines · Kostas Gewrgiou
Quoted 2 lines

Right mouse button is CMND , middle mouse button is CTRL. Would be nice to get some feedback.

Hmm how are you going to get double clicks with this ?
Also keep in mind that many window managers/programs use ctrl|meta|alt-mousebutton.

I still feel that at least for X it should (and can) be handled from inside X and not from the kernel. We still need something for the console though.

It work also on the console. I guess there is no easy way for ALT+double_click.

Or do you miss something? It is for the copy&paste function, I will check what I can do to solve the problem with Xterm. You can not change the size of the font.
If someone really need a application that depends on "complex mouse clicks" ;-) then go and by a more button mouse.

BTW, where can I get a more button ADB mouse?

Gruss Olaf

Signature · 6 lines
 $ man 1 current_release

BUGS
       Users never read manuals...

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#6 lore raw
Quoted 14 lines · Olaf Hering
Quoted 10 lines · Kostas Gewrgiou
Quoted 2 lines

Right mouse button is CMND , middle mouse button is CTRL. Would be nice to get some feedback.

Hmm how are you going to get double clicks with this ?
Also keep in mind that many window managers/programs use ctrl|meta|alt-mousebutton.

I still feel that at least for X it should (and can) be handled from inside X and not from the kernel. We still need something for the console though.

Quoted 8 lines

It work also on the console. I guess there is no easy way for ALT+double_click.

Or do you miss something? It is for the copy&paste function, I will check what I can do to solve the problem with Xterm. You can not change the size of the font.
If someone really need a application that depends on "complex mouse clicks" ;-) then go and by a more button mouse.

I mean that you can map keyboard keys to mouse clicks under X *without* any
kernel changes. Take a look at http://people.a2000.nl/omoerbe/ for a better description.

Quoted 3 lines

BTW, where can I get a more button ADB mouse?

Can't help there, at least in Greece its much easier (and cheaper) to find/buy
a usb pci card :(.

Quoted 4 lines

Gruss Olaf

Kostas Gewrgiou

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/