Lines Matching +full:- +full:1200 +full:ps
2 ** SPDX-License-Identifier: BSD-4-Clause
40 ** the PS/2 mouse port for mouse data stream, interprets data and passes
82 /* Abort 3-button emulation delay after this many movement events. */
88 #define MOUSE_XAXIS (-1)
89 #define MOUSE_YAXIS (-2)
114 #define tsclr(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
116 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
117 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
118 ((tvp)->tv_sec cmp (uvp)->tv_sec))
121 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
122 (vvp)->tv_nsec = (tvp)->tv_nsec - (uvp)->tv_nsec; \
123 if ((vvp)->tv_nsec < 0) { \
124 (vvp)->tv_sec--; \
125 (vvp)->tv_nsec += 1000000000; \
198 { "ps/2", MOUSE_IF_PS2, 0 },
213 "ps/2",
290 /* MS PS/2 */
316 /* MS PS/2 compatible */
324 /* Logitech PS/2 */
326 /* PS/2 */
338 /* Logitech PS/2 compatible */
345 /* Compaq LTE TrackBall PS/2 */
368 0, /* PS/2 */
381 (CS8 | CREAD | HUPCL ), /* GTCO Digi-Pad */
415 .level = -1,
416 .baudrate = 1200,
421 .mfd = -1,
422 .cfd = -1,
423 .mremsfd = -1,
424 .mremcfd = -1,
452 #define S3 3 /* both buttons down -> button 2 down */
566 while ((c = getopt(argc, argv, "3A:C:DE:F:HI:L:PRS:T:VU:a:cdfhi:l:m:p:r:st:w:z:")) != -1)
659 else if (strcmp(optarg, "medium-high") == 0)
661 else if (strcmp(optarg, "medium-low") == 0)
686 rodent.wmode = 1 << (i - 1);
700 if ((i <= 0) || (i > MOUSE_MAXBUTTON - 1)) {
711 if ((i <= 0) || (i > MOUSE_MAXBUTTON - 1)) {
799 rodent.level = -1;
836 if (mstate[j] == &bstate[rodent.zmap[i] - 1])
839 rodent.zmap[i] = 1 << (rodent.zmap[i] - 1);
870 if (rodent.mfd == -1)
875 rodent.mfd = -1;
899 if (rodent.mfd == -1) {
914 if (rodent.mfd != -1)
916 if (rodent.cfd != -1)
918 rodent.mfd = rodent.cfd = -1;
948 rodent.remainx = fdx - *movex;
949 rodent.remainy = fdy - *movey;
957 * most recent non-zero movements and use their average value
981 rodent.remainx = fdx - *movex;
982 rodent.remainy = fdy - *movey;
1003 if ((rodent.cfd = open("/dev/consolectl", O_RDWR, 0)) == -1)
1087 if (read(rodent.mfd, &b, 1) == -1) {
1167 if (scroll_movement < -rodent.scrollthreshold) {
1175 if (hscroll_movement < -rodent.scrollthreshold) {
1187 if (scroll_movement < -rodent.scrollspeed) {
1189 action2.dz = -1;
1202 if (hscroll_movement < -rodent.scrollspeed) {
1203 action2.dz = -2;
1221 /* X or/and Y movement only - possibly drift */
1351 "usage: moused [-DRcdfs] [-I file] [-F rate] [-r resolution] [-S baudrate]",
1352 " [-VH [-U threshold]] [-a X[,Y]] [-C threshold] [-m N=M] [-w N]",
1353 " [-z N] [-t <mousetype>] [-l level] [-3 [-E timeout]]",
1354 " [-T distance[,time[,after]]] -p <port>",
1355 " moused [-d] -i <port|if|type|model|all> -p <port>");
1361 * `errnum' is non-zero, append its string form to the message.
1442 { 0xc0, 0x00, 0x00, 0x00, 3, 0x00, 0xff }, /* PS/2 mouse */
1486 rodent.mode.rate = -1;
1528 rodent.mode.protocol = t->val;
1529 rodent.hw.model = t->val2;
1606 ** NOTE: - all commands to (at least the European) MouseMan have to
1607 ** be sent at 1200 Baud.
1608 ** - each command starts with a '*'.
1609 ** - whenever the MouseMan receives a '*', it will switch back
1610 ** to 1200 Baud. Hence I have to select the desired protocol
1614 ** - 5 byte packed binary protocol, as with the Mouse Systems
1616 ** - 2 button 3 byte MicroSoft compatible protocol. Selected
1618 ** - 3 button 3+1 byte MicroSoft compatible protocol (default).
1622 ** - 1200 Baud (default). Selected by sequence "*n".
1623 ** - 9600 Baud. Selected by sequence "*q".
1640 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1657 /* The command must always be sent at 1200 baud */
1658 setmousespeed(1200, 1200, rodentcflags[rodent.rtype]);
1660 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1664 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1667 * Initialize Hitachi PUMA Plus - Model 1212E to desired settings.
1670 * of the tablet. We only use this tablet for it's 4-button puck
1704 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1726 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1739 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1752 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1788 setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
1796 /* MOUSE_MSS_BUTTON?DOWN -> MOUSE_BUTTON?DOWN */
1811 /* MOUSE_INTELLI_BUTTON?DOWN -> MOUSE_BUTTON?DOWN */
1819 /* MOUSE_MSC_BUTTON?UP -> MOUSE_BUTTON?DOWN */
1831 /* MOUSE_PS2_BUTTON?DOWN -> MOUSE_BUTTON?DOWN */
1832 static int butmapps2[8] = { /* PS/2 */
1864 /* for PS/2 VersaPad */
1889 * a) illegal (detected by wrong data-package header)
1890 * b) invalid (0x80 == -128 and that might be wrong for MouseSystems)
1891 * c) bad header-package
1893 * NOTE: b) is a voilation of the MouseSystems-Protocol, since values of
1894 * -128 are allowed, but since they are very seldom we can easily
1895 * use them as package-header with no button pressed.
1896 * NOTE/2: On a PS/2 mouse any byte is valid as a data byte. Furthermore,
1897 * 0x80 is not valid as a header byte. For a PS/2 mouse we skip
1899 * For resyncing a PS/2 mouse we require the two most significant
1922 * Hack for Logitech MouseMan Mouse - Middle button
1938 * [JCH-96/01/21]
1943 * half of the reverse-map may remain unchanged.
1947 * [KY-97/08/03]
1966 * so-called `ten key' mode and 0x30 though 0x3f in the
1971 act->dx = act->dy = act->dz = 0;
1972 act->obutton = act->button;
1974 act->button = (1 << (rBuf - 13))
1975 | (act->obutton & (MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN));
1995 act->dx = act->dy = 0;
1996 act->dz = (rBuf & 0x08) ? (rBuf & 0x0f) - 16 : (rBuf & 0x0f);
1997 if ((act->dz >= 7) || (act->dz <= -7))
1998 act->dz = 0;
1999 act->obutton = act->button;
2000 act->button = butmapintelli[(rBuf & MOUSE_MSS_BUTTONS) >> 4]
2001 | (act->obutton & (MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN));
2005 act->dx = act->dy = act->dz = 0;
2006 act->obutton = act->button;
2007 act->button = butmapmss2[(rBuf & MOUSE_MSS_BUTTONS) >> 4]
2008 | (act->obutton & (MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN));
2012 act->flags = ((act->dx || act->dy || act->dz) ? MOUSE_POSCHANGED : 0)
2013 | (act->obutton ^ act->button);
2015 return (act->flags);
2033 act->dz = 0;
2034 act->obutton = act->button;
2040 act->button = act->obutton & MOUSE_BUTTON4DOWN;
2042 act->button |= ((pBuf[0] & MOUSE_MSS_BUTTONS) == MOUSE_MSS_BUTTONS)
2046 act->button |= (act->obutton & MOUSE_BUTTON2DOWN)
2049 /* Send X10 btn events to remote client (ensure -128-+127 range) */
2060 act->dx = (signed char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
2061 act->dy = (signed char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
2068 act->button = (act->obutton & (MOUSE_BUTTON2DOWN | MOUSE_BUTTON4DOWN))
2070 act->dx = (signed char)(((pBuf[0] & 0x03) << 6) | (pBuf[1] & 0x3F));
2071 act->dy = (signed char)(((pBuf[0] & 0x0C) << 4) | (pBuf[2] & 0x3F));
2078 act->button = butmapmsc[(~pBuf[0]) & MOUSE_MSC_BUTTONS];
2079 act->dx = (signed char)(pBuf[1]) + (signed char)(pBuf[3]);
2080 act->dy = - ((signed char)(pBuf[2]) + (signed char)(pBuf[4]));
2085 act->dz = -1;
2087 act->dz = 1;
2089 act->button = MOUSE_BUTTON1DOWN;
2091 act->button = 0;
2095 act->button = butmaphit[pBuf[0] & 0x07];
2096 act->dx = (pBuf[0] & MOUSE_MM_XPOSITIVE) ? pBuf[1] : - pBuf[1];
2097 act->dy = (pBuf[0] & MOUSE_MM_YPOSITIVE) ? - pBuf[2] : pBuf[2];
2102 act->button = butmapmsc[pBuf[0] & MOUSE_MSC_BUTTONS];
2103 act->dx = (pBuf[0] & MOUSE_MM_XPOSITIVE) ? pBuf[1] : - pBuf[1];
2104 act->dy = (pBuf[0] & MOUSE_MM_YPOSITIVE) ? - pBuf[2] : pBuf[2];
2108 act->button = butmapversa[(pBuf[0] & MOUSE_VERSA_BUTTONS) >> 3];
2109 act->button |= (pBuf[0] & MOUSE_VERSA_TAP) ? MOUSE_BUTTON4DOWN : 0;
2110 act->dx = act->dy = 0;
2117 x -= 0x1000;
2120 y -= 0x1000;
2122 act->dx = prev_x - x;
2123 act->dy = prev_y - y;
2131 case MOUSE_PROTO_PS2: /* PS/2 */
2132 act->button = butmapps2[pBuf[0] & MOUSE_PS2_BUTTONS];
2133 act->dx = (pBuf[0] & MOUSE_PS2_XNEG) ? pBuf[1] - 256 : pBuf[1];
2134 act->dy = (pBuf[0] & MOUSE_PS2_YNEG) ? -(pBuf[2] - 256) : -pBuf[2];
2140 * actions are encoded in model-dependent formats. At the level 0
2141 * the following code is no-op because the psm driver says the model
2147 act->dz = (pBuf[3] & MOUSE_EXPLORER_ZNEG)
2148 ? (pBuf[3] & 0x0f) - 16 : (pBuf[3] & 0x0f);
2149 act->button |= (pBuf[3] & MOUSE_EXPLORER_BUTTON4DOWN)
2151 act->button |= (pBuf[3] & MOUSE_EXPLORER_BUTTON5DOWN)
2157 act->dz = (signed char)pBuf[3];
2158 if ((act->dz >= 7) || (act->dz <= -7))
2159 act->dz = 0;
2161 act->button |= (pBuf[0] & MOUSE_PS2INTELLI_BUTTON4DOWN)
2163 act->button |= (pBuf[0] & MOUSE_PS2INTELLI_BUTTON5DOWN)
2168 && (abs(act->dx) > 191)
2174 act->dx = act->dy = 0;
2176 /* horizontal roller count - ignore it XXX*/
2179 act->dz = (pBuf[2] & MOUSE_PS2PLUS_ZNEG)
2180 ? (pBuf[2] & 0x0f) - 16 : (pBuf[2] & 0x0f);
2182 act->button |= (pBuf[2] & MOUSE_PS2PLUS_BUTTON4DOWN)
2184 act->button |= (pBuf[2] & MOUSE_PS2PLUS_BUTTON5DOWN)
2193 act->dx = act->dy = 0;
2196 act->dz = (pBuf[2] & MOUSE_SPOINT_WNEG) ? -2 : 2;
2199 act->dz = (pBuf[2] & MOUSE_SPOINT_ZNEG) ? -1 : 1;
2202 act->dz = (pBuf[2] & MOUSE_SPOINT_ZNEG)
2203 ? ((pBuf[2] >> 4) & 0x0f) - 16
2206 act->dw = (pBuf[2] & MOUSE_SPOINT_WNEG)
2207 ? (pBuf[2] & 0x0f) - 16 : (pBuf[2] & 0x0f);
2211 /* device type packet - shouldn't happen */
2214 act->dx = act->dy = 0;
2215 act->button = act->obutton;
2223 act->button |= act->obutton & MOUSE_EXTBUTTONS;
2228 act->button |= ((pBuf[0] & MOUSE_PS2_TAP)) ? 0 : MOUSE_BUTTON4DOWN;
2232 act->button |= (pBuf[3] & MOUSE_PS2_BUTTON3DOWN)
2234 act->button |= (pBuf[3] & MOUSE_PS2_BUTTON1DOWN)
2236 act->dz = (pBuf[3] & MOUSE_PS2_XNEG) ? pBuf[4] - 256 : pBuf[4];
2240 act->button |= (pBuf[0] & MOUSE_PS2_TAP) ? MOUSE_BUTTON4DOWN : 0;
2243 act->button = butmapversaps2[pBuf[0] & MOUSE_PS2VERSA_BUTTONS];
2244 act->button |=
2246 act->dx = act->dy = 0;
2253 x -= 0x1000;
2256 y -= 0x1000;
2258 act->dx = prev_x - x;
2259 act->dy = prev_y - y;
2267 act->dx = (pBuf[1] & 0x80) ? pBuf[1] - 256 : pBuf[1];
2268 act->dy = (pBuf[2] & 0x80) ? -(pBuf[2] - 256) : -pBuf[2];
2271 act->dz = 1;
2274 act->dz = -1;
2277 act->dz = 2;
2280 act->dz = -2;
2285 if ((act->dx < 16 - 256) && (act->dy > 256 - 16)) {
2286 act->dx = act->dy = 0;
2288 act->button |= MOUSE_BUTTON4DOWN;
2289 act->dz = (pBuf[2] & MOUSE_4DPLUS_ZNEG)
2290 ? ((pBuf[2] & 0x07) - 8) : (pBuf[2] & 0x07);
2293 act->button |= act->obutton & MOUSE_EXTBUTTONS;
2303 act->button = butmapmsc[(~pBuf[0]) & MOUSE_SYS_STDBUTTONS];
2304 act->dx = (signed char)(pBuf[1]) + (signed char)(pBuf[3]);
2305 act->dy = - ((signed char)(pBuf[2]) + (signed char)(pBuf[4]));
2307 act->dz = ((signed char)(pBuf[5] << 1) + (signed char)(pBuf[6] << 1)) >> 1;
2308 act->button |= ((~pBuf[7] & MOUSE_SYS_EXTBUTTONS) << 3);
2321 act->flags = ((act->dx || act->dy || act->dz) ? MOUSE_POSCHANGED : 0)
2322 | (act->obutton ^ act->button);
2324 return (act->flags);
2333 a2->dx = a1->dx;
2334 a2->dy = a1->dy;
2335 a2->dz = a1->dz;
2336 a2->obutton = a2->button;
2337 a2->button = a1->button;
2338 a2->flags = a1->flags;
2343 debug("state:%d, trans:%d -> state:%d",
2347 * Avoid re-ordering button and movement events. While a button
2352 if ((a2->dx != 0 || a2->dy != 0) &&
2360 a2->dx = a2->dy = 0;
2368 a2->button &=
2370 a2->button &= states[mouse_button_state].mask;
2371 a2->button |= states[mouse_button_state].buttons;
2372 flags = a2->flags & MOUSE_POSCHANGED;
2373 flags |= a2->obutton ^ a2->button;
2375 a2->flags = flags & MOUSE_BUTTON2DOWN;
2378 a2->flags = flags;
2432 p2l[pbutton - 1] = 1 << (lbutton - 1);
2433 mstate[lbutton - 1] = &bstate[pbutton - 1];
2446 pbuttons = act1->button;
2449 act2->obutton = act2->button;
2452 act1->dz = act1->dy;
2453 act1->dx = 0;
2454 act1->dy = 0;
2456 act2->dx = act1->dx;
2457 act2->dy = act1->dy;
2458 act2->dz = act1->dz;
2464 if (act1->dz != 0) {
2465 act2->dx = act1->dz;
2466 act2->dz = 0;
2470 if (act1->dz != 0) {
2471 act2->dy = act1->dz;
2472 act2->dz = 0;
2478 if ((act1->dz < -1) && rodent.zmap[2]) {
2481 } else if (act1->dz < 0) {
2484 } else if ((act1->dz > 1) && rodent.zmap[3]) {
2487 } else if (act1->dz > 0) {
2491 act2->dz = 0;
2499 act2->button = lbuttons;
2501 act2->flags = ((act2->dx || act2->dy || act2->dz) ? MOUSE_POSCHANGED : 0)
2502 | (act2->obutton ^ act2->button);
2516 mask = act->flags & MOUSE_BUTTONS;
2539 if (act->button & button) {
2554 if (act->button & button) {
2559 act->flags |= button;
2595 mask = act->flags & MOUSE_BUTTONS;
2602 debug("mstate[%d]->count:%d", i, mstate[i]->count);
2603 if (act->button & button) {
2605 mouse.u.event.value = mstate[i]->count;
2623 /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.4 1995/01/28 17:05:03 dawes Exp $ */
2682 case 1200:
2711 case 1200:
2736 * It's a simplistic implementation, but it works :-)
2789 setmousespeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
2855 setmousespeed(1200, 1200, (CS7 | CREAD | CLOCAL | HUPCL));
2898 begin = -1;
2905 debug("begin-id %02x", c);
2906 begin = i - 1;
2934 i -= begin;
2938 debug("len:%d, '%-*.*s'", i, i, i, buf);
2940 if (buf[i - 1] == c)
2962 id->revision = 0;
2963 id->eisaid = NULL;
2964 id->serial = NULL;
2965 id->class = NULL;
2966 id->compat = NULL;
2967 id->description = NULL;
2968 id->neisaid = 0;
2969 id->nserial = 0;
2970 id->nclass = 0;
2971 id->ncompat = 0;
2972 id->ndescription = 0;
2975 /* non-PnP mice */
2980 id->eisaid = "PNP0F01";
2983 id->eisaid = "PNP0F04";
2986 id->neisaid = strlen(id->eisaid);
2987 id->class = "MOUSE";
2988 id->nclass = strlen(id->class);
2989 debug("non-PnP mouse '%c'", buf[0]);
2994 offset = 0x28 - buf[0];
2997 for (i = 0; i < len - 3; ++i) {
3001 sum += buf[len - 1];
3007 buf[1] -= offset;
3008 buf[2] -= offset;
3009 id->revision = ((buf[1] & 0x3f) << 6) | (buf[2] & 0x3f);
3010 debug("PnP rev %d.%02d", id->revision / 100, id->revision % 100);
3013 id->eisaid = &buf[3];
3014 id->neisaid = 7;
3025 i -= 3;
3026 if (i - j == 8) {
3027 id->serial = &buf[j];
3028 id->nserial = 8;
3038 i -= 3;
3040 id->class = &buf[j];
3041 id->nclass = i - j;
3057 i -= 3;
3059 id->compat = &buf[j];
3060 id->ncompat = i - j;
3070 i -= 3;
3072 id->description = &buf[j];
3073 id->ndescription = i - j;
3078 if ((id->nserial > 0) || (id->nclass > 0)
3079 || (id->ncompat > 0) || (id->ndescription > 0)) {
3082 if (strncmp(s, &buf[len - 3], 2) != 0) {
3103 if (id->nclass > 0)
3104 if (strncmp(id->class, "MOUSE", id->nclass) != 0 &&
3105 strncmp(id->class, "TABLET", id->nclass) != 0)
3109 if (id->neisaid > 0) {
3110 t = gettoken(pnpprod, id->eisaid, id->neisaid);
3111 if (t->val != MOUSE_PROTO_UNKNOWN)
3119 if (id->ncompat <= 0)
3121 for (i = 0; i < id->ncompat; ++i) {
3122 for (j = i; id->compat[i] != ','; ++i)
3123 if (i >= id->ncompat)
3126 t = gettoken(pnpprod, id->compat + j, i - j);
3127 if (t->val != MOUSE_PROTO_UNKNOWN)
3166 The tablet responds to the COM PnP protocol 1.0 with EISA-ID KYE0005,
3167 and to pre-pnp probes (RTS toggle) with 'T' (tablet ?)
3193 static int buflen = 0, b_prev = 0 , x_prev = -1, y_prev = -1;
3213 x = buf[1]+128*(buf[2] - 7);
3215 y = 28*128 - (buf[3] + 128* (buf[4] - 7));
3221 act->flags = 0;
3222 act->obutton = act->button;
3223 act->dx = act->dy = act->dz = 0;
3228 act->flags |= MOUSE_POSCHANGED; /* force update */
3233 act->dx = x - x_prev;
3234 act->dy = y - y_prev;
3235 if (act->dx || act->dy)
3236 act->flags |= MOUSE_POSCHANGED;
3240 act->button = 0;
3242 act->button |= MOUSE_BUTTON1DOWN;
3244 act->button |= MOUSE_BUTTON2DOWN;
3245 act->flags |= MOUSE_BUTTONSCHANGED;
3248 return (act->flags);
3255 static int buflen = 0, b_prev = 0 , x_prev = -1, y_prev = -1;
3281 y = 4768 - ((buf[4] & ~GTCO_START) << 6 | (buf[3] & ~GTCO_START));
3286 act->flags = 0;
3287 act->obutton = act->button;
3288 act->dx = act->dy = act->dz = 0;
3293 act->flags |= MOUSE_POSCHANGED; /* force update */
3299 act->dx = x - x_prev;
3300 act->dy = y - y_prev;
3301 if (act->dx || act->dy)
3302 act->flags |= MOUSE_POSCHANGED;
3308 act->button = 0;
3311 act->button |= MOUSE_BUTTON1DOWN;
3315 act->button |= MOUSE_BUTTON2DOWN;
3319 act->button |= MOUSE_BUTTON3DOWN;
3323 act->button |= MOUSE_BUTTON4DOWN;
3325 act->flags |= MOUSE_BUTTONSCHANGED;
3328 return (act->flags);
3348 #define SUN_LEN(unp) (((char *)(unp)->sun_path - (char *)(unp)) + \
3349 strlen((unp)->path))
3387 rodent.mremcfd = -1;