📄 imwheel3.patch
字号:
break; case 'b': opt_baud = atoi(optarg); break;! case 'B': { ! if (0==strncmp(optarg,"wheel",1))! { opt_wheel_swap=1; }! else! { opt_sequence = optarg; }! break;! } case 'd': opt_delta = atoi(optarg); break; case 'D': gpm_log_daemon = 0; break; case 'g':****************** 395,400 ****--- 407,414 ---- case 'V': gpm_debug_level += (0 == optarg ? 1 : strtol(optarg, 0, 0)); break;+ case 'w': opt_wheel=1; break;+ case 'W': opt_wheel_repeater=1; break; case '2': opt_three=-1; break; case '3': opt_three=1; break; default:****************** 416,422 **** if ((fifofd=open(GPM_NODE_FIFO, O_RDWR|O_NONBLOCK))<0) { oops(GPM_NODE_FIFO); } }! /* duplicate initialization */ --- 430,442 ---- if ((fifofd=open(GPM_NODE_FIFO, O_RDWR|O_NONBLOCK))<0) { oops(GPM_NODE_FIFO); } }! if (opt_wheel_repeater)! {! if (mkfifo(GPM_WHEEL_FIFO,0666) && errno!=EEXIST)! oops(GPM_WHEEL_FIFO);! if ((wheel_fifofd=open(GPM_WHEEL_FIFO, O_RDWR|O_NONBLOCK))<0)! oops(GPM_WHEEL_FIFO);! } /* duplicate initialization */ diff -c gpm-cvstree.orig/liblow.c gpm-cvstree/liblow.c*** gpm-cvstree.orig/liblow.c Thu Jan 27 23:19:29 2000--- gpm-cvstree/liblow.c Mon Feb 14 18:28:31 2000****************** 5,10 ****--- 5,13 ---- * Copyright 1994,1995 rubini@linux.it (Alessandro Rubini) * Copyright (C) 1998 Ian Zimmerman <itz@rahul.net> * + * Modified on 9/8/1998 by Jonathan Atkins for use with wheel mice+ * <jcatki@most.fw.hac.com>+ * * xterm management is mostly by jtklehto@stekt.oulu.fi (Janne Kukonlehto) * * This program is free software; you can redistribute it and/or modify****************** 632,637 ****--- 635,642 ---- case 0: ePtr->buttons=GPM_B_LEFT; break; case 1: ePtr->buttons=GPM_B_MIDDLE; break; case 2: ePtr->buttons=GPM_B_RIGHT; break;+ case 3: ePtr->buttons=GPM_B_UP; break;+ case 4: ePtr->buttons=GPM_B_DOWN; break; default: /* Nothing */ break; } }diff -c gpm-cvstree.orig/mev.c gpm-cvstree/mev.c*** gpm-cvstree.orig/mev.c Tue Jan 18 06:10:30 2000--- gpm-cvstree/mev.c Mon Feb 14 18:28:31 2000****************** 4,9 ****--- 4,12 ---- * Copyright 1994,1995 rubini@linux.it (Alessandro Rubini) * Copyright (C) 1998 Ian Zimmerman <itz@rahul.net> *+ * Modified on 9/8/1998 by Jonathan Atkins for use with wheel mice+ * <jcatki@most.fw.hac.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, ordiff -c gpm-cvstree.orig/mice.c gpm-cvstree/mice.c*** gpm-cvstree.orig/mice.c Tue Feb 8 00:13:02 2000--- gpm-cvstree/mice.c Mon Feb 14 18:40:23 2000****************** 6,11 ****--- 6,14 ---- * Copyright (C) 1994-2000 Alessandro Rubini <rubini@linux.it> * Copyright (C) 1998,1999 Ian Zimmerman <itz@rahul.net> *+ * Modified on 9/8/1998 by Jonathan Atkins for use with wheel mice+ * <jcatki@most.fw.hac.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****************** 48,53 ****--- 51,57 ---- #include <fcntl.h> #include <termios.h> #include <errno.h>+ #include <string.h> #include <unistd.h> #include <strings.h> #include <ctype.h>****************** 364,369 ****--- 368,377 ---- | ((data[0] & 0x10) >> 4); /* right */ state->dx= (signed char)(((data[0] & 0x03) << 6) | (data[1] & 0x3F)); state->dy= (signed char)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F));+ if ((data[3] & 0x0f) == 0xf)+ state->buttons |= GPM_B_UP;+ else if ((data[3] & 0x0f) == 0x1)+ state->buttons |= GPM_B_DOWN; /* wheel (dz??) is (data[3] & 0x0f) */ return 0;****************** 469,482 **** static int tap_active=0; /* there exist glidepoint ps2 mice */ state->buttons=! !!(data[0]&1) * GPM_B_LEFT +! !!(data[0]&2) * GPM_B_RIGHT +! !!(data[0]&4) * GPM_B_MIDDLE;! if (data[0]==0 && opt_glidepoint_tap) /* by default this is false */ state->buttons = tap_active = opt_glidepoint_tap; else if (tap_active)! if (data[0]==8) state->buttons = tap_active = 0; else state->buttons = tap_active; --- 477,500 ---- static int tap_active=0; /* there exist glidepoint ps2 mice */ state->buttons=! !!(data[0]&1) * GPM_B_LEFT |! !!(data[0]&2) * GPM_B_RIGHT |! !!(data[0]&4) * GPM_B_MIDDLE|! ((data[3]==0xff)?GPM_B_UP:0) |! ((data[3]==0x01)?GPM_B_DOWN:0);! #if 0! LOG(("Buttons: %d %d %d %d %d\n",! (state->buttons&GPM_B_LEFT),! (state->buttons&GPM_B_MIDDLE),! (state->buttons&GPM_B_RIGHT),! (state->buttons&GPM_B_UP),! (state->buttons&GPM_B_DOWN)));! LOG(("wheel? %d\n",opt_wheel));! #endif if (data[0]==0 && opt_glidepoint_tap) /* by default this is false */ state->buttons = tap_active = opt_glidepoint_tap; else if (tap_active)! if (data[0]==8 && !opt_wheel) state->buttons = tap_active = 0; else state->buttons = tap_active; ****************** 540,568 **** struct Gpm_Type *type, int argc, char **argv) { unsigned char magic[6] = { 0xe8, 0x03, 0xe6, 0xe6, 0xe6, 0xe9 };! int i;! ! if (check_no_argv(argc, argv)) return NULL;! for (i=0; i<6; i++) {! unsigned char c = 0;! write( fd, magic+i, 1 );! read( fd, &c, 1 );! if (c != 0xfa) {! fprintf( stderr, "netmouse: No acknowledge (got %d)\n", c );! return NULL; } }! {! unsigned char rep[3] = { 0, 0, 0 };! read( fd, rep, 1 );! read( fd, rep+1, 1 );! read( fd, rep+2, 1 );! if (rep[0] || (rep[1] != 0x33) || (rep[2] != 0x55)) {! fprintf( stderr, "netmouse: Invalid reply magic (got %d,%d,%d)\n", rep[0], rep[1], rep[2] );! return NULL; } }! return type; } #define GPM_B_BOTH (GPM_B_LEFT|GPM_B_RIGHT)--- 558,688 ---- struct Gpm_Type *type, int argc, char **argv) { unsigned char magic[6] = { 0xe8, 0x03, 0xe6, 0xe6, 0xe6, 0xe9 };! int i,j,k;! /* Sometimes is mouse in bad state and first initialization may fail.! Do it 3*6 times.! */! k=3;! while (k>0)! { i=0; j=6;! while (i<6) {! unsigned char c = 0;! write( fd, magic+i, 1 );! read( fd, &c, 1 );! if (c != 0xfa) {! if ((j--)==0)! { fprintf( stderr, "netmouse: No acknowledge (got %d/%d)\n", c, i);! return NULL;! }! else! { i=0; }! }! else! { i++; }! }! {! unsigned char rep[3] = { 0, 0, 0 };! read( fd, rep, 1 );! read( fd, rep+1, 1 );! read( fd, rep+2, 1 );! if (rep[0] || (rep[1] != 0x33) || (rep[2] != 0x55)) {! if (k==1)! { fprintf( stderr, "netmouse: Invalid reply magic (got %d,%d,%d)\n", rep[0], rep[1], rep[2] );! return NULL;! }! else! { k--; }! }! else! { return type; } } }! return NULL;! }! ! static int M_netmousepro(Gpm_Event *state, unsigned char *data)! {! /* Avoid this beasts if you can. They connect to normal PS/2 port,! but their protocol is one byte longer... So if you have notebook! (like me) with internal PS/2 mouse, it will not work! together. They have four buttons, but two middle buttons can not! be pressed simultaneously, and two middle buttons do not send! 'up' events (however, they autorepeat...)! ! Still, you might want to run this mouse in plain PS/2 mode -! where it behaves correctly except that middle 2 buttons do! nothing.! ! Protocol is! 3 bytes like normal PS/2! 4th byte: 0xff button 'down', 0x01 button 'up'! [this is so braindamaged that it *must* be some kind of! compatibility glue...]! ! Pavel Machek <pavel@ucw.cz>! */! ! state->buttons=! !!(data[0]&1) * GPM_B_LEFT +! !!(data[0]&2) * GPM_B_RIGHT +! !!(data[0]&4) * GPM_B_MIDDLE;! if (data[3]==0x01) { state->buttons |= GPM_B_DOWN; }! if (data[3]==0xff) { state->buttons |= GPM_B_UP; }! ! 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;! return 0;! }! ! static Gpm_Type *I_netmousepro(int fd, unsigned short flags, struct Gpm_Type *type)! {! unsigned char magic[6] = { 0xe8, 0x03, 0xe6, 0xe6, 0xe6, 0xe9 };! int i,j,k;! /* Sometimes is mouse in bad state and first initialization may fail.! Do it 3*6 times.! */! k=3;! while (k>0)! { i=0; j=6;! while (i<6) {! unsigned char c = 0;! write( fd, magic+i, 1 );! read( fd, &c, 1 );! if (c != 0xfa) {! if ((j--)==0)! { fprintf( stderr, "netmouse: No acknowledge (got %d/%d)\n", c, i);! return NULL;! }! else! { i=0; }! }! else! { i++; }! }! {! unsigned char rep[3] = { 0, 0, 0 };! read( fd, rep, 1 );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -