linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MouseSystems MacoPoint Pro, 3 btn mouse
@ 1999-01-06  1:01 Konstantinos Margaritis
  1999-01-06  2:06 ` Daniel Jacobowitz
  1999-01-06 10:41 ` Kelly Campbell
  0 siblings, 2 replies; 6+ messages in thread
From: Konstantinos Margaritis @ 1999-01-06  1:01 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc-user, debian-powerpc


(I apologize beforehand in case someone gets annoyed with crossposting)

I have just bought this mouse, and while it works ok with the mac, I can't
get it to work in linux (well, it works, but it doesn't use all 3
buttons). Yes I know, I should get mousemode and do 'mousemode 15 3' or
something like that, I did search the faq, but found no mention of this
particular mouse. Problem is that I use Debian/PPC and the mousemode
included (in package pmac-utils 1.1.1-1) seems to be old, or at least it
works only with /dev/adb. As I use 2.1.131, the proper device
is /dev/adbmouse and mousemode fails with an Input/Output Error.

So, what I really need is either a proper debian package (sorry rpms won't
do as I use glibc pre2.1), or sources to a working mousemode and if
possible the word of someone experienced in this sort of thing.

Thanks for any help.

Konstantinos Margaritis
kmargar@cc.uoa.gr


[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MouseSystems MacoPoint Pro, 3 btn mouse
  1999-01-06  1:01 MouseSystems MacoPoint Pro, 3 btn mouse Konstantinos Margaritis
@ 1999-01-06  2:06 ` Daniel Jacobowitz
  1999-01-06 10:41 ` Kelly Campbell
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 1999-01-06  2:06 UTC (permalink / raw)
  To: linuxppc-dev, linuxppc-user, debian-powerpc


On Wed, Jan 06, 1999 at 03:01:12AM +0200, Konstantinos Margaritis wrote:
> (I apologize beforehand in case someone gets annoyed with crossposting)
> 
> I have just bought this mouse, and while it works ok with the mac, I can't
> get it to work in linux (well, it works, but it doesn't use all 3
> buttons). Yes I know, I should get mousemode and do 'mousemode 15 3' or
> something like that, I did search the faq, but found no mention of this
> particular mouse. Problem is that I use Debian/PPC and the mousemode
> included (in package pmac-utils 1.1.1-1) seems to be old, or at least it
> works only with /dev/adb. As I use 2.1.131, the proper device
> is /dev/adbmouse and mousemode fails with an Input/Output Error.
> 
> So, what I really need is either a proper debian package (sorry rpms won't
> do as I use glibc pre2.1), or sources to a working mousemode and if
> possible the word of someone experienced in this sort of thing.

I don't off hand know where to get the latest mousemode, but this might
help: The device is indeed /dev/adb under recent kernels, major number
56, minor 0.  And the command would be mousemode 15 4.

Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|     CMU, CS class of 2002      |
|   Debian GNU/Linux Developer    __   Part-Time Systems Programmer  |
|         dan@debian.org         |  |        drow@cs.cmu.edu         |
\--------------------------------/  \--------------------------------/

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MouseSystems MacoPoint Pro, 3 btn mouse
  1999-01-06  1:01 MouseSystems MacoPoint Pro, 3 btn mouse Konstantinos Margaritis
  1999-01-06  2:06 ` Daniel Jacobowitz
@ 1999-01-06 10:41 ` Kelly Campbell
  1999-01-06 14:03   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 6+ messages in thread
From: Kelly Campbell @ 1999-01-06 10:41 UTC (permalink / raw)
  To: Konstantinos Margaritis; +Cc: linuxppc-dev, linuxppc-user, debian-powerpc

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

On Wed, Jan 06, 1999 at 03:01:12AM +0200, Konstantinos Margaritis wrote:

> I have just bought this mouse, and while it works ok with the mac, I can't
> get it to work in linux (well, it works, but it doesn't use all 3
> buttons). Yes I know, I should get mousemode and do 'mousemode 15 3' or
> something like that, I did search the faq, but found no mention of this
> particular mouse. Problem is that I use Debian/PPC and the mousemode
> included (in package pmac-utils 1.1.1-1) seems to be old, or at least it
> works only with /dev/adb. As I use 2.1.131, the proper device
> is /dev/adbmouse and mousemode fails with an Input/Output Error.

What you need is the MacX kernel patch. I don't know who wrote it and I
can't find it by searching on the list archives (I tried real hard too),
so I guess I'll attach my most recent copy here. It works for my Mouse
Systems Pro just fine with no tweaking mousemode... just had to recompile
the kernel.

It'd be nice to have stuff like this in the FAQ's on linuxppc.org, and
also it'd be nice if someone could look at getting this into the cvs
kernel if it doesn't cause too many problems with other mice. 

Kelly
-- 
Kelly A. Campbell                       Applications Programmer/Analyst 
<camk@telecom.ksu.edu>  <camk@acm.org>  Kansas State University
http://www.telecom.ksu.edu/~camk/       Department of Telecommunications
109 East Stadium, Manhattan KS 66506    http://www.telecom.ksu.edu/
Voice: (785) 532-7067                   Fax: (785) 532-7114

[-- Attachment #2: macx-patch-fb-19981022 --]
[-- Type: text/plain, Size: 4390 bytes --]

diff -ru linux-pmac/arch/ppc/config.in linux-2.1.125/arch/ppc/config.in
--- linux-pmac/arch/ppc/config.in	Tue Oct 13 02:20:16 1998
+++ linux-2.1.125/arch/ppc/config.in	Thu Oct 22 20:58:25 1998
@@ -80,6 +80,7 @@
 bool 'Support for PowerMac floppy' CONFIG_MAC_FLOPPY
 bool 'Support for PowerMac serial ports' CONFIG_MAC_SERIAL
 bool 'Support for PowerMac ADB mouse' CONFIG_ADBMOUSE
+bool 'Support for PowerMac MacX 3 btn. mouse' CONFIG_MACX_MOUSE
 bool 'Support for Open Firmware device tree in /proc' CONFIG_PROC_DEVICETREE
 bool 'Include kgdb kernel debugger' CONFIG_KGDB
 bool 'Include xmon kernel debugger' CONFIG_XMON
diff -ru linux-pmac/drivers/macintosh/mac_keyb.c linux-2.1.125/drivers/macintosh/mac_keyb.c
--- linux-pmac/drivers/macintosh/mac_keyb.c	Sun Oct 11 17:32:52 1998
+++ linux-2.1.125/drivers/macintosh/mac_keyb.c	Thu Oct 22 21:03:11 1998
@@ -184,6 +184,11 @@
 
 extern int console_loglevel;
 
+#ifdef CONFIG_MACX_MOUSE
+/* DKH:9/98 -- Fake packet for the mouse data / also button state*/
+static unsigned char fake_mouse_packet[4] = { 0x3c, 0x80, 0x80, 0x80 };
+#endif /*CONFIG_MACX_MOUSE*/
+
 extern struct kbd_struct kbd_table[];
 extern struct wait_queue * keypress_wait;
 
@@ -246,13 +251,70 @@
 static void
 keyboard_input(unsigned char *data, int nb, struct pt_regs *regs, int apoll)
 {
+
+#ifdef CONFIG_MACX_MOUSE
+	/* Treat all ADB devices as _potential_ MacX mice,
+	   then determine later which ones aren't based on data */
+	/* XXX: Can 0 ever be a device? */
+	static char mice[16] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; 
+	char button_state;
+	struct kbd_struct *kbd;
+	
+ 	kbd = kbd_table + fg_console;
+#endif
+
 	/* first check this is from register 0 */
 	if (nb != 3 || (data[0] & 3) != KEYB_KEYREG)
 		return;		/* ignore it */
+	
+#ifdef CONFIG_MACX_MOUSE
+    if ( !mice[ data[0]>>4 ]){ /* A _known_ keyboard */
+regular_keyboard:
+#endif
+
 	kbd_pt_regs = regs;
 	input_keycode(data[1], 0);
 	if (!(data[2] == 0xff || (data[2] == 0x7f && data[1] == 0x7f)))
 		input_keycode(data[2], 0);
+
+#ifdef CONFIG_MACX_MOUSE
+    } else { 
+	/* This _could_ be a MacX mouse.  If it is then send
+	   the data to the X server and possibly FB, else
+	   pass it back to the keyboard code and mark this
+	   device as a known keyboard.  (HACK) */
+	  
+	switch(data[1]){
+	case 0x3b:
+		fake_mouse_packet[2] = 0;
+		button_state = 0x3f;
+		break;
+	case 0xbb:
+		fake_mouse_packet[2] = 0x80;
+		button_state = 0xbf;
+		break;
+	case 0x3c:
+		fake_mouse_packet[3] = 0;
+		button_state = 0x40;
+		break;
+	case 0xbc:
+		fake_mouse_packet[3] = 0x80;
+		button_state = 0xc0;
+		break;
+	default:
+		mice[ data[0]>>4 ] = 0; /* Nope, not a mouse */
+		goto regular_keyboard;
+	}
+
+	/* XXX Wont this loose the first button state? */
+
+	if (adb_mouse_interrupt_hook) /* New style */
+		adb_mouse_interrupt_hook(fake_mouse_packet,4);
+
+	if (kbd->kbdmode == VC_RAW) /* Old style */
+		mac_put_queue( button_state );
+    }
+#endif
 }
 
 static void
@@ -467,6 +529,33 @@
 }
 #endif /* CONFIG_ADBMOUSE */
 
+#ifdef CONFIG_MACX_MOUSE
+static void
+macx_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll)
+{
+	/* It would be nice if this would check to see if we have mouse data from
+	   a real three button mouse and then re-register the real handler
+	   function. */
+
+	struct kbd_struct *kbd;
+	/* Store the button states in data (nuking extranious button info)*/
+	data[2] = ( data[2] & 0x7f) | fake_mouse_packet[2];
+	data[3] = ( data[3] & 0x7f) | fake_mouse_packet[3];
+
+	if (adb_mouse_interrupt_hook)
+		adb_mouse_interrupt_hook(data, nb);
+	kbd = kbd_table + fg_console;
+
+	/* Only send mouse codes when keyboard is in raw mode. */
+	if (kbd->kbdmode == VC_RAW) {
+		mac_put_queue( 0x7e );
+		mac_put_queue( data[1] );
+		mac_put_queue( data[2] );
+	}
+
+}
+#endif /*CONFIG_MACX_MOUSE*/
+
 /* Map led flags as defined in kbd_kern.h to bits for Apple keyboard. */
 static unsigned char mac_ledmap[8] = {
     0,		/* none */
@@ -546,7 +635,12 @@
 	/* initialize mouse interrupt hook */
 	adb_mouse_interrupt_hook = NULL;
 
+#ifndef CONFIG_MACX_MOUSE /* Not sure if this is the best way */
 	adb_register(ADB_MOUSE, 1, &mouse_ids, mouse_input);
+#else
+	adb_register(ADB_MOUSE, 3, &mouse_ids, macx_mouse_input);
+#endif /* CONFIG_MACX_MOUSE */
+
 #endif /* CONFIG_ADBMOUSE */
 
 	adb_register(ADB_KEYBOARD, 5, &keyboard_ids, keyboard_input);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MouseSystems MacoPoint Pro, 3 btn mouse
  1999-01-06 10:41 ` Kelly Campbell
@ 1999-01-06 14:03   ` Benjamin Herrenschmidt
  1999-01-07 17:00     ` Konstantinos Margaritis
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 1999-01-06 14:03 UTC (permalink / raw)
  To: debian-powerpc, linuxppc-user, linuxppc-dev, Kelly Campbell


On Wed, Jan 6, 1999, Kelly Campbell <camk@telecom.ksu.edu> wrote:

>What you need is the MacX kernel patch. I don't know who wrote it and I
>can't find it by searching on the list archives (I tried real hard too),
>so I guess I'll attach my most recent copy here. It works for my Mouse
>Systems Pro just fine with no tweaking mousemode... just had to recompile
>the kernel.
>
>It'd be nice to have stuff like this in the FAQ's on linuxppc.org, and
>also it'd be nice if someone could look at getting this into the cvs
>kernel if it doesn't cause too many problems with other mice. 

I'm putting together some patches that include out-of-the box support for
most 3 btn mice, PowerBook trackball (and backlight for G3 Series) and a
couple of other things. It's not ready yet, but I'm also including the
MacX patches via a config option (disabled by default since it hacks too
much the normal ADB behaviour and is not currently compatible with
non-MacX mice).

However, I don't have any of those mice. If someone with a MacX mouse
could send it to me for a couple of days, this would allow me to make
sure it works 100% (I would like to test some stuffs to improve the
behaviour of the patch but I cannot without a mouse).

So anyone with a MacX compatible mouse willing to send it to Paris for
some days ?


-- 
           E-Mail: <mailto:bh40@calva.net>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>





[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MouseSystems MacoPoint Pro, 3 btn mouse
  1999-01-06 14:03   ` Benjamin Herrenschmidt
@ 1999-01-07 17:00     ` Konstantinos Margaritis
  1999-01-07 17:37       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Konstantinos Margaritis @ 1999-01-07 17:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: debian-powerpc, linuxppc-user, linuxppc-dev, Kelly Campbell



On Wed, 6 Jan 1999, Benjamin Herrenschmidt wrote:

> I'm putting together some patches that include out-of-the box support for
> most 3 btn mice, PowerBook trackball (and backlight for G3 Series) and a
> couple of other things. It's not ready yet, but I'm also including the
> MacX patches via a config option (disabled by default since it hacks too
> much the normal ADB behaviour and is not currently compatible with
> non-MacX mice).
> 
> However, I don't have any of those mice. If someone with a MacX mouse
> could send it to me for a couple of days, this would allow me to make
> sure it works 100% (I would like to test some stuffs to improve the
> behaviour of the patch but I cannot without a mouse).
> 
> So anyone with a MacX compatible mouse willing to send it to Paris for
> some days ?

Actually, after I tested the MacX patch by Kelly Campbell -although I had
to tweak it a bit, since I use 2.1.131 kernel- I found out it works
perfectly with the Macpoint Pro mouse, so instead of sending you my mouse,
I would suggest that this patch be inserted to the official kernel tree.
That would be best, IMHO.

Konstantinos Margaritis
kmargar@cc.uoa.gr



[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MouseSystems MacoPoint Pro, 3 btn mouse
  1999-01-07 17:00     ` Konstantinos Margaritis
@ 1999-01-07 17:37       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 1999-01-07 17:37 UTC (permalink / raw)
  To: linuxppc-dev, Konstantinos Margaritis


On Thu, Jan 7, 1999, Konstantinos Margaritis <kmargar@cc.uoa.gr> wrote:

>Actually, after I tested the MacX patch by Kelly Campbell -although I had
>to tweak it a bit, since I use 2.1.131 kernel- I found out it works
>perfectly with the Macpoint Pro mouse, so instead of sending you my mouse,
>I would suggest that this patch be inserted to the official kernel tree.
>That would be best, IMHO.

This patch is already included in my tree, but I think I have a problem
with one of the buttons, I'll have to re-check my code carefully.

I suggest you try a 2.2-pre4 with my test patch (download just the diffs
next to the test kernel) and enable the MacX option in the config. Tell
me how it works, and if it doesn't, you may eventually be able to tell me
what is broken. I may have missed something simple, I juste putted it in
quickly, it probably needs a little bit of work.

Actually, I'm interested in the theory behind this patch. Is the
"official" behaviour of MacX mice documented somewhere ? I'm thinking
about things like "can a MacX mouse be handler 2 or 4 or can it be only
handler 1 ?". With answers to this, I may be able to auto-disable the
patch when I know for sure it's a normal mouse, and this allow the same
kernel to work with both kind of mice. I already have some "hints" about
the way to do that but I want to be sure and to be able to test ;-)

I think I'll end up just buying one.

-- 
           E-Mail: <mailto:bh40@calva.net>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>





[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request@lists.linuxppc.org ]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-01-07 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-06  1:01 MouseSystems MacoPoint Pro, 3 btn mouse Konstantinos Margaritis
1999-01-06  2:06 ` Daniel Jacobowitz
1999-01-06 10:41 ` Kelly Campbell
1999-01-06 14:03   ` Benjamin Herrenschmidt
1999-01-07 17:00     ` Konstantinos Margaritis
1999-01-07 17:37       ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).