I was applying the psm patch posted here recently. Not the one that was for the Xserver, but the one that was for the moused operation. It didn't apply cleanly. Included is a patch that applies to current with the same effect. I would like to see discussion towards including this in -CURRENT as touchpad support is a hot laptop topic. As a note to the origional author, it seems that 'ipacket' is now referenced by 'pb' rather than 'sc' in the driver. It looks like ipacket was a member of the sc structure but now is a sub-member. --- /sys/isa/psm.c.orig Thu Dec 11 06:28:11 2003 +++ /sys/isa/psm.c Fri Jan 2 13:54:53 2004 _at__at_ -291,6 +291,7 _at__at_ static probefunc_t enable_4dplus; static probefunc_t enable_mmanplus; static probefunc_t enable_versapad; +static probefunc_t enable_synaptics; static int tame_mouse(struct psm_softc *, packetbuf_t *, mousestatus_t *, unsigned char *); static struct { _at__at_ -323,6 +324,8 _at__at_ 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse, }, { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */ 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad, }, + { MOUSE_MODEL_SYNAPTICS, /* Synaptics TouchPad */ + 0xc0, MOUSE_PS2SYNAP_PACKETSIZE, enable_synaptics, }, { MOUSE_MODEL_GENERIC, 0xc0, MOUSE_PS2_PACKETSIZE, NULL, }, }; _at__at_ -578,6 +581,7 _at__at_ { MOUSE_MODEL_EXPLORER, "IntelliMouse Explorer" }, { MOUSE_MODEL_4D, "4D Mouse" }, { MOUSE_MODEL_4DPLUS, "4D+ Mouse" }, + { MOUSE_MODEL_SYNAPTICS, "Synaptics TouchPad" }, { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, { MOUSE_MODEL_UNKNOWN, NULL }, }; _at__at_ -2119,7 +2123,7 _at__at_ * the table to turn PS/2 mouse button bits (MOUSE_PS2_BUTTON?DOWN) * into `mousestatus' button bits (MOUSE_BUTTON?DOWN). */ - static int butmap[8] = { + static const int butmap[8] = { 0, MOUSE_BUTTON1DOWN, MOUSE_BUTTON3DOWN, _at__at_ -2129,7 +2133,7 _at__at_ MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN, MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN }; - static int butmap_versapad[8] = { + static const int butmap_versapad[8] = { 0, MOUSE_BUTTON3DOWN, 0, _at__at_ -2141,7 +2145,7 _at__at_ }; register struct psm_softc *sc = arg; mousestatus_t ms; - int x, y, z; + int x, y, z, w; int c; int l; int x0, y0; _at__at_ -2431,6 +2435,80 _at__at_ } break; + case MOUSE_MODEL_SYNAPTICS: + /* TouchPad PS/2 absolute mode message format + * + * Bits: 7 6 5 4 3 2 1 0 (LSB) + * ------------------------------------------------ + * ipacket[0]: 1 0 W3 W2 0 W1 R L + * ipacket[1]: Yb Ya Y9 Y8 Xb Xa X9 X8 + * ipacket[2]: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0 + * ipacket[3]: 1 1 Yc Xc 0 W0 D U + * ipacket[4]: X7 X6 X5 X4 X3 X2 X1 X0 + * ipacket[5]: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 + * + * Legend: + * L: left physical mouse button + * R: right physical mouse button + * D: down button + * U: up button + * W: "wrist" value + * X: x position + * Y: x position + * Z: pressure + * + * Absolute reportable limits: 0 - 6143. + * Typical bezel limites: 1472 - 5472. + * Typical edge marings: 1632 - 5312. + */ + + /* Sanity check for out of sync packets. */ + if ((pb->ipacket[0] & 0xc8) != 0x80 || (pb->ipacket[3] & 0xc8) != 0xc0) + continue; + + ms.button = 0; + x = y = x0 = y0 = 0; + + /* pressure */ + z = pb->ipacket[2]; + w = ((pb->ipacket[0] & 0x30) >> 2) | + ((pb->ipacket[0] & 0x04) >> 1) | + ((pb->ipacket[3] & 0x04) >> 2); + + ms.button = 0; + if (pb->ipacket[0] & 0x01) + ms.button |= MOUSE_BUTTON1DOWN; + if (pb->ipacket[0] & 0x02) + ms.button |= MOUSE_BUTTON3DOWN; + if ((pb->ipacket[3] & 0x01) && !(pb->ipacket[0] & 0x01)) + ms.button |= MOUSE_BUTTON2DOWN; + if ((pb->ipacket[3] & 0x02) && !(pb->ipacket[0] & 0x02)) + ms.button |= MOUSE_BUTTON4DOWN; + + /* There is a finger on the pad */ + if ((w >= 4 && w <= 7) && (z >= 16 && z < 128) ) { + x0 = ((pb->ipacket[3] & 0x10) << 8) | ((pb->ipacket[1] & 0x0f) << 8) | pb->ipacket[4]; + y0 = ((pb->ipacket[3] & 0x20) << 7) | ((pb->ipacket[1] & 0xf0) << 4) | pb->ipacket[5]; + + if (sc->flags & PSM_FLAGS_FINGERDOWN) { + x0 = (x0 + sc->xold * 3) / 4; + y0 = (y0 + sc->yold * 3) / 4; + + x = (x0 - sc->xold) / 4; + y = (y0 - sc->yold) / 4; + } else { + sc->flags |= PSM_FLAGS_FINGERDOWN; + } + + sc->xold = x0; + sc->yold = y0; + } else { + sc->flags &= ~PSM_FLAGS_FINGERDOWN; + } + z = 0; + + break; + case MOUSE_MODEL_GENERIC: default: break; _at__at_ -2926,6 +3004,105 _at__at_ return FALSE; set_mouse_scaling(kbdc, 1); /* set scale 1:1 */ + sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND; + + return TRUE; /* PS/2 absolute mode */ +} + +/* Synaptics touch pad */ +static int +enable_synaptics(struct psm_softc *sc) +{ + KBDC kbdc = sc->kbdc; + int res; + int data[4]; + int info_rot180; + int info_portrait; + int info_sensor; + int info_hardware; + int info_new_abs; + int info_cap_pen; + int info_simple_cmd; + int info_geometry; + + if (verbose >= 2) + log(LOG_DEBUG, "psm: ENABLE_SYNAPTICS\n"); + + /* Idenfity. + */ + empty_aux_buffer(kbdc, 5); + mouse_ext_command(kbdc, 0x00); + if (get_mouse_status(kbdc, data, 0, 3) < 3) + return FALSE; + if (data[1] != 0x47) + return FALSE; + + printf("Synaptics Touchpad:\n"); + printf(" model: %d\n", (data[2] >> 4) & 0x0f); + printf(" firmware ver.: %d.%d\n", data[2] & 0x0f, data[0]); + + /* Read Model ID. + */ + empty_aux_buffer(kbdc, 5); + mouse_ext_command(kbdc, 0x03); + if (get_mouse_status(kbdc, data, 0, 3) < 3) + return FALSE; + + info_rot180 = (data[0] & 0x80); + info_portrait = (data[0] & 0x40); + info_sensor = (data[0] & 0x003f); + info_hardware = (data[1] & 0xfe) >> 1; + info_new_abs = (data[2] & 0x80); + info_cap_pen = (data[2] & 0x40); + info_simple_cmd = (data[2] & 0x20); + info_geometry = (data[2] & 0x0f); + + printf(" rot180: %s\n", info_rot180 ? "Yes" : "No"); + printf(" portrait: %s\n", info_portrait ? "Yes" : "No"); + printf(" sensor: %d\n", info_sensor); + printf(" hardware: %d\n", info_hardware); + printf(" newABS: %s\n", info_new_abs ? "Yes" : "No"); + printf(" capPen: %s\n", info_cap_pen ? "Yes" : "No"); + printf(" simpleCmd: %s\n", info_simple_cmd ? "Yes" : "No"); + printf(" geometry: %d\n", info_geometry); + + /* Read Capabilities. + */ + empty_aux_buffer(kbdc, 5); + mouse_ext_command(kbdc, 0x02); + if (get_mouse_status(kbdc, data, 0, 3) < 3) + return FALSE; + if (data[1] != 0x47) + return FALSE; + + printf(" capExtended: %s\n", (data[0] & 0x80) ? "Yes" : "No"); + printf(" capSleep: %s\n", (data[2] & 0x10) ? "Yes" : "No"); + printf(" capFourButtons: %s\n", (data[2] & 0x08) ? "Yes" : "No"); + printf(" capMultiFinger: %s\n", (data[2] & 0x02) ? "Yes" : "No"); + printf(" capPalmDetect: %s\n", (data[2] & 0x01) ? "Yes" : "No"); + + /* Now we set the operating mode to absolute. + */ +#define SYN_BIT_ABSOLUTE_MODE 0x80 +#define SYN_BIT_HIGH_RATE 0x40 +#define SYN_BIT_SLEEP_MODE 0x08 +#define SYN_BIT_DISABLE_GESTURE 0x04 +#define SYN_BIT_W_MODE 0x01 + + empty_aux_buffer(kbdc, 5); + mouse_ext_command(kbdc, SYN_BIT_ABSOLUTE_MODE | + SYN_BIT_HIGH_RATE | + SYN_BIT_DISABLE_GESTURE | + SYN_BIT_W_MODE); + res = send_aux_command_and_data(kbdc, PSMC_SET_SAMPLING_RATE, 0x14); + if (res != PSM_ACK) { + log(LOG_ERR, "psm: setting Synaptics TouchPad mode failed,\n"); + return FALSE; + } + + set_mouse_scaling(kbdc, 1); /* set scale 1:1 */ + + sc->hw.buttons = 4; sc->config |= PSM_CONFIG_HOOKRESUME | PSM_CONFIG_INITAFTERSUSPEND; return TRUE; /* PS/2 absolute mode */ --- /sys/sys/mouse.h.orig Sat Mar 23 22:07:07 2002 +++ /sys/sys/mouse.h Fri Jan 2 13:28:14 2004 _at__at_ -119,6 +119,7 _at__at_ #define MOUSE_MODEL_EXPLORER 10 #define MOUSE_MODEL_4D 11 #define MOUSE_MODEL_4DPLUS 12 +#define MOUSE_MODEL_SYNAPTICS 13 typedef struct mousemode { int protocol; /* MOUSE_PROTO_XXX */ _at__at_ -139,7 +140,7 _at__at_ * Bus mouse protocols: * bus, InPort * PS/2 mouse protocol: - * PS/2 + * PS/2, Synaptics TouchPad */ #define MOUSE_PROTO_UNKNOWN (-1) #define MOUSE_PROTO_MS 0 /* Microsoft Serial, 3 bytes */ _at__at_ -159,6 +160,7 _at__at_ #define MOUSE_PROTO_KIDSPAD 14 /* Genius Kidspad */ #define MOUSE_PROTO_VERSAPAD 15 /* Interlink VersaPad, 6 bytes */ #define MOUSE_PROTO_JOGDIAL 16 /* Vaio's JogDial */ +#define MOUSE_PROTO_SYNAPTICS 17 /* Synaptics TouchPad, 6 bytes */ #define MOUSE_RES_UNKNOWN (-1) #define MOUSE_RES_DEFAULT 0 _at__at_ -293,12 +295,15 _at__at_ #define MOUSE_PS2VERSA_BUTTON3DOWN 0x01 /* right */ #define MOUSE_PS2VERSA_TAP 0x02 +/* Synaptics TouchPad (PS/2 I/F) data packet */ +#define MOUSE_PS2SYNAP_PACKETSIZE 6 + /* A4 Tech 4D Mouse (PS/2) data packet */ -#define MOUSE_4D_PACKETSIZE 3 +#define MOUSE_4D_PACKETSIZE 3 #define MOUSE_4D_WHEELBITS 0xf0 /* A4 Tech 4D+ Mouse (PS/2) data packet */ -#define MOUSE_4DPLUS_PACKETSIZE 3 +#define MOUSE_4DPLUS_PACKETSIZE 3 #define MOUSE_4DPLUS_ZNEG 0x04 /* sign bit */ #define MOUSE_4DPLUS_BUTTON4DOWN 0x08 Dave. -- ============================================================================ |David Gilbert, Independent Contractor. | Two things can only be | |Mail: dave_at_daveg.ca | equal if and only if they | |http://daveg.ca | are precisely opposite. | =========================================================GLO================Received on Fri Jan 02 2004 - 10:00:38 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:36 UTC