imwheel.patch

来自「gpm-1.20.0.tar.gz」· PATCH 代码 · 共 1,225 行 · 第 1/4 页

PATCH
1,225
字号
+	if(mytype == 0){+		mytype=mice;+		while(mytype->name && strcmp("tmmfx", mytype->name)){+			mytype++;+		}++		/* this can't happen, unless someone deletes the entry... */+		if(!mytype->name){+			gpm_debug_log(LOG_NOTICE, "internal mice-table broken, exiting");+			exit(1);+		}+	}++	if (data[1]==GPM_EXTRA_MAGIC_1 && data[2]==GPM_EXTRA_MAGIC_2){+		/* got unexpected fourth byte */+		gpm_debug_log(LOG_NOTICE,"Extra byte = %02x",*data);+		if ((extended=(data[0]>>4)) > 0x3){+			return -1;  /* just a sanity check */+		}+		my_x = my_y = 0;++		mytype->packetlen=4;+		mytype->getextra=0;+	} +	else{+		/* got 3/4, as expected */++		/* motion is independent of packetlen... */+		my_x = (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F));+		my_y = (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));++		buttons = ((data[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);+		if (mytype->packetlen==4){+			extended=data[3]>>4;+		}+	}++	if(mytype->packetlen==4){+		if(extended == 0){+			mytype->packetlen=3;+			mytype->getextra=1;+		}+		else {+			if (extended & 0x2){+				buttons |= GPM_B_MIDDLE;+			}++			if (extended & 0x1){+				/* scroll-button pressed, report ball-movements as stick-data */++				buttons |= GPM_STICK;+				state->stick_x = (char)  my_x;+				state->stick_y = (char) -my_y;+				my_x = 0;+				my_y = 0;+			}+		}+	}+	state->buttons = buttons;+	state->dx = my_x;+	state->dy = my_y;++	return 0;+}++/* The Primax Cyber-Navigator is basically a PS/2 mouse with a non-standard+   wheel and three extra side buttons. We'll map the side buttons to the+   extra bits in the patched gpm. */+static int M_pcnps2(Gpm_Event *state,  unsigned char *data)+{+	state->stick_x=state->stick_y=0;+	state->dx=state->dy=0;++	state->buttons=+		!!(data[0]&1) * GPM_B_LEFT  |+		!!(data[0]&2) * GPM_B_RIGHT |+		!!(data[0]&4) * GPM_B_MIDDLE;++	/* The Primax extensions use the 0x10 bit to flag extended+	   button/wheel reports. Bits 0, 1 and 2 echo the three standard buttons,+	   if chording. */++	if(((data[0]&0x18)==0x18) && (data[1]==0) && ((data[2]&0x80))!=0){+		state->buttons&=~(GPM_W_DOWN|GPM_W_UP|GPM_W_LEFT|GPM_W_RIGHT|GPM_STICK);+		state->buttons|=+			((data[2]&0xf)==0xf) * GPM_W_UP |+			((data[2]&0xf)==0x1) * GPM_W_DOWN |+			(((data[2]&0x10)!=0) * GPM_W_LEFT) |+			(((data[2]&0x20)!=0) * GPM_W_RIGHT);++		/* There's no room to handle the sixth button. We'll make it an+		   upwards stick movement. */++#if 0+		state->buttons|=GPM_STICK;+		state->stick_x=0;+		state->stick_y=7*(!!data[2]&0x40);+#endif+	} else {+		/* The Primax mice don't seem to send negative bits in data[0], but they do+		 * flag extended button events and wheel movement using bit 0x10. */+		if(data[1] != 0)+			state->dx=   (data[0] & 0x10) ? data[1]-256 : data[1];+		else+			state->dx = 0;+		if(data[2] != 0)+			state->dy= -((data[0] & 0x20) ? data[2]-256 : data[2]);+		else+			state->dy = 0;+	}+	gpm_debug_log(LOG_DEBUG,"Buttons: %d %d %d (%d %d) (%d %d)\n",+			(state->buttons&GPM_B_LEFT),+			(state->buttons&GPM_B_MIDDLE),+			(state->buttons&GPM_B_RIGHT),+			(state->buttons&GPM_W_UP),+			(state->buttons&GPM_W_DOWN),+			(state->buttons&GPM_W_LEFT),+			(state->buttons&GPM_W_RIGHT));+	gpm_debug_log(LOG_DEBUG,"wheel? %d\n",opt_wheel);++	return 0;+}++static Gpm_Type *I_pcnps2(int fd, unsigned short flags, struct Gpm_Type *type)+{  +	opt_wheel=type->wheel;+	return type;+}+ static Gpm_Type *I_twid(int fd, unsigned short flags, struct Gpm_Type *type) {   if (twiddler_key_init() != 0) return NULL;@@ -1438,104 +1696,116 @@ Gpm_Type mice[]={   {"mman", "The \"MouseMan\" and similar devices (3/4 bytes per packet).",            "Mouseman", M_mman, I_serial, CS7 | STD_FLG, /* first */-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 1, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 1, 0, 0, 0},   {"ms",   "The original ms protocol, with a middle-button extension.",            "", M_ms, I_serial, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0, 0},   {"ms+", "Like 'ms', but allows dragging with the middle button.",            "", M_ms_plus, I_serial, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0, 0},   {"ms+lr", "'ms+', but you can reset m by pressing lr (see man page).",            "", M_ms_plus_lr, I_serial, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0, 0},   {"bare", "Unadorned ms protocol. Needed with some 2-buttons mice.",            "Microsoft", M_bare, I_serial, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0, 0},   {"msc",  "Mouse-Systems-Compatible (5bytes). Most 3-button mice.",            "MouseSystems", M_msc, I_serial, CS8 | CSTOPB | STD_FLG,-                                {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, R_msc},+                                {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, R_msc, 0},   {"sun",  "'msc' protocol, but only 3 bytes per packet.",            "", M_sun, I_serial, CS8 | CSTOPB | STD_FLG,-                                {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0},+                                {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0, 0},   {"mm",   "MM series. Probably an old protocol...",            "MMSeries", M_mm, I_serial, CS8 | PARENB|PARODD | STD_FLG,-                                {0xe0, 0x80, 0x80, 0x00}, 3, 1, 0, 0, 0},+                                {0xe0, 0x80, 0x80, 0x00}, 3, 1, 0, 0, 0, 0},   {"logi", "Used in some Logitech devices (only serial).",            "Logitech", M_logi, I_logi, CS8 | CSTOPB | STD_FLG,-                                {0xe0, 0x80, 0x80, 0x00}, 3, 3, 0, 0, 0},+                                {0xe0, 0x80, 0x80, 0x00}, 3, 3, 0, 0, 0, 0},   {"bm",   "Micro$oft busmice and compatible devices.",            "BusMouse", M_bm, NULL, STD_FLG, /* bm is sun */-                                {0xf8, 0x80, 0x00, 0x00}, 3, 3, 0, 0, 0},+                                {0xf8, 0x80, 0x00, 0x00}, 3, 3, 0, 0, 0, 0},   {"ps2",  "Busmice of the ps/2 series. Most busmice, actually.",            "PS/2", M_ps2, NULL, STD_FLG,-                                {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, 0},+                                {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, 0, 0},   {"ncr",  "Ncr3125pen, found on some laptops",            "", M_ncr, NULL, STD_FLG,-                                {0x08, 0x08, 0x00, 0x00}, 7, 7, 0, 1, 0},+                                {0x08, 0x08, 0x00, 0x00}, 7, 7, 0, 1, 0, 0},   {"wacom", "Wacom graphire tablet: pen, mouse",            "", M_wacom, I_wacom, STD_FLG,-                                {0x80, 0x80, 0x80, 0x00}, 8, 8, 0, 0, 0},+                                {0x80, 0x80, 0x80, 0x00}, 8, 8, 0, 0, 0, 0},   {"genitizer", "\"Genitizer\" tablet, in relative mode.",            "", M_geni, I_serial, CS8|PARENB|PARODD,-                                {0x80, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0},+                                {0x80, 0x80, 0x00, 0x00}, 3, 1, 0, 0, 0, 0},   {"logim",  "Turn logitech into Mouse-Systems-Compatible.",            "", M_logimsc, I_serial, CS8 | CSTOPB | STD_FLG,-                                {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, 0},+                                {0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0, 0, 0},   {"pnp",  "Plug and pray. New mice may not run with '-t ms'.",            "", M_bare, I_pnp, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0, 0, 0},   {"imps2",   "Microsoft Intellimouse (ps2) - 3 buttons, wheel unused",            "", M_ps2, I_imps2, STD_FLG,-                                {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},+                                {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0, 1},   {"ms3", "Microsoft Intellimouse (serial) - 3 buttons, wheel unused",            "", M_ms3, I_pnp, CS7 | STD_FLG,-                                {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},+                                {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0, 1},   {"netmouse",  "Genius NetMouse - 2 buttons and 2 buttons 'up'/'down'.",                  "", M_netmouse, I_netmouse, CS7 | STD_FLG,-                                {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0},+                                {0xc0, 0x00, 0x00, 0x00}, 4, 1, 0, 0, 0, 0},   {"cal", "Calcomp UltraSlate",            "", M_calus, I_calus, CS8 | CSTOPB | STD_FLG,-                                {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 1, 0},+                                {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 1, 0, 0},   {"calr", "Calcomp UltraSlate - relative mode",            "", M_calus_rel, I_calus, CS8 | CSTOPB | STD_FLG,-                                {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 0, 0},+                                {0x80, 0x80, 0x80, 0x00}, 6, 6, 0, 0, 0, 0},   {"twid", "Twidddler keyboard",            "", M_twid, I_twid, CS8 | STD_FLG,-                                {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0},+                                {0x80, 0x00, 0x80, 0x80}, 5, 1, 0, 0, 0, 0},   {"syn", "The \"Synaptics\" serial TouchPad.",            "synaptics", M_synaptics_serial, I_serial, CS7 | STD_FLG,-                                {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0},+                                {0x40, 0x40, 0x40, 0x00}, 6, 6, 1, 0, 0, 0},   {"synps2", "The \"Synaptics\" PS/2 TouchPad",            "synaptics_ps2", M_synaptics_ps2, I_synps2, STD_FLG,-                                {0x80, 0x80, 0x00, 0x00}, 6, 1, 1, 0, 0},+                                {0x80, 0x80, 0x00, 0x00}, 6, 1, 1, 0, 0, 0},   {"brw",  "Fellowes Browser - 4 buttons (and a wheel) (dual protocol?)",            "", M_brw, I_pnp, CS7 | STD_FLG,-                                {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0},+                                {0xc0, 0x40, 0xc0, 0x00}, 4, 1, 0, 0, 0, 0},+  {"mm+ps2", "The \"MouseManPlus\" and similar devices (3 button with stick)",+           "MouseManPlusPS/2", M_ps2, I_mmplusps2, CS8 | STD_FLG,+                                {0x08, 0x08, 0x00, 0x00}, 3, 1, 0, 0, 0, 1},+  {"marblefx", "The Logitech Marble FX Trackball (4th button toggles stick)",+           "MarbleFX", M_marblefx, I_mmplusps2, CS8 | STD_FLG,+                                {0x08, 0x08, 0x00, 0x00}, 3, 1, 0, 0, 0, 1},+  {"tmmfx", "Logitech TrackMan Marble FX (serial, 4th button toggles stick)",+           "TrackManFX", M_tmmfx, I_serial, CS7 | STD_FLG,+                                {0x40, 0x40, 0x40, 0x00}, 3, 1, 1, 0, 0, 1},+  {"pcnps2", "Primax Cyber Navigator (and more?) on a PS/2 port.",+           "", M_pcnps2, I_pcnps2, STD_FLG,+                                {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0, 0, 1},  #ifdef HAVE_LINUX_JOYSTICK_H   {"js",   "Joystick mouse emulation",            "Joystick", M_js, NULL, 0,-                              {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0},+                              {0xFC, 0x00, 0x00, 0x00}, 12, 12, 0, 0, 0, 0}, #endif    {"summa",  "Summagraphics or Genius tablet absolute mode(MM-Series)",            "", M_summa, I_summa, STD_FLG,-                                {0x98, 0x98, 0x00, 0x00}, 5, 1, 0, 1, R_summa}, +                                {0x98, 0x98, 0x00, 0x00}, 5, 1, 0, 1, R_summa, 0},    {"mtouch",  "MicroTouch touch-screens (only button-1 events, by now)",            "", M_mtouch, I_mtouch, STD_FLG,-                                {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL}, +                                {0x80, 0x80, 0x80, 0x00}, 5, 1, 0, 1, NULL, 0},     {"acecad",  "Acecad tablet absolute mode(Sumagrapics MM-Series mode)",            "", M_summa, I_summa, STD_FLG,-                                {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0}, +                                {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0, 0},     {"wp",      "Genius WizardPad tablet",            "wizardpad", M_wp, I_wp, STD_FLG,-                                {0xFA, 0x42, 0x00, 0x00}, 10, 1, 0, 1, 0},+                                {0xFA, 0x42, 0x00, 0x00}, 10, 1, 0, 1, 0, 0},    {"",     "",            "", NULL, NULL, 0,-                                {0x00, 0x00, 0x00, 0x00}, 0, 0, 0, 0, 0}+                                {0x00, 0x00, 0x00, 0x00}, 0, 0, 0, 0, 0, 0} };  /*------------------------------------------------------------------------*/Only in ../imwheel/gpm-imwheel: mice.c.origdiff -ru --exclude=Makefile ./mouse-test.c ../imwheel/gpm-imwheel/mouse-test.c--- ./mouse-test.c	Fri Nov 12 08:27:37 1999+++ ../imwheel/gpm-imwheel/mouse-test.c	Sun Feb 27 16:30:46 2000@@ -10,6 +10,9 @@  * where watchdog is used.  Reported by Jim Studt <jim@federated.com>  * [Debian bug report #22602]  *+ * Modified on 9/8/1998 by Jonathan Atkins for use with wheel mice+ *                         <jcatki@home.com>+ *  *   This program is free software; you can redistribute it and/or modify  *   it under the terms of the GNU General Public License as published by  *   the Free Software Foundation; either version 2 of the License, or@@ -55,6 +58,7 @@   DEF_TYPE, DEF_DEV, DEF_SEQUENCE,   DEF_BAUD, DEF_SAMPLE, DEF_DELTA, DEF_ACCEL, DEF_SCALE, DEF_SCALE /*scaley*/,   DEF_TIME, DEF_CLUSTER, DEF_THREE, DEF_TOGGLE, DEF_GLIDEPOINT_TAP,+  DEF_WHEEL, DEF_NO_MIDDLE,   (Gpm_Type *)NULL }; Only in ../imwheel/gpm-imwheel: mouse-test.c.orig

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?