Contents of /trunk/xorg-old/patches-6.9.0-r1/9010_all_6.7.99.1-logitech-ps2-plusplus-v2.patch
Parent Directory | Revision Log
Revision 167 -
(show annotations)
(download)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 5449 byte(s)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 5449 byte(s)
-import
1 | diff -rup xc-orig/programs/Xserver/hw/xfree86/input/mouse/mouse.c xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c |
2 | --- xc-orig/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2003-02-10 19:33:06.000000000 -0800 |
3 | +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2003-03-05 13:52:30.000000000 -0800 |
4 | @@ -189,6 +189,7 @@ typedef enum { |
5 | OPTION_X_AXIS_MAPPING, |
6 | OPTION_Y_AXIS_MAPPING, |
7 | OPTION_AUTO_SOFT, |
8 | + OPTION_LOGITECH_SMS, |
9 | OPTION_CLEAR_DTR, |
10 | OPTION_CLEAR_RTS, |
11 | OPTION_BAUD_RATE, |
12 | @@ -226,6 +227,7 @@ static const OptionInfoRec mouseOptions[ |
13 | { OPTION_X_AXIS_MAPPING, "XAxisMapping", OPTV_STRING, {0}, FALSE }, |
14 | { OPTION_Y_AXIS_MAPPING, "YAxisMapping", OPTV_STRING, {0}, FALSE }, |
15 | { OPTION_AUTO_SOFT, "AutoSoft", OPTV_BOOLEAN, {0}, FALSE }, |
16 | + { OPTION_LOGITECH_SMS, "SmartScroll", OPTV_INTEGER, {0}, FALSE }, |
17 | /* serial options */ |
18 | { OPTION_CLEAR_DTR, "ClearDTR", OPTV_BOOLEAN, {0}, FALSE }, |
19 | { OPTION_CLEAR_RTS, "ClearRTS", OPTV_BOOLEAN, {0}, FALSE }, |
20 | @@ -700,6 +702,12 @@ MouseHWOptions(InputInfoPtr pInfo) |
21 | = xf86SetBoolOption(pInfo->options, "AutoSoft", FALSE))) { |
22 | xf86Msg(X_CONFIG, "Don't initialize mouse when auto-probing\n"); |
23 | } |
24 | + |
25 | + pMse->smartScroll = xf86SetIntOption(pInfo->options, "SmartScroll", 1); |
26 | + if (pMse->smartScroll) { |
27 | + xf86Msg(X_CONFIG, "%s: SmartScroll: %d \n", pInfo->name, |
28 | + pMse->smartScroll); |
29 | + } |
30 | pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0); |
31 | if (pMse->sampleRate) { |
32 | xf86Msg(X_CONFIG, "%s: SampleRate: %d\n", pInfo->name, |
33 | @@ -1381,20 +1389,36 @@ MouseReadInput(InputInfoPtr pInfo) |
34 | buttons = (pBuf[0] & 0x04) >> 1 | /* Middle */ |
35 | (pBuf[0] & 0x02) >> 1 | /* Right */ |
36 | (pBuf[0] & 0x01) << 2; /* Left */ |
37 | - dx = (pBuf[0] & 0x10) ? pBuf[1] - 256 : pBuf[1]; |
38 | - if (((pBuf[0] & 0x48) == 0x48) && |
39 | - (abs(dx) > 191) && |
40 | - ((((pBuf[2] & 0x03) << 2) | 0x02) == (pBuf[1] & 0x0f))) { |
41 | + |
42 | + /* |
43 | + * PS2++ now uses 6 bits for type, 8 for data |
44 | + * 2 type bits were implied to be always-on |
45 | + */ |
46 | + if ( ((pBuf[0] & 0x48) == 0x48) && ((pBuf[1] & 0x02) == 0x02) ) |
47 | + { |
48 | /* extended data packet */ |
49 | - switch ((((pBuf[0] & 0x30) >> 2) | ((pBuf[1] & 0x30) >> 4))) { |
50 | - case 1: /* wheel data packet */ |
51 | + switch ( (pBuf[0] & 0x30) | |
52 | + ( (pBuf[1] & 0xf0) >> 4) ) { |
53 | + case 0x0d: /* P1 - wheel data, buttons 4, 5 packet */ |
54 | + buttons |= ( pMse->lastButtons & ~0x18); |
55 | buttons |= ((pBuf[2] & 0x10) ? 0x08 : 0) | /* 4th button */ |
56 | ((pBuf[2] & 0x20) ? 0x10 : 0); /* 5th button */ |
57 | dx = dy = 0; |
58 | dz = (pBuf[2] & 0x08) ? (pBuf[2] & 0x0f) - 16 : |
59 | (pBuf[2] & 0x0f); |
60 | break; |
61 | - case 2: /* Logitech reserves this packet type */ |
62 | + case 0x0e: /* P2 - buttons 4,5,6,7,8,9,10 info - NEW */ |
63 | + buttons |= ( pMse->lastButtons & ~0x3f8); |
64 | + buttons |= ((pBuf[2] & 0x7f) << 3); |
65 | + break; |
66 | +#if 0 |
67 | + /* |
68 | + * formerly case 2: Logitech updated PS/2++ (MMPS2), |
69 | + * and I guess it broke compatibility with manufacturers |
70 | + * that were latching onto it |
71 | + * is this what PS2TPP I see in the Linux 2.5.x |
72 | + * kernel source (psmouse.c) is for? |
73 | + */ |
74 | /* |
75 | * IBM ScrollPoint uses this packet to encode its |
76 | * stick movement. |
77 | @@ -1405,7 +1429,7 @@ MouseReadInput(InputInfoPtr pInfo) |
78 | ((pBuf[2] >> 4) & 0x0f); |
79 | dw = (pBuf[2] & 0x08) ? (pBuf[2] & 0x0f) - 16 : |
80 | (pBuf[2] & 0x0f); |
81 | - break; |
82 | +#endif |
83 | case 0: /* device type packet - shouldn't happen */ |
84 | default: |
85 | buttons |= (pMse->lastButtons & ~0x07); |
86 | @@ -2635,7 +2659,12 @@ initMouseHW(InputInfoPtr pInfo) |
87 | pMse->resolution); |
88 | } else { |
89 | unsigned char c2[2]; |
90 | - |
91 | + unsigned char sms[] = { 0xe6, |
92 | + 0xe8, 0, 0xe8, 3, |
93 | + 0xe8, 0, 0xe8, 2, |
94 | + 0xe8, 0, 0xe8, 0, |
95 | + 0xe8, 0, 0xe8, 0 }; |
96 | + |
97 | c = 0xE6; /*230*/ /* 1:1 scaling */ |
98 | if (!ps2SendPacket(pInfo,&c,1)) { |
99 | if (!count--) |
100 | @@ -2664,6 +2693,18 @@ initMouseHW(InputInfoPtr pInfo) |
101 | return TRUE; |
102 | goto REDO; |
103 | } |
104 | + /* |
105 | + * this is on by default, but some users (me) |
106 | + * like it off |
107 | + */ |
108 | + if (pMse->smartScroll) |
109 | + sms[16] |= 1; |
110 | + if (!ps2SendPacket(pInfo, sms, 17)) { |
111 | + if (!count--) |
112 | + return TRUE; |
113 | + goto REDO; |
114 | + } |
115 | + |
116 | c2[0] = 0xE8; /*232*/ /* set device resolution */ |
117 | if (pMse->resolution > 0) { |
118 | if (pMse->resolution >= 200) |
119 | @@ -2677,11 +2718,20 @@ initMouseHW(InputInfoPtr pInfo) |
120 | } else { |
121 | c2[1] = 2; |
122 | } |
123 | - if (!ps2SendPacket(pInfo,c2,2)) { |
124 | + if (pMse->resolution >= 800) { |
125 | + /* for Logitech mice that support it */ |
126 | + unsigned char cpi800[] = { 0xe6, 0xe6, 0xe6, 0xe8, 3 }; |
127 | + if (!ps2SendPacket(pInfo, cpi800, 5)) { |
128 | + if (!count--) |
129 | + return TRUE; |
130 | + goto REDO; |
131 | + } |
132 | + } else if (!ps2SendPacket(pInfo,c2,2)) { |
133 | if (!count--) |
134 | return TRUE; |
135 | goto REDO; |
136 | - } |
137 | + } |
138 | + |
139 | usleep(30000); |
140 | xf86FlushInput(pInfo->fd); |
141 | if (!ps2EnableDataReporting(pInfo)) { |
142 | --- xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h.orig 2004-08-11 15:06:24.000000000 -0400 |
143 | +++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h 2004-08-11 15:07:13.000000000 -0400 |
144 | @@ -268,6 +268,7 @@ |
145 | dataGoodProc dataGood; |
146 | int angleOffset; |
147 | pointer pDragLock; /* drag lock area */ |
148 | + int smartScroll; |
149 | int xisbscale; /* buffer size for 1 event */ |
150 | } MouseDevRec, *MouseDevPtr; |
151 | |
152 |