On Sun, Feb 13, 2005 at 03:43:54PM +0100, Peter Osterlund wrote: > > The "Version" number is 16-bit only, however the GETINFO can only > > transfer approximately 15 bits of information anyway, due to the > > limitations of the PS/2 protocols. > > I don't know exactly which bits to save, but the following patch handles > all models in the alps_model_info vector: I applied your patch, with a modification to really save all the possible version values: Signed-off-by: Peter Osterlund Signed-off-by: Vojtech Pavlik --- linux-petero/drivers/input/mouse/alps.c | 17 +++++++++++++---- linux-petero/drivers/input/mouse/psmouse.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff -puN drivers/input/mouse/alps.c~p00005_alps-version-info2 drivers/input/mouse/alps.c --- linux/drivers/input/mouse/alps.c~p00005_alps-version-info2 2005-04-21 19:53:08.329069128 +0200 +++ linux-petero/drivers/input/mouse/alps.c 2005-04-21 19:53:32.434404560 +0200 @@ -210,9 +210,10 @@ static psmouse_ret_t alps_process_byte(s return PSMOUSE_GOOD_DATA; } -int alps_get_model(struct psmouse *psmouse) +int alps_get_model(struct psmouse *psmouse, int *version) { struct ps2dev *ps2dev = &psmouse->ps2dev; + unsigned char rates[] = { 0, 10, 20, 40, 60, 80, 100, 200 }; unsigned char param[4]; int i; @@ -250,6 +251,9 @@ int alps_get_model(struct psmouse *psmou dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); + for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++); + *version = (param[0] << 8) | (i << 4) | (param[1] & 0x0f); + for (i = 0; i < ARRAY_SIZE(alps_model_data); i++) if (!memcmp(param, alps_model_data[i].signature, sizeof(alps_model_data[i].signature))) return alps_model_data[i].model; @@ -347,8 +351,9 @@ static int alps_reconnect(struct psmouse { struct alps_data *priv = psmouse->private; unsigned char param[4]; + int version; - if ((priv->model = alps_get_model(psmouse)) < 0) + if ((priv->model = alps_get_model(psmouse, &version)) < 0) return -1; if (priv->model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1)) @@ -381,13 +386,14 @@ int alps_init(struct psmouse *psmouse) { struct alps_data *priv; unsigned char param[4]; + int version; psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); if (!priv) goto init_fail; memset(priv, 0, sizeof(struct alps_data)); - if ((priv->model = alps_get_model(psmouse)) < 0) + if ((priv->model = alps_get_model(psmouse, &version)) < 0) goto init_fail; printk(KERN_INFO "ALPS Touchpad (%s) detected\n", @@ -445,12 +451,15 @@ init_fail: int alps_detect(struct psmouse *psmouse, int set_properties) { - if (alps_get_model(psmouse) < 0) + int version; + + if (alps_get_model(psmouse, &version) < 0) return -1; if (set_properties) { psmouse->vendor = "ALPS"; psmouse->name = "TouchPad"; + psmouse->model = version; } return 0; } diff -puN drivers/input/mouse/psmouse.h~p00005_alps-version-info2 drivers/input/mouse/psmouse.h --- linux/drivers/input/mouse/psmouse.h~p00005_alps-version-info2 2005-04-21 19:53:08.331068824 +0200 +++ linux-petero/drivers/input/mouse/psmouse.h 2005-04-21 19:53:08.334068368 +0200 @@ -44,7 +44,7 @@ struct psmouse { unsigned char pktcnt; unsigned char pktsize; unsigned char type; - unsigned char model; + unsigned int model; unsigned long last; unsigned long out_of_sync; enum psmouse_state state; _