--- mice.c.orig Thu May 11 09:47:23 2000 +++ mice.c Thu May 18 17:39:05 2000 @@ -1254,6 +1254,52 @@ #undef DIF_TIME } +/* + * This decoder is copied and adapted from the above gunze. + * + * ricoh g1200-s uses a modified ps2 packet format. + * bits: + * 01234567,01234567,01234567 + * 11p0yyxx,xxxxxxxx,yyyyyyyy + * p = pen + * x = x coordinate bit (absolute) + * y = y coordinate bit (absolute) + * + * calibration information is stored in cmos and handled + * by the keyboard/ps2 driver. + */ +static int M_g1200s(Gpm_Event *state, unsigned char *data) +{ + int x0, y0, x, y; + + #define REAL_TO_XCELL(x) (x * win.ws_col / 0x3FFF) + #define REAL_TO_YCELL(y) (y * win.ws_row / 0x3FFF) + + state->buttons = data[0] & 0x20 ? GPM_B_LEFT: 0; + + /* we alway need to look at the x,y values */ + x0 = ((data[0] & 0x03) << 8) + data[1]; + y0 = (((data[0] >> 2) & 0x03) << 8) + data[2]; + + /* range is 0-640 & 0-480, scale to REALPOS_MAX */ + x = x0 * REALPOS_MAX / 640; + y = y0 * REALPOS_MAX / 480; + + if (x<0) x = 0; if (x > REALPOS_MAX) x = REALPOS_MAX; + if (y<0) y = 0; if (y > REALPOS_MAX) y = REALPOS_MAX; + + state->x = REAL_TO_XCELL(x); + state->y = REAL_TO_YCELL(y); + state->dx = 0; + state->dy = 0; + + realposx = x; + realposy = y; + + #undef REAL_TO_XCELL + #undef REAL_TO_YCELL +} + /* Genius Wizardpad tablet -- Matt Kimball (mkimball@xmission.com) */ static int wizardpad_width = -1; static int wizardpad_height = -1; @@ -2034,7 +2080,9 @@ {"gunze", "Gunze touch-screens (only button-1 events, by now)", "", M_gunze, I_gunze, STD_FLG, {0xF9, 0x50, 0xF0, 0x30}, 11, 1, 0, 1, NULL}, - + {"g1200s", "Ricoh G1200-S stylus screen", + "g1200s", M_g1200s, I_empty, STD_FLG, + {0xC0, 0xC0, 0x00, 0x00}, 3, 1, 0, 1, NULL}, {"acecad", "Acecad tablet absolute mode(Sumagrapics MM-Series mode)", "", M_summa, I_summa, STD_FLG, {0x80, 0x80, 0x00, 0x00}, 7, 1, 0, 1, 0},