| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | */ | | 28 | */ |
29 | /* Patch for PS/2 Intellimouse - Tim Goodwin 1997-11-06. */ | | 29 | /* Patch for PS/2 Intellimouse - Tim Goodwin 1997-11-06. */ |
30 | | | 30 | |
31 | /* | | 31 | /* |
32 | * [JCH-96/01/21] Added fourth button support for PROT_GLIDEPOINT mouse | | 32 | * [JCH-96/01/21] Added fourth button support for PROT_GLIDEPOINT mouse |
33 | * protocol. | | 33 | * protocol. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | /* | | 36 | /* |
37 | * [TVO-97/03/05] Added microsoft IntelliMouse support | | 37 | * [TVO-97/03/05] Added microsoft IntelliMouse support |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | /* | | 40 | /* |
41 | * [PME-02/08/11] Added suport for drag lock buttons | | 41 | * [PME-02/08/11] Added support for drag lock buttons |
42 | * for use with 4 button trackballs for convenience | | 42 | * for use with 4 button trackballs for convenience |
43 | * and to help limited dexterity persons | | 43 | * and to help limited dexterity persons |
44 | */ | | 44 | */ |
45 | | | 45 | |
46 | #ifdef HAVE_CONFIG_H | | 46 | #ifdef HAVE_CONFIG_H |
47 | #include "config.h" | | 47 | #include "config.h" |
48 | #endif | | 48 | #endif |
49 | | | 49 | |
50 | #include <xorg-server.h> | | 50 | #include <xorg-server.h> |
51 | #include <math.h> | | 51 | #include <math.h> |
52 | #include <string.h> | | 52 | #include <string.h> |
53 | #include <stdio.h> | | 53 | #include <stdio.h> |
54 | #include <stdlib.h> | | 54 | #include <stdlib.h> |
| @@ -166,32 +166,38 @@ static void ps2BlockHandler(pointer data | | | @@ -166,32 +166,38 @@ static void ps2BlockHandler(pointer data |
166 | #endif | | 166 | #endif |
167 | static void Emulate3ButtonsSetEnabled(InputInfoPtr pInfo, Bool enable); | | 167 | static void Emulate3ButtonsSetEnabled(InputInfoPtr pInfo, Bool enable); |
168 | | | 168 | |
169 | /* mouse autoprobe stuff */ | | 169 | /* mouse autoprobe stuff */ |
170 | static const char *autoOSProtocol(InputInfoPtr pInfo, int *protoPara); | | 170 | static const char *autoOSProtocol(InputInfoPtr pInfo, int *protoPara); |
171 | static void autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync); | | 171 | static void autoProbeMouse(InputInfoPtr pInfo, Bool inSync, Bool lostSync); |
172 | static void checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy); | | 172 | static void checkForErraticMovements(InputInfoPtr pInfo, int dx, int dy); |
173 | static Bool collectData(MouseDevPtr pMse, unsigned char u); | | 173 | static Bool collectData(MouseDevPtr pMse, unsigned char u); |
174 | static void SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID); | | 174 | static void SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID); |
175 | static Bool autoGood(MouseDevPtr pMse); | | 175 | static Bool autoGood(MouseDevPtr pMse); |
176 | | | 176 | |
177 | #undef MOUSE | | 177 | #undef MOUSE |
178 | _X_EXPORT InputDriverRec MOUSE = { | | 178 | _X_EXPORT InputDriverRec MOUSE = { |
179 | 1, | | 179 | .driverVersion = 1, |
180 | "mouse", | | 180 | .driverName = "mouse", |
181 | NULL, | | 181 | .Identify = NULL, |
182 | MousePreInit, | | 182 | .PreInit = MousePreInit, |
183 | NULL, | | 183 | .UnInit = NULL, |
184 | NULL, | | 184 | .module = NULL, |
| | | 185 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 |
| | | 186 | .default_options = NULL, |
| | | 187 | #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 21 |
| | | 188 | .capabilities = 0 |
| | | 189 | #endif |
| | | 190 | #endif |
185 | }; | | 191 | }; |
186 | | | 192 | |
187 | #define RETRY_COUNT 4 | | 193 | #define RETRY_COUNT 4 |
188 | | | 194 | |
189 | /* Properties that can be set at runtime via xinput */ | | 195 | /* Properties that can be set at runtime via xinput */ |
190 | static Atom prop_mbemu = 0; /* Middle button emulation on/off property */ | | 196 | static Atom prop_mbemu = 0; /* Middle button emulation on/off property */ |
191 | static Atom prop_mbtimeout = 0; /* Middle button timeout property */ | | 197 | static Atom prop_mbtimeout = 0; /* Middle button timeout property */ |
192 | | | 198 | |
193 | /* | | 199 | /* |
194 | * Microsoft (all serial models), Logitech MouseMan, First Mouse, etc, | | 200 | * Microsoft (all serial models), Logitech MouseMan, First Mouse, etc, |
195 | * ALPS GlidePoint, Thinking Mouse. | | 201 | * ALPS GlidePoint, Thinking Mouse. |
196 | */ | | 202 | */ |
197 | static const char *msDefaults[] = { | | 203 | static const char *msDefaults[] = { |
| @@ -809,28 +815,28 @@ InitProtocols(void) | | | @@ -809,28 +815,28 @@ InitProtocols(void) |
809 | return FALSE; | | 815 | return FALSE; |
810 | | | 816 | |
811 | /* Mark unsupported interface classes. */ | | 817 | /* Mark unsupported interface classes. */ |
812 | for (i = 0; mouseProtocols[i].name; i++) | | 818 | for (i = 0; mouseProtocols[i].name; i++) |
813 | if (!(mouseProtocols[i].class & classes)) | | 819 | if (!(mouseProtocols[i].class & classes)) |
814 | mouseProtocols[i].id = PROT_UNSUP; | | 820 | mouseProtocols[i].id = PROT_UNSUP; |
815 | | | 821 | |
816 | for (i = 0; mouseProtocols[i].name; i++) | | 822 | for (i = 0; mouseProtocols[i].name; i++) |
817 | if (mouseProtocols[i].class & MSE_MISC) | | 823 | if (mouseProtocols[i].class & MSE_MISC) |
818 | if (!osInfo->CheckProtocol || | | 824 | if (!osInfo->CheckProtocol || |
819 | !osInfo->CheckProtocol(mouseProtocols[i].name)) | | 825 | !osInfo->CheckProtocol(mouseProtocols[i].name)) |
820 | mouseProtocols[i].id = PROT_UNSUP; | | 826 | mouseProtocols[i].id = PROT_UNSUP; |
821 | | | 827 | |
822 | #ifdef __NetBSD__ | | | |
823 | /* NetBSD uses PROT_BM for "PS/2". */ | | 828 | /* NetBSD uses PROT_BM for "PS/2". */ |
| | | 829 | #if defined(__NetBSD__) |
824 | for (i = 0; mouseProtocols[i].name; i++) | | 830 | for (i = 0; mouseProtocols[i].name; i++) |
825 | if (mouseProtocols[i].id == PROT_PS2) | | 831 | if (mouseProtocols[i].id == PROT_PS2) |
826 | mouseProtocols[i].id = PROT_BM; | | 832 | mouseProtocols[i].id = PROT_BM; |
827 | #endif | | 833 | #endif |
828 | | | 834 | |
829 | return TRUE; | | 835 | return TRUE; |
830 | } | | 836 | } |
831 | | | 837 | |
832 | static const char* | | 838 | static const char* |
833 | MouseFindDevice(InputInfoPtr pInfo, const char* protocol) | | 839 | MouseFindDevice(InputInfoPtr pInfo, const char* protocol) |
834 | { | | 840 | { |
835 | const char *device; | | 841 | const char *device; |
836 | | | 842 | |
| @@ -1185,27 +1191,27 @@ MouseReadInput(InputInfoPtr pInfo) | | | @@ -1185,27 +1191,27 @@ MouseReadInput(InputInfoPtr pInfo) |
1185 | unsigned char *pBuf, u; | | 1191 | unsigned char *pBuf, u; |
1186 | | | 1192 | |
1187 | | | 1193 | |
1188 | pMse = pInfo->private; | | 1194 | pMse = pInfo->private; |
1189 | pBufP = pMse->protoBufTail; | | 1195 | pBufP = pMse->protoBufTail; |
1190 | pBuf = pMse->protoBuf; | | 1196 | pBuf = pMse->protoBuf; |
1191 | | | 1197 | |
1192 | if (pInfo->fd == -1) | | 1198 | if (pInfo->fd == -1) |
1193 | return; | | 1199 | return; |
1194 | | | 1200 | |
1195 | /* | | 1201 | /* |
1196 | * Set blocking to -1 on the first call because we know there is data to | | 1202 | * Set blocking to -1 on the first call because we know there is data to |
1197 | * read. Xisb automatically clears it after one successful read so that | | 1203 | * read. Xisb automatically clears it after one successful read so that |
1198 | * succeeding reads are preceeded by a select with a 0 timeout to prevent | | 1204 | * succeeding reads are preceded by a select with a 0 timeout to prevent |
1199 | * read from blocking indefinitely. | | 1205 | * read from blocking indefinitely. |
1200 | */ | | 1206 | */ |
1201 | XisbBlockDuration(pMse->buffer, -1); | | 1207 | XisbBlockDuration(pMse->buffer, -1); |
1202 | | | 1208 | |
1203 | while ((c = XisbRead(pMse->buffer)) >= 0) { | | 1209 | while ((c = XisbRead(pMse->buffer)) >= 0) { |
1204 | u = (unsigned char)c; | | 1210 | u = (unsigned char)c; |
1205 | | | 1211 | |
1206 | #if defined (EXTMOUSEDEBUG) || defined (MOUSEDATADEBUG) | | 1212 | #if defined (EXTMOUSEDEBUG) || defined (MOUSEDATADEBUG) |
1207 | LogMessageVerbSigSafe(X_INFO, -1, "mouse byte: %x\n",u); | | 1213 | LogMessageVerbSigSafe(X_INFO, -1, "mouse byte: %x\n",u); |
1208 | #endif | | 1214 | #endif |
1209 | | | 1215 | |
1210 | /* if we do autoprobing collect the data */ | | 1216 | /* if we do autoprobing collect the data */ |
1211 | if (pMse->collectData && pMse->autoProbe) | | 1217 | if (pMse->collectData && pMse->autoProbe) |
| @@ -1245,31 +1251,31 @@ MouseReadInput(InputInfoPtr pInfo) | | | @@ -1245,31 +1251,31 @@ MouseReadInput(InputInfoPtr pInfo) |
1245 | * even 0x02/0x22, so I have to strip off the lower bits. | | 1251 | * even 0x02/0x22, so I have to strip off the lower bits. |
1246 | * [CHRIS-211092] | | 1252 | * [CHRIS-211092] |
1247 | * | | 1253 | * |
1248 | * [JCH-96/01/21] | | 1254 | * [JCH-96/01/21] |
1249 | * HACK for ALPS "fourth button". (It's bit 0x10 of the | | 1255 | * HACK for ALPS "fourth button". (It's bit 0x10 of the |
1250 | * "fourth byte" and it is activated by tapping the glidepad | | 1256 | * "fourth byte" and it is activated by tapping the glidepad |
1251 | * with the finger! 8^) We map it to bit bit3, and the | | 1257 | * with the finger! 8^) We map it to bit bit3, and the |
1252 | * reverse map in xf86Events just has to be extended so that | | 1258 | * reverse map in xf86Events just has to be extended so that |
1253 | * it is identified as Button 4. The lower half of the | | 1259 | * it is identified as Button 4. The lower half of the |
1254 | * reverse-map may remain unchanged. | | 1260 | * reverse-map may remain unchanged. |
1255 | */ | | 1261 | */ |
1256 | /* | | 1262 | /* |
1257 | * [KAZU-030897] | | 1263 | * [KAZU-030897] |
1258 | * Receive the fourth byte only when preceeding three bytes | | 1264 | * Receive the fourth byte only when preceding three bytes |
1259 | * have been detected (pBufP >= pMse->protoPara[4]). In the | | 1265 | * have been detected (pBufP >= pMse->protoPara[4]). In the |
1260 | * previous versions, the test was pBufP == 0; we may have | | 1266 | * previous versions, the test was pBufP == 0; we may have |
1261 | * mistakingly received a byte even if we didn't see anything | | 1267 | * mistakingly received a byte even if we didn't see anything |
1262 | * preceeding the byte. | | 1268 | * preceding the byte. |
1263 | */ | | 1269 | */ |
1264 | #ifdef EXTMOUSEDEBUG | | 1270 | #ifdef EXTMOUSEDEBUG |
1265 | LogMessageVerbSigSafe(X_INFO, -1, "mouse 4th byte %x\n",u); | | 1271 | LogMessageVerbSigSafe(X_INFO, -1, "mouse 4th byte %x\n",u); |
1266 | #endif | | 1272 | #endif |
1267 | dx = dy = dz = dw = 0; | | 1273 | dx = dy = dz = dw = 0; |
1268 | buttons = 0; | | 1274 | buttons = 0; |
1269 | switch (pMse->protocolID) { | | 1275 | switch (pMse->protocolID) { |
1270 | | | 1276 | |
1271 | /* | | 1277 | /* |
1272 | * [KAZU-221197] | | 1278 | * [KAZU-221197] |
1273 | * IntelliMouse, NetMouse (including NetMouse Pro) and Mie | | 1279 | * IntelliMouse, NetMouse (including NetMouse Pro) and Mie |
1274 | * Mouse always send the fourth byte, whereas the fourth byte | | 1280 | * Mouse always send the fourth byte, whereas the fourth byte |
1275 | * is optional for GlidePoint and ThinkingMouse. The fourth | | 1281 | * is optional for GlidePoint and ThinkingMouse. The fourth |
| @@ -1898,27 +1904,27 @@ FlushButtons(MouseDevPtr pMse) | | | @@ -1898,27 +1904,27 @@ FlushButtons(MouseDevPtr pMse) |
1898 | * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) | | 1904 | * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) |
1899 | * left down to right down without anything in between, so all cases must be | | 1905 | * left down to right down without anything in between, so all cases must be |
1900 | * handled. | | 1906 | * handled. |
1901 | * | | 1907 | * |
1902 | * a handler consists of three values: | | 1908 | * a handler consists of three values: |
1903 | * 0: action1 | | 1909 | * 0: action1 |
1904 | * 1: action2 | | 1910 | * 1: action2 |
1905 | * 2: new emulation state | | 1911 | * 2: new emulation state |
1906 | * | | 1912 | * |
1907 | * action > 0: ButtonPress | | 1913 | * action > 0: ButtonPress |
1908 | * action = 0: nothing | | 1914 | * action = 0: nothing |
1909 | * action < 0: ButtonRelease | | 1915 | * action < 0: ButtonRelease |
1910 | * | | 1916 | * |
1911 | * The comment preceeding each section is the current emulation state. | | 1917 | * The comment preceding each section is the current emulation state. |
1912 | * The comments to the right are of the form | | 1918 | * The comments to the right are of the form |
1913 | * <button state> (<events>) -> <new emulation state> | | 1919 | * <button state> (<events>) -> <new emulation state> |
1914 | * which should be read as | | 1920 | * which should be read as |
1915 | * If the buttons are in <button state>, generate <events> then go to | | 1921 | * If the buttons are in <button state>, generate <events> then go to |
1916 | * <new emulation state>. | | 1922 | * <new emulation state>. |
1917 | */ | | 1923 | */ |
1918 | static signed char stateTab[11][5][3] = { | | 1924 | static signed char stateTab[11][5][3] = { |
1919 | /* 0 ground */ | | 1925 | /* 0 ground */ |
1920 | { | | 1926 | { |
1921 | { 0, 0, 0 }, /* nothing -> ground (no change) */ | | 1927 | { 0, 0, 0 }, /* nothing -> ground (no change) */ |
1922 | { 0, 0, 1 }, /* left -> delayed left */ | | 1928 | { 0, 0, 1 }, /* left -> delayed left */ |
1923 | { 0, 0, 2 }, /* right -> delayed right */ | | 1929 | { 0, 0, 2 }, /* right -> delayed right */ |
1924 | { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ | | 1930 | { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ |
| @@ -2576,58 +2582,57 @@ static unsigned char proto[PROT_NUMPROTO | | | @@ -2576,58 +2582,57 @@ static unsigned char proto[PROT_NUMPROTO |
2576 | { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */ | | 2582 | { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff, MPF_NONE }, /* Auto (dummy) */ |
2577 | { 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */ | | 2583 | { 0xf8, 0x80, 0x00, 0x00, 8, 0x00, 0xff, MPF_NONE }, /* SysMouse */ |
2578 | }; | | 2584 | }; |
2579 | | | 2585 | |
2580 | | | 2586 | |
2581 | /* | | 2587 | /* |
2582 | * SetupMouse -- | | 2588 | * SetupMouse -- |
2583 | * Sets up the mouse parameters | | 2589 | * Sets up the mouse parameters |
2584 | */ | | 2590 | */ |
2585 | static Bool | | 2591 | static Bool |
2586 | SetupMouse(InputInfoPtr pInfo) | | 2592 | SetupMouse(InputInfoPtr pInfo) |
2587 | { | | 2593 | { |
2588 | MouseDevPtr pMse; | | 2594 | MouseDevPtr pMse; |
2589 | int i; | | | |
2590 | int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; | | 2595 | int protoPara[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; |
2591 | const char *name = NULL; | | 2596 | const char *name = NULL; |
2592 | Bool automatic = FALSE; | | 2597 | Bool automatic = FALSE; |
2593 | | | 2598 | |
2594 | pMse = pInfo->private; | | 2599 | pMse = pInfo->private; |
2595 | | | 2600 | |
2596 | /* Handle the "Auto" protocol. */ | | 2601 | /* Handle the "Auto" protocol. */ |
2597 | if (pMse->protocolID == PROT_AUTO) { | | 2602 | if (pMse->protocolID == PROT_AUTO) { |
2598 | /* | | 2603 | /* |
2599 | * We come here when user specifies protocol "auto" in | | 2604 | * We come here when user specifies protocol "auto" in |
2600 | * the configuration file or thru the xf86misc extensions. | | 2605 | * the configuration file or through the xf86misc extensions. |
2601 | * So we initialize autoprobing here. | | 2606 | * So we initialize autoprobing here. |
2602 | * Probe for PnP/OS mouse first. If unsuccessful | | 2607 | * Probe for PnP/OS mouse first. If unsuccessful |
2603 | * try to guess protocol from incoming data. | | 2608 | * try to guess protocol from incoming data. |
2604 | */ | | 2609 | */ |
2605 | automatic = TRUE; | | 2610 | automatic = TRUE; |
2606 | pMse->autoProbe = TRUE; | | 2611 | pMse->autoProbe = TRUE; |
2607 | name = autoOSProtocol(pInfo,protoPara); | | 2612 | name = autoOSProtocol(pInfo,protoPara); |
2608 | if (name) { | | 2613 | if (name) { |
2609 | #ifdef EXTMOUSEDEBUG | | 2614 | #ifdef EXTMOUSEDEBUG |
2610 | ErrorF("PnP/OS Mouse detected: %s\n",name); | | 2615 | ErrorF("PnP/OS Mouse detected: %s\n",name); |
2611 | #endif | | 2616 | #endif |
2612 | } | | 2617 | } |
2613 | } | | 2618 | } |
2614 | | | 2619 | |
2615 | SetMouseProto(pMse, pMse->protocolID); | | 2620 | SetMouseProto(pMse, pMse->protocolID); |
2616 | | | 2621 | |
2617 | if (automatic) { | | 2622 | if (automatic) { |
2618 | if (name) { | | 2623 | if (name) { |
2619 | /* Possible protoPara overrides from SetupAuto. */ | | 2624 | /* Possible protoPara overrides from SetupAuto. */ |
2620 | for (i = 0; i < sizeof(pMse->protoPara); i++) | | 2625 | for (size_t i = 0; i < sizeof(pMse->protoPara); i++) |
2621 | if (protoPara[i] != -1) | | 2626 | if (protoPara[i] != -1) |
2622 | pMse->protoPara[i] = protoPara[i]; | | 2627 | pMse->protoPara[i] = protoPara[i]; |
2623 | /* if we come here PnP/OS mouse probing was successful */ | | 2628 | /* if we come here PnP/OS mouse probing was successful */ |
2624 | } else { | | 2629 | } else { |
2625 | /* PnP/OS mouse probing wasn't successful; we look at data */ | | 2630 | /* PnP/OS mouse probing wasn't successful; we look at data */ |
2626 | } | | 2631 | } |
2627 | } | | 2632 | } |
2628 | | | 2633 | |
2629 | /* | | 2634 | /* |
2630 | * If protocol has changed fetch the default options | | 2635 | * If protocol has changed fetch the default options |
2631 | * for the new protocol. | | 2636 | * for the new protocol. |
2632 | */ | | 2637 | */ |
2633 | if (pMse->oldProtocolID != pMse->protocolID) { | | 2638 | if (pMse->oldProtocolID != pMse->protocolID) { |
| @@ -3233,27 +3238,27 @@ autoOSProtocol(InputInfoPtr pInfo, int * | | | @@ -3233,27 +3238,27 @@ autoOSProtocol(InputInfoPtr pInfo, int * |
3233 | const char *name = NULL; | | 3238 | const char *name = NULL; |
3234 | MouseProtocolID protocolID = PROT_UNKNOWN; | | 3239 | MouseProtocolID protocolID = PROT_UNKNOWN; |
3235 | | | 3240 | |
3236 | /* Check if the OS has a detection mechanism. */ | | 3241 | /* Check if the OS has a detection mechanism. */ |
3237 | if (osInfo->SetupAuto) { | | 3242 | if (osInfo->SetupAuto) { |
3238 | name = osInfo->SetupAuto(pInfo, protoPara); | | 3243 | name = osInfo->SetupAuto(pInfo, protoPara); |
3239 | if (name) { | | 3244 | if (name) { |
3240 | protocolID = ProtocolNameToID(name); | | 3245 | protocolID = ProtocolNameToID(name); |
3241 | switch (protocolID) { | | 3246 | switch (protocolID) { |
3242 | case PROT_UNKNOWN: | | 3247 | case PROT_UNKNOWN: |
3243 | /* Check for a builtin OS-specific protocol. */ | | 3248 | /* Check for a builtin OS-specific protocol. */ |
3244 | if (osInfo->CheckProtocol && osInfo->CheckProtocol(name)) { | | 3249 | if (osInfo->CheckProtocol && osInfo->CheckProtocol(name)) { |
3245 | /* We can only come here if the protocol has been | | 3250 | /* We can only come here if the protocol has been |
3246 | * changed to auto thru the xf86misc extension | | 3251 | * changed to auto through the xf86misc extension |
3247 | * and we have detected an OS specific builtin | | 3252 | * and we have detected an OS specific builtin |
3248 | * protocol. Currently we cannot handle this */ | | 3253 | * protocol. Currently we cannot handle this */ |
3249 | name = NULL; | | 3254 | name = NULL; |
3250 | } else | | 3255 | } else |
3251 | name = NULL; | | 3256 | name = NULL; |
3252 | break; | | 3257 | break; |
3253 | case PROT_UNSUP: | | 3258 | case PROT_UNSUP: |
3254 | name = NULL; | | 3259 | name = NULL; |
3255 | break; | | 3260 | break; |
3256 | default: | | 3261 | default: |
3257 | break; | | 3262 | break; |
3258 | } | | 3263 | } |
3259 | } | | 3264 | } |
| @@ -3712,26 +3717,27 @@ autoGood(MouseDevPtr pMse) | | | @@ -3712,26 +3717,27 @@ autoGood(MouseDevPtr pMse) |
3712 | if (!pMse->autoProbe) | | 3717 | if (!pMse->autoProbe) |
3713 | return TRUE; | | 3718 | return TRUE; |
3714 | | | 3719 | |
3715 | switch (mPriv->autoState) { | | 3720 | switch (mPriv->autoState) { |
3716 | case AUTOPROBE_GOOD: | | 3721 | case AUTOPROBE_GOOD: |
3717 | case AUTOPROBE_H_GOOD: | | 3722 | case AUTOPROBE_H_GOOD: |
3718 | return TRUE; | | 3723 | return TRUE; |
3719 | case AUTOPROBE_VALIDATE1: /* @@@ */ | | 3724 | case AUTOPROBE_VALIDATE1: /* @@@ */ |
3720 | case AUTOPROBE_H_VALIDATE1: /* @@@ */ | | 3725 | case AUTOPROBE_H_VALIDATE1: /* @@@ */ |
3721 | case AUTOPROBE_VALIDATE2: | | 3726 | case AUTOPROBE_VALIDATE2: |
3722 | case AUTOPROBE_H_VALIDATE2: | | 3727 | case AUTOPROBE_H_VALIDATE2: |
3723 | if (mPriv->goodCount < PROBE_UNCERTAINTY/2) | | 3728 | if (mPriv->goodCount < PROBE_UNCERTAINTY/2) |
3724 | return TRUE; | | 3729 | return TRUE; |
| | | 3730 | /* FALLTHROUGH */ |
3725 | default: | | 3731 | default: |
3726 | return FALSE; | | 3732 | return FALSE; |
3727 | } | | 3733 | } |
3728 | } | | 3734 | } |
3729 | | | 3735 | |
3730 | | | 3736 | |
3731 | #define TOT_THRESHOLD 3000 | | 3737 | #define TOT_THRESHOLD 3000 |
3732 | #define VAL_THRESHOLD 40 | | 3738 | #define VAL_THRESHOLD 40 |
3733 | | | 3739 | |
3734 | /* | | 3740 | /* |
3735 | * checkForErraticMovements() -- check if mouse 'jumps around'. | | 3741 | * checkForErraticMovements() -- check if mouse 'jumps around'. |
3736 | */ | | 3742 | */ |
3737 | static void | | 3743 | static void |
| @@ -3745,41 +3751,43 @@ checkForErraticMovements(InputInfoPtr pI | | | @@ -3745,41 +3751,43 @@ checkForErraticMovements(InputInfoPtr pI |
3745 | | | 3751 | |
3746 | #if 0 | | 3752 | #if 0 |
3747 | if (abs(dx - mPriv->prevDx) > 300 | | 3753 | if (abs(dx - mPriv->prevDx) > 300 |
3748 | || abs(dy - mPriv->prevDy) > 300) | | 3754 | || abs(dy - mPriv->prevDy) > 300) |
3749 | AP_DBG(("erratic1 behaviour\n")); | | 3755 | AP_DBG(("erratic1 behaviour\n")); |
3750 | #endif | | 3756 | #endif |
3751 | if (abs(dx) > VAL_THRESHOLD) { | | 3757 | if (abs(dx) > VAL_THRESHOLD) { |
3752 | if (sign(dx) == sign(mPriv->prevDx)) { | | 3758 | if (sign(dx) == sign(mPriv->prevDx)) { |
3753 | mPriv->accDx += dx; | | 3759 | mPriv->accDx += dx; |
3754 | if (abs(mPriv->accDx) > mPriv->acc) { | | 3760 | if (abs(mPriv->accDx) > mPriv->acc) { |
3755 | mPriv->acc = abs(mPriv->accDx); | | 3761 | mPriv->acc = abs(mPriv->accDx); |
3756 | AP_DBG(("acc=%i\n",mPriv->acc)); | | 3762 | AP_DBG(("acc=%i\n",mPriv->acc)); |
3757 | } | | 3763 | } |
3758 | else | | 3764 | else { |
3759 | AP_DBG(("accDx=%i\n",mPriv->accDx)); | | 3765 | AP_DBG(("accDx=%i\n",mPriv->accDx)); |
| | | 3766 | } |
3760 | } else { | | 3767 | } else { |
3761 | mPriv->accDx = 0; | | 3768 | mPriv->accDx = 0; |
3762 | } | | 3769 | } |
3763 | } | | 3770 | } |
3764 | | | 3771 | |
3765 | if (abs(dy) > VAL_THRESHOLD) { | | 3772 | if (abs(dy) > VAL_THRESHOLD) { |
3766 | if (sign(dy) == sign(mPriv->prevDy)) { | | 3773 | if (sign(dy) == sign(mPriv->prevDy)) { |
3767 | mPriv->accDy += dy; | | 3774 | mPriv->accDy += dy; |
3768 | if (abs(mPriv->accDy) > mPriv->acc) { | | 3775 | if (abs(mPriv->accDy) > mPriv->acc) { |
3769 | mPriv->acc = abs(mPriv->accDy); | | 3776 | mPriv->acc = abs(mPriv->accDy); |
3770 | AP_DBG(("acc: %i\n",mPriv->acc)); | | 3777 | AP_DBG(("acc: %i\n",mPriv->acc)); |
3771 | } else | | 3778 | } else { |
3772 | AP_DBG(("accDy=%i\n",mPriv->accDy)); | | 3779 | AP_DBG(("accDy=%i\n",mPriv->accDy)); |
| | | 3780 | } |
3773 | } else { | | 3781 | } else { |
3774 | mPriv->accDy = 0; | | 3782 | mPriv->accDy = 0; |
3775 | } | | 3783 | } |
3776 | } | | 3784 | } |
3777 | mPriv->prevDx = dx; | | 3785 | mPriv->prevDx = dx; |
3778 | mPriv->prevDy = dy; | | 3786 | mPriv->prevDy = dy; |
3779 | if (mPriv->acc > TOT_THRESHOLD) { | | 3787 | if (mPriv->acc > TOT_THRESHOLD) { |
3780 | mPriv->goodCount = PROBE_UNCERTAINTY; | | 3788 | mPriv->goodCount = PROBE_UNCERTAINTY; |
3781 | mPriv->prevDx = 0; | | 3789 | mPriv->prevDx = 0; |
3782 | mPriv->prevDy = 0; | | 3790 | mPriv->prevDy = 0; |
3783 | mPriv->accDx = 0; | | 3791 | mPriv->accDx = 0; |
3784 | mPriv->accDy = 0; | | 3792 | mPriv->accDy = 0; |
3785 | mPriv->acc = 0; | | 3793 | mPriv->acc = 0; |