* My current patches @ 2003-09-25 16:48 Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 1/8] Revert synaptics->pktcnt change Vojtech Pavlik 2003-09-25 18:13 ` My current patches Peter Osterlund 0 siblings, 2 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:48 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel Hi! I'm sending you my current set of patches for review and testing. Please forward to whoever can test them. If no problems are found, I'll be sending them to Linus for inclusion in 2.6 tomorrow or so. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 1/8] Revert synaptics->pktcnt change. 2003-09-25 16:48 My current patches Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 2/8] Fix multibutton handling in synaptics.c Vojtech Pavlik 2003-09-25 18:13 ` My current patches Peter Osterlund 1 sibling, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1341, 2003-09-25 18:17:45+02:00, vojtech@suse.cz input: Revert synaptics->pktcnt change. New synaptics driver actually uses the variable. psmouse-base.c | 1 - 1 files changed, 1 deletion(-) =================================================================== diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c --- a/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:50 2003 +++ b/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:50 2003 @@ -173,7 +173,6 @@ * so it needs to receive all bytes one at a time. */ synaptics_process_byte(psmouse, regs); - psmouse->pktcnt = 0; goto out; } ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 2/8] Fix multibutton handling in synaptics.c. 2003-09-25 16:50 ` [PATCH 1/8] Revert synaptics->pktcnt change Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 3/8] Synaptics code cleanups Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1342, 2003-09-25 18:18:59+02:00, dtor_core@ameritech.net input: Fix multibutton handling in Synaptics.c (nExtBtn > 8 case) synaptics.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) =================================================================== diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:42 2003 +++ b/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:42 2003 @@ -164,7 +164,8 @@ if (SYN_CAP_EXTENDED(priv->capabilities)) { printk(KERN_INFO " Touchpad has extended capability bits\n"); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && + SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) <= 8) printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n", (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))); else if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) @@ -352,7 +353,11 @@ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: - printk(KERN_ERR "This touchpad reports more than 8 multi-buttons, don't know how to handle.\n"); + /* + * if nExtBtn is greater than 8 it should be considered + * invalid and treated as 0 + */ + break; case 8: set_bit(BTN_7, psmouse->dev.keybit); set_bit(BTN_6, psmouse->dev.keybit); @@ -437,7 +442,11 @@ ((buf[3] & 2) ? !hw->right : hw->right)) { switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: - ; /* we did comment while initialising... */ + /* + * if nExtBtn is greater than 8 it should be + * considered invalid and treated as 0 + */ + break; case 8: hw->b7 = ((buf[5] & 0x08)) ? 1 : 0; hw->b6 = ((buf[4] & 0x08)) ? 1 : 0; @@ -516,7 +525,11 @@ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) switch(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: - ; /* we did comment while initialising... */ + /* + * if nExtBtn is greater than 8 it should be considered + * invalid and treated as 0 + */ + break; case 8: input_report_key(dev, BTN_7, hw.b7); input_report_key(dev, BTN_6, hw.b6); ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 3/8] Synaptics code cleanups. 2003-09-25 16:50 ` [PATCH 2/8] Fix multibutton handling in synaptics.c Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 4/8] Add touchpad support to mousedev.c Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1343, 2003-09-25 18:19:41+02:00, dtor_core@ameritech.net input: Synaptics code cleanups. synaptics.c | 161 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 85 insertions(+), 76 deletions(-) =================================================================== diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:35 2003 +++ b/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:35 2003 @@ -36,7 +36,7 @@ * Use the Synaptics extended ps/2 syntax to write a special command byte. * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu * is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd - * and synaptics_set_mode) + * and synaptics_mode_cmd) */ static int synaptics_special_cmd(struct psmouse *psmouse, unsigned char command) { @@ -69,7 +69,7 @@ /* * Set the synaptics touchpad mode byte by special commands */ -static int synaptics_set_mode(struct psmouse *psmouse, unsigned char mode) +static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) { unsigned char param[1]; @@ -96,13 +96,14 @@ * Read the model-id bytes from the touchpad * see also SYN_MODEL_* macros */ -static int synaptics_model_id(struct psmouse *psmouse, unsigned long int *model_id) +static int synaptics_model_id(struct psmouse *psmouse) { + struct synaptics_data *priv = psmouse->private; unsigned char mi[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_MODEL, mi)) return -1; - *model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2]; + priv->model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2]; return 0; } @@ -110,23 +111,24 @@ * Read the capability-bits from the touchpad * see also the SYN_CAP_* macros */ -static int synaptics_capability(struct psmouse *psmouse, unsigned long int *capability, unsigned long int *ext_cap) +static int synaptics_capability(struct psmouse *psmouse) { + struct synaptics_data *priv = psmouse->private; unsigned char cap[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) return -1; - *capability = (cap[0]<<16) | (cap[1]<<8) | cap[2]; - *ext_cap = 0; - if (!SYN_CAP_VALID(*capability)) + priv->capabilities = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + priv->ext_cap = 0; + if (!SYN_CAP_VALID(priv->capabilities)) return -1; - if (SYN_EXT_CAP_REQUESTS(*capability)) { + if (SYN_EXT_CAP_REQUESTS(priv->capabilities)) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { printk(KERN_ERR "Synaptics claims to have extended capabilities," " but I'm not able to read them."); } else - *ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2]; + priv->ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2]; } return 0; } @@ -135,14 +137,15 @@ * Identify Touchpad * See also the SYN_ID_* macros */ -static int synaptics_identify(struct psmouse *psmouse, unsigned long int *ident) +static int synaptics_identify(struct psmouse *psmouse) { + struct synaptics_data *priv = psmouse->private; unsigned char id[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, id)) return -1; - *ident = (id[0]<<16) | (id[1]<<8) | id[2]; - if (SYN_ID_IS_SYNAPTICS(*ident)) + priv->identity = (id[0]<<16) | (id[1]<<8) | id[2]; + if (SYN_ID_IS_SYNAPTICS(priv->identity)) return 0; return -1; } @@ -179,7 +182,7 @@ } } -static int query_hardware(struct psmouse *psmouse) +static int synaptics_query_hardware(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; int retries = 0; @@ -188,11 +191,11 @@ while ((retries++ < 3) && synaptics_reset(psmouse)) printk(KERN_ERR "synaptics reset failed\n"); - if (synaptics_identify(psmouse, &priv->identity)) + if (synaptics_identify(psmouse)) return -1; - if (synaptics_model_id(psmouse, &priv->model_id)) + if (synaptics_model_id(psmouse)) return -1; - if (synaptics_capability(psmouse, &priv->capabilities, &priv->ext_cap)) + if (synaptics_capability(psmouse)) return -1; mode = SYN_BIT_ABSOLUTE_MODE | SYN_BIT_HIGH_RATE; @@ -200,7 +203,7 @@ mode |= SYN_BIT_DISABLE_GESTURE; if (SYN_CAP_EXTENDED(priv->capabilities)) mode |= SYN_BIT_W_MODE; - if (synaptics_set_mode(psmouse, mode)) + if (synaptics_mode_cmd(psmouse, mode)) return -1; return 0; @@ -286,7 +289,7 @@ /* adjust the touchpad to child's choice of protocol */ child = port->private; if (child && child->type >= PSMOUSE_GENPS) { - if (synaptics_set_mode(psmouse, (SYN_BIT_ABSOLUTE_MODE | + if (synaptics_mode_cmd(psmouse, (SYN_BIT_ABSOLUTE_MODE | SYN_BIT_HIGH_RATE | SYN_BIT_DISABLE_GESTURE | SYN_BIT_FOUR_BYTE_CLIENT | @@ -311,46 +314,27 @@ set_bit(axis, dev->absbit); } -int synaptics_init(struct psmouse *psmouse) +static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) { - struct synaptics_data *priv; - -#ifndef CONFIG_MOUSE_PS2_SYNAPTICS - return -1; -#endif - psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); - if (!priv) - return -1; - memset(priv, 0, sizeof(struct synaptics_data)); - - priv->out_of_sync = 0; - - if (query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query/initialize Synaptics hardware.\n"); - goto init_fail; - } - - print_ident(priv); - /* * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, * which says that they should be valid regardless of the actual size of * the sensor. */ - set_bit(EV_ABS, psmouse->dev.evbit); - set_abs_params(&psmouse->dev, ABS_X, 1472, 5472, 0, 0); - set_abs_params(&psmouse->dev, ABS_Y, 1408, 4448, 0, 0); - set_abs_params(&psmouse->dev, ABS_PRESSURE, 0, 255, 0, 0); - - set_bit(EV_MSC, psmouse->dev.evbit); - set_bit(MSC_GESTURE, psmouse->dev.mscbit); - - set_bit(EV_KEY, psmouse->dev.evbit); - set_bit(BTN_LEFT, psmouse->dev.keybit); - set_bit(BTN_RIGHT, psmouse->dev.keybit); - set_bit(BTN_FORWARD, psmouse->dev.keybit); - set_bit(BTN_BACK, psmouse->dev.keybit); - if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) + set_bit(EV_ABS, dev->evbit); + set_abs_params(dev, ABS_X, 1472, 5472, 0, 0); + set_abs_params(dev, ABS_Y, 1408, 4448, 0, 0); + set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); + + set_bit(EV_MSC, dev->evbit); + set_bit(MSC_GESTURE, dev->mscbit); + + set_bit(EV_KEY, dev->evbit); + set_bit(BTN_LEFT, dev->keybit); + set_bit(BTN_RIGHT, dev->keybit); + set_bit(BTN_FORWARD, dev->keybit); + set_bit(BTN_BACK, dev->keybit); + if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) { switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: /* @@ -359,22 +343,46 @@ */ break; case 8: - set_bit(BTN_7, psmouse->dev.keybit); - set_bit(BTN_6, psmouse->dev.keybit); + set_bit(BTN_7, dev->keybit); + set_bit(BTN_6, dev->keybit); case 6: - set_bit(BTN_5, psmouse->dev.keybit); - set_bit(BTN_4, psmouse->dev.keybit); + set_bit(BTN_5, dev->keybit); + set_bit(BTN_4, dev->keybit); case 4: - set_bit(BTN_3, psmouse->dev.keybit); - set_bit(BTN_2, psmouse->dev.keybit); + set_bit(BTN_3, dev->keybit); + set_bit(BTN_2, dev->keybit); case 2: - set_bit(BTN_1, psmouse->dev.keybit); - set_bit(BTN_0, psmouse->dev.keybit); + set_bit(BTN_1, dev->keybit); + set_bit(BTN_0, dev->keybit); break; } - clear_bit(EV_REL, psmouse->dev.evbit); - clear_bit(REL_X, psmouse->dev.relbit); - clear_bit(REL_Y, psmouse->dev.relbit); + } + + clear_bit(EV_REL, dev->evbit); + clear_bit(REL_X, dev->relbit); + clear_bit(REL_Y, dev->relbit); +} + +int synaptics_init(struct psmouse *psmouse) +{ + struct synaptics_data *priv; + +#ifndef CONFIG_MOUSE_PS2_SYNAPTICS + return -1; +#endif + + psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL); + if (!priv) + return -1; + memset(priv, 0, sizeof(struct synaptics_data)); + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query/initialize Synaptics hardware.\n"); + goto init_fail; + } + + print_ident(priv); + set_input_params(&psmouse->dev, priv); return 0; @@ -388,7 +396,7 @@ struct synaptics_data *priv = psmouse->private; if (psmouse->type == PSMOUSE_SYNAPTICS && priv) { - synaptics_set_mode(psmouse, 0); + synaptics_mode_cmd(psmouse, 0); if (priv->ptport) { serio_unregister_slave_port(priv->ptport); kfree(priv->ptport); @@ -582,19 +590,20 @@ } break; default: - if (psmouse->pktcnt >= 6) { /* Full packet received */ - if (priv->out_of_sync) { - priv->out_of_sync = 0; - printk(KERN_NOTICE "Synaptics driver resynced.\n"); - } + if (psmouse->pktcnt < 6) + break; /* Wait for full packet */ - if (priv->ptport && synaptics_is_pt_packet(psmouse->packet)) - synaptics_pass_pt_packet(priv->ptport, psmouse->packet); - else - synaptics_process_packet(psmouse); - - psmouse->pktcnt = 0; + if (priv->out_of_sync) { + priv->out_of_sync = 0; + printk(KERN_NOTICE "Synaptics driver resynced.\n"); } + + if (priv->ptport && synaptics_is_pt_packet(psmouse->packet)) + synaptics_pass_pt_packet(priv->ptport, psmouse->packet); + else + synaptics_process_packet(psmouse); + + psmouse->pktcnt = 0; break; } return; ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 4/8] Add touchpad support to mousedev.c. 2003-09-25 16:50 ` [PATCH 3/8] Synaptics code cleanups Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 5/8] Rely less on sanity of AT keyboards Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1344, 2003-09-25 18:22:01+02:00, petero2@telia.com input: Tidy up events reported by a Synaptics pad, add touchpad support to mousedev. drivers/input/mouse/synaptics.c | 68 ++++++++++++++++----------- drivers/input/mousedev.c | 100 +++++++++++++++++++++++++++++----------- include/linux/input.h | 3 + 3 files changed, 118 insertions(+), 53 deletions(-) =================================================================== diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:28 2003 +++ b/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:28 2003 @@ -28,6 +28,16 @@ #include "psmouse.h" #include "synaptics.h" +/* + * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, + * section 2.3.2, which says that they should be valid regardless of the + * actual size of the sensor. + */ +#define XMIN_NOMINAL 1472 +#define XMAX_NOMINAL 5472 +#define YMIN_NOMINAL 1408 +#define YMAX_NOMINAL 4448 + /***************************************************************************** * Synaptics communications functions ****************************************************************************/ @@ -316,20 +326,17 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) { - /* - * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, - * which says that they should be valid regardless of the actual size of - * the sensor. - */ set_bit(EV_ABS, dev->evbit); - set_abs_params(dev, ABS_X, 1472, 5472, 0, 0); - set_abs_params(dev, ABS_Y, 1408, 4448, 0, 0); + set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); + set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); - - set_bit(EV_MSC, dev->evbit); - set_bit(MSC_GESTURE, dev->mscbit); + set_bit(ABS_TOOL_WIDTH, dev->absbit); set_bit(EV_KEY, dev->evbit); + set_bit(BTN_TOOL_FINGER, dev->keybit); + set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); + set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); + set_bit(BTN_LEFT, dev->keybit); set_bit(BTN_RIGHT, dev->keybit); set_bit(BTN_FORWARD, dev->keybit); @@ -489,42 +496,49 @@ struct input_dev *dev = &psmouse->dev; struct synaptics_data *priv = psmouse->private; struct synaptics_hw_state hw; + int num_fingers; + int finger_width; synaptics_parse_hw_state(psmouse->packet, priv, &hw); if (hw.z > 0) { - int w_ok = 0; - /* - * Use capability bits to decide if the w value is valid. - * If not, set it to 5, which corresponds to a finger of - * normal width. - */ + num_fingers = 1; + finger_width = 5; if (SYN_CAP_EXTENDED(priv->capabilities)) { switch (hw.w) { case 0 ... 1: - w_ok = SYN_CAP_MULTIFINGER(priv->capabilities); + if (SYN_CAP_MULTIFINGER(priv->capabilities)) + num_fingers = hw.w + 2; break; case 2: - w_ok = SYN_MODEL_PEN(priv->model_id); + if (SYN_MODEL_PEN(priv->model_id)) + ; /* Nothing, treat a pen as a single finger */ break; case 4 ... 15: - w_ok = SYN_CAP_PALMDETECT(priv->capabilities); + if (SYN_CAP_PALMDETECT(priv->capabilities)) + finger_width = hw.w; break; } } - if (!w_ok) - hw.w = 5; + } else { + num_fingers = 0; + finger_width = 0; } /* Post events */ - input_report_abs(dev, ABS_X, hw.x); - input_report_abs(dev, ABS_Y, hw.y); + if (hw.z > 0) { + input_report_abs(dev, ABS_X, hw.x); + if (SYN_MODEL_ROT180(priv->model_id)) + input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); + else + input_report_abs(dev, ABS_Y, hw.y); + } input_report_abs(dev, ABS_PRESSURE, hw.z); - if (hw.w != priv->old_w) { - input_event(dev, EV_MSC, MSC_GESTURE, hw.w); - priv->old_w = hw.w; - } + input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); + input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); + input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); + input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); input_report_key(dev, BTN_LEFT, hw.left); input_report_key(dev, BTN_RIGHT, hw.right); diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c --- a/drivers/input/mousedev.c Thu Sep 25 18:37:28 2003 +++ b/drivers/input/mousedev.c Thu Sep 25 18:37:28 2003 @@ -58,6 +58,7 @@ unsigned long buttons; unsigned char ready, buffer, bufsiz; unsigned char mode, imexseq, impsseq; + int finger; }; #define MOUSEDEV_SEQ_LEN 6 @@ -73,12 +74,77 @@ static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X; static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y; +static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list *list, unsigned int code, int value) +{ + int size; + + /* Ignore joysticks */ + if (test_bit(BTN_TRIGGER, handle->dev->keybit)) + return; + + /* Handle touchpad data */ + if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit) && + test_bit(ABS_PRESSURE, handle->dev->absbit) && + test_bit(ABS_TOOL_WIDTH, handle->dev->absbit)) { + switch (code) { + case ABS_PRESSURE: + if (!list->finger) { + if (value > 30) + list->finger = 1; + } else { + if (value < 25) + list->finger = 0; + else if (list->finger < 3) + list->finger++; + } + break; + case ABS_X: + if (list->finger >= 3) { + list->dx += (value - list->oldx) / 8; + } + list->oldx = value; + break; + case ABS_Y: + if (list->finger >= 3) { + list->dy -= (value - list->oldy) / 8; + } + list->oldy = value; + break; + } + return; + } + + /* Handle tablet like devices */ + switch (code) { + case ABS_X: + size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; + if (size != 0) { + list->dx += (value * xres - list->oldx) / size; + list->oldx += list->dx * size; + } else { + list->dx += value - list->oldx; + list->oldx += list->dx; + } + break; + case ABS_Y: + size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; + if (size != 0) { + list->dy -= (value * yres - list->oldy) / size; + list->oldy -= list->dy * size; + } else { + list->dy -= value - list->oldy; + list->oldy -= list->dy; + } + break; + } +} + static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL }; struct mousedev **mousedev = mousedevs; struct mousedev_list *list; - int index, size, wake; + int index, wake; while (*mousedev) { @@ -87,31 +153,7 @@ list_for_each_entry(list, &(*mousedev)->list, node) switch (type) { case EV_ABS: - if (test_bit(BTN_TRIGGER, handle->dev->keybit)) - break; - switch (code) { - case ABS_X: - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size != 0) { - list->dx += (value * xres - list->oldx) / size; - list->oldx += list->dx * size; - } else { - list->dx += value - list->oldx; - list->oldx += list->dx; - } - break; - - case ABS_Y: - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size != 0) { - list->dy -= (value * yres - list->oldy) / size; - list->oldy -= list->dy * size; - } else { - list->dy -= value - list->oldy; - list->oldy -= list->dy; - } - break; - } + mousedev_abs_event(handle, list, code, value); break; case EV_REL: @@ -472,6 +514,12 @@ .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, }, /* A tablet like device, at least touch detection, two absolute axes */ + { + .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT, + .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, + .keybit = { [LONG(BTN_TOOL_FINGER)] = BIT(BTN_TOOL_FINGER) }, + .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) }, + }, /* A touchpad */ { }, /* Terminating entry */ }; diff -Nru a/include/linux/input.h b/include/linux/input.h --- a/include/linux/input.h Thu Sep 25 18:37:28 2003 +++ b/include/linux/input.h Thu Sep 25 18:37:28 2003 @@ -404,6 +404,8 @@ #define BTN_TOUCH 0x14a #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c +#define BTN_TOOL_DOUBLETAP 0x14d +#define BTN_TOOL_TRIPLETAP 0x14e #define BTN_WHEEL 0x150 #define BTN_GEAR_DOWN 0x150 @@ -521,6 +523,7 @@ #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b +#define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 #define ABS_MISC 0x28 #define ABS_MAX 0x3f ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 5/8] Rely less on sanity of AT keyboards. 2003-09-25 16:50 ` [PATCH 4/8] Add touchpad support to mousedev.c Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik 2003-10-05 15:12 ` [PATCH 5/8] Rely less on sanity of AT keyboards Martin Josefsson 0 siblings, 2 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1345, 2003-09-25 18:26:39+02:00, vojtech@suse.cz input: Change AT keyboard to use hardware autorepeat and move untranslating to the AT keyboard driver as well. Lower PS/2 mouse default report rate. Fix repeat rate adjustment ioctls accordingly, and update other files to reflect the changes. This should fix most known keyboard problems in 2.6. drivers/char/keyboard.c | 14 -- drivers/input/evdev.c | 10 - drivers/input/input.c | 32 ++++-- drivers/input/keyboard/atkbd.c | 194 +++++++++++++++++++++++++++---------- drivers/input/mouse/psmouse-base.c | 25 +++- drivers/input/serio/i8042.c | 51 --------- include/linux/input.h | 2 include/linux/serio.h | 1 8 files changed, 193 insertions(+), 136 deletions(-) =================================================================== diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c --- a/drivers/char/keyboard.c Thu Sep 25 18:37:20 2003 +++ b/drivers/char/keyboard.c Thu Sep 25 18:37:20 2003 @@ -264,12 +264,6 @@ /* * Setting the keyboard rate. */ -static inline unsigned int ms_to_jiffies(unsigned int ms) { - unsigned int j; - - j = (ms * HZ + 500) / 1000; - return (j > 0) ? j : 1; -} int kbd_rate(struct kbd_repeat *rep) { @@ -283,11 +277,11 @@ if (test_bit(EV_REP, dev->evbit)) { if (rep->delay > 0) - dev->rep[REP_DELAY] = ms_to_jiffies(rep->delay); + input_event(dev, EV_REP, REP_DELAY, rep->delay); if (rep->period > 0) - dev->rep[REP_PERIOD] = ms_to_jiffies(rep->period); - d = dev->rep[REP_DELAY] * 1000 / HZ; - p = dev->rep[REP_PERIOD] * 1000 / HZ; + input_event(dev, EV_REP, REP_PERIOD, rep->period); + d = dev->rep[REP_DELAY]; + p = dev->rep[REP_PERIOD]; } } rep->delay = d; diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c --- a/drivers/input/evdev.c Thu Sep 25 18:37:20 2003 +++ b/drivers/input/evdev.c Thu Sep 25 18:37:20 2003 @@ -220,16 +220,6 @@ case EVIOCGID: return copy_to_user((void *) arg, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0; - case EVIOCGREP: - if (put_user(dev->rep[0], ((int *) arg) + 0)) return -EFAULT; - if (put_user(dev->rep[1], ((int *) arg) + 1)) return -EFAULT; - return 0; - - case EVIOCSREP: - if (get_user(dev->rep[0], ((int *) arg) + 0)) return -EFAULT; - if (get_user(dev->rep[1], ((int *) arg) + 1)) return -EFAULT; - return 0; - case EVIOCGKEYCODE: if (get_user(t, ((int *) arg) + 0)) return -EFAULT; if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL; diff -Nru a/drivers/input/input.c b/drivers/input/input.c --- a/drivers/input/input.c Thu Sep 25 18:37:20 2003 +++ b/drivers/input/input.c Thu Sep 25 18:37:20 2003 @@ -55,6 +55,13 @@ static int input_devices_state; #endif +static inline unsigned int ms_to_jiffies(unsigned int ms) +{ + unsigned int j; + j = (ms * HZ + 500) / 1000; + return (j > 0) ? j : 1; +} + void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { @@ -93,9 +100,9 @@ change_bit(code, dev->key); - if (test_bit(EV_REP, dev->evbit) && dev->rep[REP_PERIOD] && value) { + if (test_bit(EV_REP, dev->evbit) && dev->rep[REP_PERIOD] && dev->timer.data && value) { dev->repeat_key = code; - mod_timer(&dev->timer, jiffies + dev->rep[REP_DELAY]); + mod_timer(&dev->timer, jiffies + ms_to_jiffies(dev->rep[REP_DELAY])); } break; @@ -162,7 +169,7 @@ case EV_REP: - if (code > REP_MAX || dev->rep[code] == value) return; + if (code > REP_MAX || value < 0 || dev->rep[code] == value) return; dev->rep[code] = value; if (dev->event) dev->event(dev, type, code, value); @@ -195,7 +202,7 @@ input_event(dev, EV_KEY, dev->repeat_key, 2); input_sync(dev); - mod_timer(&dev->timer, jiffies + dev->rep[REP_PERIOD]); + mod_timer(&dev->timer, jiffies + ms_to_jiffies(dev->rep[REP_PERIOD])); } int input_accept_process(struct input_handle *handle, struct file *file) @@ -423,13 +430,18 @@ set_bit(EV_SYN, dev->evbit); + /* + * If delay and period are pre-set by the driver, then autorepeating + * is handled by the driver itself and we don't do it in input.c. + */ + init_timer(&dev->timer); - dev->timer.data = (long) dev; - dev->timer.function = input_repeat_key; - if (!dev->rep[REP_DELAY]) - dev->rep[REP_DELAY] = HZ/4; - if (!dev->rep[REP_PERIOD]) - dev->rep[REP_PERIOD] = HZ/33; + if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { + dev->timer.data = (long) dev; + dev->timer.function = input_repeat_key; + dev->rep[REP_DELAY] = 250; + dev->rep[REP_PERIOD] = 33; + } INIT_LIST_HEAD(&dev->h_list); list_add_tail(&dev->node, &input_dev_list); diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c --- a/drivers/input/keyboard/atkbd.c Thu Sep 25 18:37:20 2003 +++ b/drivers/input/keyboard/atkbd.c Thu Sep 25 18:37:20 2003 @@ -10,6 +10,13 @@ * the Free Software Foundation. */ +/* + * This driver can handle standard AT keyboards and PS/2 keyboards in + * Translated and Raw Set 2 and Set 3, as well as AT keyboards on dumb + * input-only controllers and AT keyboards connected over a one way RS232 + * converter. + */ + #include <linux/delay.h> #include <linux/module.h> #include <linux/slab.h> @@ -24,6 +31,7 @@ MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); MODULE_PARM(atkbd_set, "1i"); MODULE_PARM(atkbd_reset, "1i"); +MODULE_PARM(atkbd_softrepeat, "1i"); MODULE_LICENSE("GPL"); static int atkbd_set = 2; @@ -32,6 +40,7 @@ #else static int atkbd_reset = 1; #endif +static int atkbd_softrepeat; /* * Scancode to keycode tables. These are just the default setting, and @@ -47,19 +56,19 @@ 122, 89, 40,120, 26, 13, 0, 0, 58, 54, 28, 27, 0, 43, 0, 0, 85, 86, 90, 91, 92, 93, 14, 94, 95, 79,183, 75, 71,121, 0,123, 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99, - 252, 0, 0, 65, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 252,253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0, 0, 92, 90, 85, 0,137, 0, 0, 0, 0, 91, 89,144,115, 0, 217,100,255, 0, 97,165,164, 0,156, 0, 0,140,115, 0, 0,125, 173,114, 0,113,152,163,151,126,128,166, 0,140, 0,147, 0,127, 159,167,115,160,164, 0, 0,116,158, 0,150,166, 0, 0, 0,142, - 157, 0,114,166,168, 0, 0, 0,155, 0, 98,113, 0,163, 0,138, + 157, 0,114,166,168, 0, 0,213,155, 0, 98,113, 0,163, 0,138, 226, 0, 0, 0, 0, 0,153,140, 0,255, 96, 0, 0, 0,143, 0, 133, 0,116, 0,143, 0,174,133, 0,107, 0,105,102, 0, 0,112, 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119 @@ -76,12 +85,23 @@ 82, 83, 80, 76, 77, 72, 69, 98, 0, 96, 81, 0, 78, 73, 55, 85, 89, 90, 91, 92, 74,185,184,182, 0, 0, 0,125,126,127,112, 0, 0,139,150,163,165,115,152,150,166,140,160,154,113,114,167,168, - 148,149,147,140, 0, 0, 0, 0, 0, 0,251, 0, 0, 0, 0, 0, + 148,149,147,140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 252,253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255 +}; + +static unsigned char atkbd_unxlate_table[128] = { + 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, + 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, + 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, + 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88, 5, 6, 4, 12, 3, + 11, 2, 10, 1, 9,119,126,108,117,125,123,107,115,116,121,105, + 114,122,112,113,127, 96, 97,120, 7, 15, 23, 31, 39, 47, 55, 63, + 71, 79, 86, 94, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111, + 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110 }; #define ATKBD_CMD_SETLEDS 0x10ed @@ -99,12 +119,13 @@ #define ATKBD_RET_ACK 0xfa #define ATKBD_RET_NAK 0xfe +#define ATKBD_RET_BAT 0xaa +#define ATKBD_RET_EMUL0 0xe0 +#define ATKBD_RET_EMULX 0x80 +#define ATKBD_RET_EMUL1 0xe1 +#define ATKBD_RET_RELEASE 0xf0 #define ATKBD_KEY_UNKNOWN 0 -#define ATKBD_KEY_BAT 251 -#define ATKBD_KEY_EMUL0 252 -#define ATKBD_KEY_EMUL1 253 -#define ATKBD_KEY_RELEASE 254 #define ATKBD_KEY_NULL 255 /* @@ -127,7 +148,11 @@ unsigned char emul; unsigned short id; unsigned char write; + unsigned char translated; unsigned char resend; + unsigned char bat_xl; + unsigned int last; + unsigned long time; }; /* @@ -139,7 +164,8 @@ unsigned int flags, struct pt_regs *regs) { struct atkbd *atkbd = serio->private; - int code = data; + unsigned int code = data; + int value; #ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); @@ -153,10 +179,38 @@ goto out; } - if (!flags) + if (!flags && data == ATKBD_RET_ACK) atkbd->resend = 0; #endif + if (atkbd->translated) do { + + if (atkbd->emul != 1) { + if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1 || + code == ATKBD_RET_ACK || code == ATKBD_RET_NAK) + break; + if (code == ATKBD_RET_BAT) { + if (!atkbd->bat_xl) + break; + atkbd->bat_xl = 0; + } + if (code == (ATKBD_RET_BAT & 0x7f)) + atkbd->bat_xl = 1; + } + + if (code < 0x80) { + code = atkbd_unxlate_table[code]; + break; + } + + if (atkbd->cmdcnt) + break; + + code = atkbd_unxlate_table[code & 0x7f]; + atkbd->release = 1; + + } while (0); + switch (code) { case ATKBD_RET_ACK: atkbd->ack = 1; @@ -171,17 +225,17 @@ goto out; } - switch (atkbd->keycode[code]) { - case ATKBD_KEY_BAT: + switch (code) { + case ATKBD_RET_BAT: serio_rescan(atkbd->serio); goto out; - case ATKBD_KEY_EMUL0: + case ATKBD_RET_EMUL0: atkbd->emul = 1; goto out; - case ATKBD_KEY_EMUL1: + case ATKBD_RET_EMUL1: atkbd->emul = 2; goto out; - case ATKBD_KEY_RELEASE: + case ATKBD_RET_RELEASE: atkbd->release = 1; goto out; } @@ -196,21 +250,31 @@ case ATKBD_KEY_NULL: break; case ATKBD_KEY_UNKNOWN: - printk(KERN_WARNING "atkbd.c: Unknown key (set %d, scancode %#x, on %s) %s.\n", - atkbd->set, code, serio->phys, atkbd->release ? "released" : "pressed"); + printk(KERN_WARNING "atkbd.c: Unknown key %s (%s set %d, code %#x, data %#x, on %s).\n", + atkbd->release ? "released" : "pressed", + atkbd->translated ? "translated" : "raw", + atkbd->set, code, data, serio->phys); break; default: -#if 0 - if (!atkbd->release) { - mod_timer(&atkbd->timer, - jiffies + (test_bit(atkbd->keycode[code], - atkbd->dev.key) ? HZ/33 : HZ/4) + HZ/100); - atkbd->lastkey = atkbd->keycode[code]; + value = atkbd->release ? 0 : + (1 + (!atkbd_softrepeat && test_bit(atkbd->keycode[code], atkbd->dev.key))); + + switch (value) { /* Workaround Toshiba laptop multiple keypress */ + case 0: + atkbd->last = 0; + break; + case 1: + atkbd->last = code; + atkbd->time = jiffies + (atkbd->dev.rep[REP_DELAY] * HZ + 500) / 1000 / 2; + break; + case 2: + if (!time_after(jiffies, atkbd->time) && atkbd->last == code) + value = 1; + break; } -#endif input_regs(&atkbd->dev, regs); - input_report_key(&atkbd->dev, atkbd->keycode[code], !atkbd->release); + input_event(&atkbd->dev, EV_KEY, atkbd->keycode[code], value); input_sync(&atkbd->dev); } @@ -219,13 +283,6 @@ return IRQ_HANDLED; } -static void atkbd_force_key_up(unsigned long data) -{ - struct atkbd *atkbd = (void *) data; - input_report_key(&atkbd->dev, atkbd->lastkey, 0); - input_sync(&atkbd->dev); -} - /* * atkbd_sendbyte() sends a byte to the keyboard, and waits for * acknowledge. It doesn't handle resends according to the keyboard @@ -312,7 +369,12 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { struct atkbd *atkbd = dev->private; + struct { int p; u8 v; } period[] = + { {30, 0x00}, {25, 0x02}, {20, 0x04}, {15, 0x08}, {10, 0x0c}, {7, 0x10}, {5, 0x14}, {0, 0x14} }; + struct { int d; u8 v; } delay[] = + { {1000, 0x60}, {750, 0x40}, {500, 0x20}, {250, 0x00}, {0, 0x00} }; char param[2]; + int i, j; if (!atkbd->write) return -1; @@ -337,6 +399,21 @@ } return 0; + + + case EV_REP: + + if (atkbd_softrepeat) return 0; + + i = j = 0; + while (period[i].p > dev->rep[REP_PERIOD]) i++; + while (delay[j].d > dev->rep[REP_DELAY]) j++; + dev->rep[REP_PERIOD] = period[i].p; + dev->rep[REP_DELAY] = delay[j].d; + param[0] = period[i].v | delay[j].v; + atkbd_command(atkbd, param, ATKBD_CMD_SETREP); + + return 0; } return -1; @@ -405,6 +482,9 @@ * IBM RapidAccess / IBM EzButton / Chicony KBP-8993 keyboards. */ + if (atkbd->translated) + return 2; + if (atkbd->id == 0xaca1) { param[0] = 3; atkbd_command(atkbd, param, ATKBD_CMD_SSCANSET); @@ -434,8 +514,11 @@ if (atkbd_command(atkbd, param, ATKBD_CMD_GSCANSET)) return 2; - if (param[0] != 3) + if (param[0] != 3) { + param[0] = 2; + if (atkbd_command(atkbd, param, ATKBD_CMD_SSCANSET)) return 2; + } return 3; } @@ -508,25 +591,35 @@ struct atkbd *atkbd; int i; - if ((serio->type & SERIO_TYPE) != SERIO_8042 && - (((serio->type & SERIO_TYPE) != SERIO_RS232) || (serio->type & SERIO_PROTO) != SERIO_PS2SER)) - return; - if (!(atkbd = kmalloc(sizeof(struct atkbd), GFP_KERNEL))) return; - memset(atkbd, 0, sizeof(struct atkbd)); - if ((serio->type & SERIO_TYPE) == SERIO_8042 && serio->write) - atkbd->write = 1; + switch (serio->type & SERIO_TYPE) { + case SERIO_8042_XL: + atkbd->translated = 1; + case SERIO_8042: + if (serio->write) + atkbd->write = 1; + break; + case SERIO_RS232: + if ((serio->type & SERIO_PROTO) == SERIO_PS2SER) + break; + default: + kfree(atkbd); + return; + } + if (atkbd->write) { atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); atkbd->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); } else atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); - atkbd->dev.rep[REP_DELAY] = HZ/4 + HZ/50; - atkbd->dev.rep[REP_PERIOD] = HZ/33; + if (!atkbd_softrepeat) { + atkbd->dev.rep[REP_DELAY] = 250; + atkbd->dev.rep[REP_PERIOD] = 33; + } atkbd->serio = serio; @@ -540,10 +633,6 @@ serio->private = atkbd; - init_timer(&atkbd->timer); - atkbd->timer.data = (long) atkbd; - atkbd->timer.function = atkbd_force_key_up; - if (serio_open(serio, dev)) { kfree(atkbd); return; @@ -569,7 +658,8 @@ atkbd->dev.ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC); sprintf(atkbd->name, "AT Set 2 Extended keyboard"); } else - sprintf(atkbd->name, "AT Set %d keyboard", atkbd->set); + sprintf(atkbd->name, "AT %s Set %d keyboard", + atkbd->translated ? "Translated" : "Raw", atkbd->set); sprintf(atkbd->phys, "%s/input0", serio->phys); @@ -586,7 +676,7 @@ atkbd->dev.id.version = atkbd->id; for (i = 0; i < 512; i++) - if (atkbd->keycode[i] && atkbd->keycode[i] <= 250) + if (atkbd->keycode[i] && atkbd->keycode[i] < 255) set_bit(atkbd->keycode[i], atkbd->dev.keybit); input_register_device(&atkbd->dev); diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c --- a/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:20 2003 +++ b/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:20 2003 @@ -28,6 +28,8 @@ MODULE_PARM_DESC(psmouse_noext, "Disable any protocol extensions. Useful for KVM switches."); MODULE_PARM(psmouse_resolution, "i"); MODULE_PARM_DESC(psmouse_resolution, "Resolution, in dpi."); +MODULE_PARM(psmouse_rate, "i"); +MODULE_PARM_DESC(psmouse_rate, "Report rate, in reports per second."); MODULE_PARM(psmouse_smartscroll, "i"); MODULE_PARM_DESC(psmouse_smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); MODULE_PARM(psmouse_resetafter, "i"); @@ -38,6 +40,7 @@ static int psmouse_noext; int psmouse_resolution; +unsigned int psmouse_rate = 60; int psmouse_smartscroll = PSMOUSE_LOGITECH_SMARTSCROLL; unsigned int psmouse_resetafter; @@ -443,22 +446,32 @@ } /* + * Here we set the mouse report rate. + */ + +static void psmouse_set_rate(struct psmouse *psmouse) +{ + unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; + int i = 0; + + while (rates[i] > psmouse_rate) i++; + psmouse_command(psmouse, rates + i, PSMOUSE_CMD_SETRATE); +} + +/* * psmouse_initialize() initializes the mouse to a sane state. */ static void psmouse_initialize(struct psmouse *psmouse) { unsigned char param[2]; + /* - * We set the mouse report rate to a highest possible value. - * We try 100 first in case mouse fails to set 200. + * We set the mouse report rate. */ - param[0] = 100; - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE); - param[0] = 200; - psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE); + psmouse_set_rate(psmouse); /* * We also set the resolution and scaling. diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c --- a/drivers/input/serio/i8042.c Thu Sep 25 18:37:20 2003 +++ b/drivers/input/serio/i8042.c Thu Sep 25 18:37:20 2003 @@ -58,8 +58,6 @@ static struct serio i8042_aux_port; static unsigned char i8042_initial_ctr; static unsigned char i8042_ctr; -static unsigned char i8042_last_e0; -static unsigned char i8042_last_release; static unsigned char i8042_mux_open; struct timer_list i8042_timer; @@ -69,18 +67,6 @@ */ #define i8042_request_irq_cookie (&i8042_timer) -static unsigned long i8042_unxlate_seen[256 / BITS_PER_LONG]; -static unsigned char i8042_unxlate_table[128] = { - 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, - 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, - 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, - 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88, 5, 6, 4, 12, 3, - 11, 2, 10, 1, 9,119,126,108,117,125,123,107,115,116,121,105, - 114,122,112,113,127, 96, 97,120, 7, 15, 23, 31, 39, 47, 55, 63, - 71, 79, 86, 94, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111, - 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110 -}; - static irqreturn_t i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs); /* @@ -301,7 +287,7 @@ static struct serio i8042_kbd_port = { - .type = SERIO_8042, + .type = SERIO_8042_XL, .write = i8042_kbd_write, .open = i8042_open, .close = i8042_close, @@ -400,39 +386,10 @@ if (!i8042_kbd_values.exists) continue; - if (i8042_direct) { - serio_interrupt(&i8042_kbd_port, data, dfl, regs); - continue; - } - - if (data > 0x7f) { - unsigned char index = (data & 0x7f) | (i8042_last_e0 << 7); - /* work around hardware that doubles key releases */ - if (index == i8042_last_release) { - dbg("i8042 skipped double release (%d)\n", index); - i8042_last_e0 = 0; - continue; - } - if (index == 0xaa || index == 0xb6) - set_bit(index, i8042_unxlate_seen); - if (test_and_clear_bit(index, i8042_unxlate_seen)) { - serio_interrupt(&i8042_kbd_port, 0xf0, dfl, regs); - data = i8042_unxlate_table[data & 0x7f]; - i8042_last_release = index; - } - } else { - set_bit(data | (i8042_last_e0 << 7), i8042_unxlate_seen); - data = i8042_unxlate_table[data]; - i8042_last_release = 0; - } - - i8042_last_e0 = (data == 0xe0); - serio_interrupt(&i8042_kbd_port, data, dfl, regs); } - /* FIXME - was it really ours? */ - return IRQ_HANDLED; + return IRQ_RETVAL(j); } /* @@ -511,8 +468,10 @@ * BIOSes. */ - if (i8042_direct) + if (i8042_direct) { i8042_ctr &= ~I8042_CTR_XLATE; + i8042_kbd_port.type = SERIO_8042; + } /* * Write CTR back. diff -Nru a/include/linux/input.h b/include/linux/input.h --- a/include/linux/input.h Thu Sep 25 18:37:20 2003 +++ b/include/linux/input.h Thu Sep 25 18:37:20 2003 @@ -56,8 +56,6 @@ #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ -#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ -#define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */ #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ diff -Nru a/include/linux/serio.h b/include/linux/serio.h --- a/include/linux/serio.h Thu Sep 25 18:37:20 2003 +++ b/include/linux/serio.h Thu Sep 25 18:37:20 2003 @@ -107,6 +107,7 @@ #define SERIO_HIL_MLC 0x03000000UL #define SERIO_PC9800 0x04000000UL #define SERIO_PS_PSTHRU 0x05000000UL +#define SERIO_8042_XL 0x06000000UL #define SERIO_PROTO 0xFFUL #define SERIO_MSC 0x01 ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes. 2003-09-25 16:50 ` [PATCH 5/8] Rely less on sanity of AT keyboards Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik ` (2 more replies) 2003-10-05 15:12 ` [PATCH 5/8] Rely less on sanity of AT keyboards Martin Josefsson 1 sibling, 3 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1346, 2003-09-25 18:28:12+02:00, hirofumi@mail.parknet.co.jp input: Create new KD?BENT ioctls with a bigger key range (int), so that it's posible to recompile kbdutils on 2.6 and load keymaps for keys beyond 128. kbdutils compiled on 2.4 will keep working on 2.6, unfortunately not vice versa, without changing kbdutils. arch/mips/kernel/ioctl32.c | 2 + drivers/char/vt_ioctl.c | 51 +++++++++++++++++++++++++++++-------------- include/linux/compat_ioctl.h | 2 + include/linux/kd.h | 14 +++++++++-- 4 files changed, 50 insertions(+), 19 deletions(-) =================================================================== diff -Nru a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c --- a/arch/mips/kernel/ioctl32.c Thu Sep 25 18:37:13 2003 +++ b/arch/mips/kernel/ioctl32.c Thu Sep 25 18:37:13 2003 @@ -884,6 +884,8 @@ COMPATIBLE_IOCTL(KDGKBMODE) COMPATIBLE_IOCTL(KDSKBMETA) COMPATIBLE_IOCTL(KDGKBMETA) +COMPATIBLE_IOCTL(KDGKBENT_OLD) +COMPATIBLE_IOCTL(KDSKBENT_OLD) COMPATIBLE_IOCTL(KDGKBENT) COMPATIBLE_IOCTL(KDSKBENT) COMPATIBLE_IOCTL(KDGKBSENT) diff -Nru a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c --- a/drivers/char/vt_ioctl.c Thu Sep 25 18:37:13 2003 +++ b/drivers/char/vt_ioctl.c Thu Sep 25 18:37:13 2003 @@ -75,24 +75,41 @@ #define s (tmp.kb_table) #define v (tmp.kb_value) static inline int -do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kbd) +do_kdsk_ioctl(int cmd, void *user_kbe, int perm, struct kbd_struct *kbd) { - struct kbentry tmp; + struct kbentry tmp, *kbe = user_kbe;; + struct kbentry_old old, *old_kbe = user_kbe; ushort *key_map, val, ov; - if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry))) - return -EFAULT; - + if (cmd == KDGKBENT_OLD || cmd == KDSKBENT_OLD) { + /* backward compatibility */ + if (copy_from_user(&old, old_kbe, sizeof(struct kbentry_old))) + return -EFAULT; + + tmp.kb_index = old.kb_index; + tmp.kb_table = old.kb_table; + tmp.kb_value = old.kb_value; + } else { + if (copy_from_user(&tmp, kbe, sizeof(struct kbentry))) + return -EFAULT; + } + switch (cmd) { + case KDGKBENT_OLD: case KDGKBENT: key_map = key_maps[s]; if (key_map) { - val = U(key_map[i]); - if (kbd->kbdmode != VC_UNICODE && KTYP(val) >= NR_TYPES) - val = K_HOLE; + val = U(key_map[i]); + if (kbd->kbdmode != VC_UNICODE && KTYP(val) >= NR_TYPES) + val = K_HOLE; } else - val = (i ? K_HOLE : K_NOSUCHMAP); - return put_user(val, &user_kbe->kb_value); + val = (i ? K_HOLE : K_NOSUCHMAP); + + if (cmd == KDGKBENT_OLD) + return put_user(val, &old_kbe->kb_value); + return put_user(val, &kbe->kb_value); + + case KDSKBENT_OLD: case KDSKBENT: if (!perm) return -EPERM; @@ -100,20 +117,20 @@ /* disallocate map */ key_map = key_maps[s]; if (s && key_map) { - key_maps[s] = 0; - if (key_map[0] == U(K_ALLOCATED)) { + key_maps[s] = 0; + if (key_map[0] == U(K_ALLOCATED)) { kfree(key_map); keymap_count--; - } + } } break; } if (KTYP(v) < NR_TYPES) { - if (KVAL(v) > max_vals[KTYP(v)]) + if (KVAL(v) > max_vals[KTYP(v)]) return -EINVAL; } else - if (kbd->kbdmode != VC_UNICODE) + if (kbd->kbdmode != VC_UNICODE) return -EINVAL; /* ++Geert: non-PC keyboards may generate keycode zero */ @@ -566,9 +583,11 @@ perm=0; return do_kbkeycode_ioctl(cmd, (struct kbkeycode *)arg, perm); + case KDGKBENT_OLD: + case KDSKBENT_OLD: case KDGKBENT: case KDSKBENT: - return do_kdsk_ioctl(cmd, (struct kbentry *)arg, perm, kbd); + return do_kdsk_ioctl(cmd, (void *)arg, perm, kbd); case KDGKBSENT: case KDSKBSENT: diff -Nru a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h --- a/include/linux/compat_ioctl.h Thu Sep 25 18:37:13 2003 +++ b/include/linux/compat_ioctl.h Thu Sep 25 18:37:13 2003 @@ -161,6 +161,8 @@ COMPATIBLE_IOCTL(KDGKBMODE) COMPATIBLE_IOCTL(KDSKBMETA) COMPATIBLE_IOCTL(KDGKBMETA) +COMPATIBLE_IOCTL(KDGKBENT_OLD) +COMPATIBLE_IOCTL(KDSKBENT_OLD) COMPATIBLE_IOCTL(KDGKBENT) COMPATIBLE_IOCTL(KDSKBENT) COMPATIBLE_IOCTL(KDGKBSENT) diff -Nru a/include/linux/kd.h b/include/linux/kd.h --- a/include/linux/kd.h Thu Sep 25 18:37:13 2003 +++ b/include/linux/kd.h Thu Sep 25 18:37:13 2003 @@ -94,18 +94,26 @@ #define KDGKBLED 0x4B64 /* get led flags (not lights) */ #define KDSKBLED 0x4B65 /* set led flags (not lights) */ -struct kbentry { +struct kbentry_old { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; +#define KDGKBENT_OLD 0x4B46 /* gets one entry in translation table (old) */ +#define KDSKBENT_OLD 0x4B47 /* sets one entry in translation table (old) */ + +struct kbentry { + unsigned int kb_table; + unsigned int kb_index; + unsigned short kb_value; +}; #define K_NORMTAB 0x00 #define K_SHIFTTAB 0x01 #define K_ALTTAB 0x02 #define K_ALTSHIFTTAB 0x03 -#define KDGKBENT 0x4B46 /* gets one entry in translation table */ -#define KDSKBENT 0x4B47 /* sets one entry in translation table */ +#define KDGKBENT 0x4B73 /* gets one entry in translation table */ +#define KDSKBENT 0x4B74 /* sets one entry in translation table */ struct kbsentry { unsigned char kb_func; ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 7/8] Fix handling of rotated Synaptics touchpads. 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev Vojtech Pavlik 2003-09-25 22:57 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Andrew Morton 2003-09-25 23:38 ` Andries Brouwer 2 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1347, 2003-09-25 18:29:15+02:00, petero2@telia.com input: Fix broken handling of rotated Synaptics touchpads. The infoRot180 and infoPortrait bits are for information only. The touchpad uses the same X/Y coordinate system regardless of the orientation, so the software shouldn't care about these bits. synaptics.c | 5 +---- 1 files changed, 1 insertion(+), 4 deletions(-) =================================================================== diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:05 2003 +++ b/drivers/input/mouse/synaptics.c Thu Sep 25 18:37:05 2003 @@ -528,10 +528,7 @@ /* Post events */ if (hw.z > 0) { input_report_abs(dev, ABS_X, hw.x); - if (SYN_MODEL_ROT180(priv->model_id)) - input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); - else - input_report_abs(dev, ABS_Y, hw.y); + input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); } input_report_abs(dev, ABS_PRESSURE, hw.z); ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-25 16:50 ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik @ 2003-09-25 16:50 ` Vojtech Pavlik 2003-09-25 18:23 ` Dmitry Torokhov 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 16:50 UTC (permalink / raw) To: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel You can pull this changeset from: bk://kernel.bkbits.net/vojtech/input =================================================================== ChangeSet@1.1348, 2003-09-25 18:32:35+02:00, vojtech@mail.parknet.co.jp input: Add BTN_TOUCH to Synaptics pad driver. This fixes the joydev grabbing of the pads, as well as simplifies the mousedev driver. mouse/synaptics.c | 4 ++ mousedev.c | 77 ++++++++++++++++++++++-------------------------------- 2 files changed, 36 insertions(+), 45 deletions(-) =================================================================== diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c --- a/drivers/input/mouse/synaptics.c Thu Sep 25 18:36:58 2003 +++ b/drivers/input/mouse/synaptics.c Thu Sep 25 18:36:58 2003 @@ -333,6 +333,7 @@ set_bit(ABS_TOOL_WIDTH, dev->absbit); set_bit(EV_KEY, dev->evbit); + set_bit(BTN_TOUCH, dev->keybit); set_bit(BTN_TOOL_FINGER, dev->keybit); set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); @@ -531,6 +532,9 @@ input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y); } input_report_abs(dev, ABS_PRESSURE, hw.z); + + if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); + if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c --- a/drivers/input/mousedev.c Thu Sep 25 18:36:58 2003 +++ b/drivers/input/mousedev.c Thu Sep 25 18:36:58 2003 @@ -83,59 +83,40 @@ return; /* Handle touchpad data */ - if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit) && - test_bit(ABS_PRESSURE, handle->dev->absbit) && - test_bit(ABS_TOOL_WIDTH, handle->dev->absbit)) { + if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { + + if (list->finger && list->finger < 3) + list->finger++; + switch (code) { - case ABS_PRESSURE: - if (!list->finger) { - if (value > 30) - list->finger = 1; - } else { - if (value < 25) - list->finger = 0; - else if (list->finger < 3) - list->finger++; - } - break; - case ABS_X: - if (list->finger >= 3) { - list->dx += (value - list->oldx) / 8; - } - list->oldx = value; - break; - case ABS_Y: - if (list->finger >= 3) { - list->dy -= (value - list->oldy) / 8; - } - list->oldy = value; - break; + case ABS_X: + if (list->finger == 3) + list->dx += (value - list->oldx) / 8; + list->oldx = value; + return; + case ABS_Y: + if (list->finger == 3) + list->dy -= (value - list->oldy) / 8; + list->oldy = value; + return; } return; } - /* Handle tablet like devices */ + /* Handle tablet data */ switch (code) { - case ABS_X: - size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - if (size != 0) { + case ABS_X: + size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; + if (size == 0) size = xres; list->dx += (value * xres - list->oldx) / size; list->oldx += list->dx * size; - } else { - list->dx += value - list->oldx; - list->oldx += list->dx; - } - break; - case ABS_Y: - size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - if (size != 0) { + return; + case ABS_Y: + size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; + if (size == 0) size = yres; list->dy -= (value * yres - list->oldy) / size; list->oldy -= list->dy * size; - } else { - list->dy -= value - list->oldy; - list->oldy -= list->dy; - } - break; + return; } } @@ -166,8 +147,13 @@ case EV_KEY: switch (code) { + case BTN_TOUCH: /* Handle touchpad data */ + if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) { + list->finger = value; + return; + } case BTN_0: - case BTN_TOUCH: + case BTN_FORWARD: case BTN_LEFT: index = 0; break; case BTN_4: case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } @@ -175,6 +161,7 @@ case BTN_1: case BTN_RIGHT: index = 1; break; case BTN_3: + case BTN_BACK: case BTN_SIDE: if (list->mode == 2) { index = 3; break; } case BTN_2: case BTN_STYLUS2: @@ -333,7 +320,7 @@ { struct mousedev_list *list = file->private_data; unsigned char c; - int i; + unsigned int i; for (i = 0; i < count; i++) { ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-25 16:50 ` [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev Vojtech Pavlik @ 2003-09-25 18:23 ` Dmitry Torokhov 2003-09-25 22:30 ` Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Dmitry Torokhov @ 2003-09-25 18:23 UTC (permalink / raw) To: Vojtech Pavlik, akpm, petero2, Andries.Brouwer, linux-kernel On Thursday 25 September 2003 11:50 am, Vojtech Pavlik wrote: > + > + if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); > + if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); > Couple of questions: - Why does it use hard-coded values? Different people prefer different settings. - Are userspace drivers supposed to use BTN_TOUCH event to detect whether the pad is touched or ABS_PRESSURE? If ABS_PRESSURE then BTN_TOUCH is unneeded; otherwise it's not configurable. - Introducing BTN_TOUCH as far as I can seen does nothing to prevent joydev grabbing either Synaptics or touchscreens... Is there a patch missing? Anyway, I still thing that joydev claims are too broad. Next time you add a non-joystick device you will need to re-examine joydev and it should be other way around - if you add a joystick you need to make sure that joydev grabs it. This way you will catch most problems right away. BTW, any chance on including pass-through patches? Do you want me to re-diff them? Dmitry ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-25 18:23 ` Dmitry Torokhov @ 2003-09-25 22:30 ` Vojtech Pavlik 2003-09-26 5:24 ` Peter Osterlund 2003-09-26 7:24 ` Dmitry Torokhov 0 siblings, 2 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 22:30 UTC (permalink / raw) To: Dmitry Torokhov Cc: Vojtech Pavlik, akpm, petero2, Andries.Brouwer, linux-kernel On Thu, Sep 25, 2003 at 01:23:33PM -0500, Dmitry Torokhov wrote: > On Thursday 25 September 2003 11:50 am, Vojtech Pavlik wrote: > > + > > + if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); > > + if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); > > > > Couple of questions: > > - Why does it use hard-coded values? Different people prefer different > settings. I just moved them from mousedev.c. > - Are userspace drivers supposed to use BTN_TOUCH event to detect whether > the pad is touched or ABS_PRESSURE? If ABS_PRESSURE then BTN_TOUCH is > unneeded; otherwise it's not configurable. A simple userspace program or kernel handler can use BTN_TOUCH, and it'll trade off configurability for simplicity. BTN_TOUCH will most likely be present on all touchpads, touchscreens and tablets, too, so it can be relied on as a generic feature. An advanced one can be configurable to use ABS_PRESSURE with user defined thresholds. Another of the reasons is that ABS_PRESSURE is hardware-dependent. Different device types will need very different thresholds. With the driver providing the thresholded value, a generic handler (like mousedev) can work without external configuration. > - Introducing BTN_TOUCH as far as I can seen does nothing to prevent joydev > grabbing either Synaptics or touchscreens... Is there a patch missing? No. It's a statement you're missing near the beginning of joydev_connect(). > Anyway, I still thing that joydev claims are too broad. Next time you add > a non-joystick device you will need to re-examine joydev and it should be > other way around - if you add a joystick you need to make sure that joydev > grabs it. This way you will catch most problems right away. It is possible. Maybe it's time now to define what event types each type of device is supposed to have so that problems like this don't appear. > BTW, any chance on including pass-through patches? Do you want me to re-diff > them? Hmm, I thought I've merged them in already, but obviously I did not. Please resend them (rediffed if possible). Thanks. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-25 22:30 ` Vojtech Pavlik @ 2003-09-26 5:24 ` Peter Osterlund 2003-09-26 7:24 ` Dmitry Torokhov 1 sibling, 0 replies; 29+ messages in thread From: Peter Osterlund @ 2003-09-26 5:24 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: Dmitry Torokhov, akpm, Andries.Brouwer, linux-kernel [-- Attachment #1: Type: TEXT/PLAIN, Size: 527 bytes --] On Fri, 26 Sep 2003, Vojtech Pavlik wrote: > On Thu, Sep 25, 2003 at 01:23:33PM -0500, Dmitry Torokhov wrote: > > > BTW, any chance on including pass-through patches? Do you want me to re-diff > > them? > > Hmm, I thought I've merged them in already, but obviously I did not. > Please resend them (rediffed if possible). Thanks. If these patches are the same as the "reconnect" patches I have in my tree, I already have them rediffed (attached). -- Peter Osterlund - petero2@telia.com http://w1.894.telia.com/~u89404340 [-- Attachment #2: Type: TEXT/PLAIN, Size: 4192 bytes --] The patch below introduces a new serio_dev method "reconnect". It's purpose is to re-initialize attached hardware while keeping the same input device. Reconnect can be used for example during resume or with somewhat broken hardware like my laptop/docking station which resets the touchpad back in relative mode without telling anyone whenever I dock or un-dock. The regular disconnect/connect solution is not working because clients (like XFree) like to keep the original input device open so after connecting the touchpad it will create a brand new input device. With reconnect the driver has an option to re-initialize hardware but keep the same input device (given that hardware didn't change). If reconnect fails serio automatically fall back to disconnect/reconnect scheme. What you think? Dmitry P.S. I have a new patch for Synaptics touchpad that makes use of this new functionality that I will sent to the LKML shortly linux-petero/drivers/input/serio/serio.c | 31 ++++++++++++++++++++++++------- linux-petero/include/linux/serio.h | 2 ++ 2 files changed, 26 insertions(+), 7 deletions(-) diff -puN drivers/input/serio/serio.c~serio-reconnect drivers/input/serio/serio.c --- linux/drivers/input/serio/serio.c~serio-reconnect 2003-09-25 20:18:59.000000000 +0200 +++ linux-petero/drivers/input/serio/serio.c 2003-09-25 20:18:59.000000000 +0200 @@ -57,6 +57,7 @@ EXPORT_SYMBOL(serio_unregister_device); EXPORT_SYMBOL(serio_open); EXPORT_SYMBOL(serio_close); EXPORT_SYMBOL(serio_rescan); +EXPORT_SYMBOL(serio_reconnect); struct serio_event { int type; @@ -83,6 +84,7 @@ static void serio_find_dev(struct serio } #define SERIO_RESCAN 1 +#define SERIO_RECONNECT 2 static DECLARE_WAIT_QUEUE_HEAD(serio_wait); static DECLARE_COMPLETION(serio_exited); @@ -96,6 +98,12 @@ void serio_handle_events(void) event = container_of(node, struct serio_event, node); switch (event->type) { + case SERIO_RECONNECT : + if (event->serio->dev && event->serio->dev->reconnect) + if (event->serio->dev->reconnect(event->serio) == 0) + break; + /* reconnect failed - fall through to rescan */ + case SERIO_RESCAN : down(&serio_sem); if (event->serio->dev && event->serio->dev->disconnect) @@ -130,18 +138,27 @@ static int serio_thread(void *nothing) complete_and_exit(&serio_exited, 0); } -void serio_rescan(struct serio *serio) +static void serio_queue_event(struct serio *serio, int event_type) { struct serio_event *event; - if (!(event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) - return; + if ((event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC))) { + event->type = event_type; + event->serio = serio; - event->type = SERIO_RESCAN; - event->serio = serio; + list_add_tail(&event->node, &serio_event_list); + wake_up(&serio_wait); + } +} - list_add_tail(&event->node, &serio_event_list); - wake_up(&serio_wait); +void serio_rescan(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RESCAN); +} + +void serio_reconnect(struct serio *serio) +{ + serio_queue_event(serio, SERIO_RECONNECT); } irqreturn_t serio_interrupt(struct serio *serio, diff -puN include/linux/serio.h~serio-reconnect include/linux/serio.h --- linux/include/linux/serio.h~serio-reconnect 2003-09-25 20:18:59.000000000 +0200 +++ linux-petero/include/linux/serio.h 2003-09-25 20:18:59.000000000 +0200 @@ -53,6 +53,7 @@ struct serio_dev { irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int, struct pt_regs *); void (*connect)(struct serio *, struct serio_dev *dev); + int (*reconnect)(struct serio *); void (*disconnect)(struct serio *); void (*cleanup)(struct serio *); @@ -62,6 +63,7 @@ struct serio_dev { int serio_open(struct serio *serio, struct serio_dev *dev); void serio_close(struct serio *serio); void serio_rescan(struct serio *serio); +void serio_reconnect(struct serio *serio); irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs); void serio_register_port(struct serio *serio); _ [-- Attachment #3: Type: TEXT/PLAIN, Size: 15061 bytes --] Here is the update to the Synaptics touchpad driver. The changes are: 1. Support for pass-through port moved from Synaptics driver to psmouse itself, it is cleaner and should allow using it in other drivers if needed. 2. The driver makes use of new reconnect functionality in serio. It will try to keep the same input device after resume or when it resets itself. 3. If mouse is disconnected or other mouse plugged in while sleeping the driver should correctly recognize that and create a new serio/input device. Dmitry linux-petero/drivers/input/mouse/logips2pp.c | 1 linux-petero/drivers/input/mouse/psmouse-base.c | 94 +++++++++++--- linux-petero/drivers/input/mouse/psmouse.h | 13 ++ linux-petero/drivers/input/mouse/synaptics.c | 153 +++++++++++++++--------- linux-petero/drivers/input/mouse/synaptics.h | 4 5 files changed, 186 insertions(+), 79 deletions(-) diff -puN drivers/input/mouse/logips2pp.c~synaptics-reconnect drivers/input/mouse/logips2pp.c --- linux/drivers/input/mouse/logips2pp.c~synaptics-reconnect 2003-09-25 20:19:02.000000000 +0200 +++ linux-petero/drivers/input/mouse/logips2pp.c 2003-09-25 20:19:02.000000000 +0200 @@ -10,6 +10,7 @@ */ #include <linux/input.h> +#include <linux/serio.h> #include "psmouse.h" #include "logips2pp.h" diff -puN drivers/input/mouse/psmouse-base.c~synaptics-reconnect drivers/input/mouse/psmouse-base.c --- linux/drivers/input/mouse/psmouse-base.c~synaptics-reconnect 2003-09-25 20:19:02.000000000 +0200 +++ linux-petero/drivers/input/mouse/psmouse-base.c 2003-09-25 20:19:02.000000000 +0200 @@ -141,7 +141,8 @@ static irqreturn_t psmouse_interrupt(str goto out; } - if (psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { + if (psmouse->state == PSMOUSE_ACTIVATED && + psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n", psmouse->name, psmouse->phys, psmouse->pktcnt); psmouse->pktcnt = 0; @@ -519,7 +520,16 @@ static void psmouse_disconnect(struct se struct psmouse *psmouse = serio->private; psmouse->state = PSMOUSE_IGNORE; - synaptics_disconnect(psmouse); + + if (psmouse->ptport) { + if (psmouse->ptport->deactivate) + psmouse->ptport->deactivate(psmouse); + serio_unregister_slave_port(&psmouse->ptport->serio); + } + + if (psmouse->disconnect) + psmouse->disconnect(psmouse); + input_unregister_device(&psmouse->dev); serio_close(serio); kfree(psmouse); @@ -532,19 +542,9 @@ static void psmouse_disconnect(struct se static int psmouse_pm_callback(struct pm_dev *dev, pm_request_t request, void *data) { struct psmouse *psmouse = dev->data; - struct serio_dev *ser_dev = psmouse->serio->dev; - - synaptics_disconnect(psmouse); - /* We need to reopen the serio port to reinitialize the i8042 controller */ - serio_close(psmouse->serio); - serio_open(psmouse->serio, ser_dev); - - /* Probe and re-initialize the mouse */ - psmouse_probe(psmouse); - psmouse_initialize(psmouse); - synaptics_pt_init(psmouse); - psmouse_activate(psmouse); + psmouse->state = PSMOUSE_IGNORE; + serio_reconnect(psmouse->serio); return 0; } @@ -590,10 +590,12 @@ static void psmouse_connect(struct serio return; } - pmdev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, psmouse_pm_callback); - if (pmdev) { - psmouse->dev.pm_dev = pmdev; - pmdev->data = psmouse; + if (serio->type != SERIO_PS_PSTHRU) { + pmdev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, psmouse_pm_callback); + if (pmdev) { + psmouse->dev.pm_dev = pmdev; + pmdev->data = psmouse; + } } sprintf(psmouse->devname, "%s %s %s", @@ -614,14 +616,68 @@ static void psmouse_connect(struct serio psmouse_initialize(psmouse); - synaptics_pt_init(psmouse); + if (psmouse->ptport) { + printk(KERN_INFO "serio: %s port at %s\n", psmouse->ptport->serio.name, psmouse->phys); + serio_register_slave_port(&psmouse->ptport->serio); + if (psmouse->ptport->activate) + psmouse->ptport->activate(psmouse); + } psmouse_activate(psmouse); } +static int psmouse_reconnect(struct serio *serio) +{ + struct psmouse *psmouse = serio->private; + struct serio_dev *dev = serio->dev; + int old_type = psmouse->type; + + if (!dev) { + printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); + return -1; + } + + /* We need to reopen the serio port to reinitialize the i8042 controller */ + serio_close(serio); + if (serio_open(serio, dev)) { + /* do a disconnect here as serio_open leaves dev as NULL so disconnect + * will not be called automatically later + */ + psmouse_disconnect(serio); + return -1; + } + + psmouse->state = PSMOUSE_NEW_DEVICE; + psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0; + if (psmouse->reconnect) { + if (psmouse->reconnect(psmouse)) + return -1; + } else if (psmouse_probe(psmouse) != old_type) + return -1; + + /* ok, the device type (and capabilities) match the old one, + * we can continue using it, complete intialization + */ + psmouse->type = old_type; + psmouse_initialize(psmouse); + + if (psmouse->ptport) { + if (psmouse_reconnect(&psmouse->ptport->serio)) { + serio_unregister_slave_port(&psmouse->ptport->serio); + serio_register_slave_port(&psmouse->ptport->serio); + if (psmouse->ptport->activate) + psmouse->ptport->activate(psmouse); + } + } + + psmouse_activate(psmouse); + return 0; +} + static struct serio_dev psmouse_dev = { .interrupt = psmouse_interrupt, .connect = psmouse_connect, + .reconnect = psmouse_reconnect, .disconnect = psmouse_disconnect, .cleanup = psmouse_cleanup, }; diff -puN drivers/input/mouse/psmouse.h~synaptics-reconnect drivers/input/mouse/psmouse.h --- linux/drivers/input/mouse/psmouse.h~synaptics-reconnect 2003-09-25 20:19:02.000000000 +0200 +++ linux-petero/drivers/input/mouse/psmouse.h 2003-09-25 20:19:02.000000000 +0200 @@ -22,10 +22,20 @@ #define PSMOUSE_ACTIVATED 1 #define PSMOUSE_IGNORE 2 +struct psmouse; + +struct psmouse_ptport { + struct serio serio; + + void (*activate)(struct psmouse *parent); + void (*deactivate)(struct psmouse *parent); +}; + struct psmouse { void *private; struct input_dev dev; struct serio *serio; + struct psmouse_ptport *ptport; char *vendor; char *name; unsigned char cmdbuf[8]; @@ -41,6 +51,9 @@ struct psmouse { char error; char devname[64]; char phys[32]; + + int (*reconnect)(struct psmouse *psmouse); + void (*disconnect)(struct psmouse *psmouse); }; #define PSMOUSE_PS2 1 diff -puN drivers/input/mouse/synaptics.c~synaptics-reconnect drivers/input/mouse/synaptics.c --- linux/drivers/input/mouse/synaptics.c~synaptics-reconnect 2003-09-25 20:19:02.000000000 +0200 +++ linux-petero/drivers/input/mouse/synaptics.c 2003-09-25 20:19:02.000000000 +0200 @@ -192,11 +192,24 @@ static void print_ident(struct synaptics } } +static int synaptics_detect(struct psmouse *psmouse) +{ + unsigned char param[4]; + + param[0] = 0; + + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES); + psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); + + return param[1] == 0x47 ? 0 : -1; +} + static int synaptics_query_hardware(struct psmouse *psmouse) { - struct synaptics_data *priv = psmouse->private; int retries = 0; - int mode; while ((retries++ < 3) && synaptics_reset(psmouse)) printk(KERN_ERR "synaptics reset failed\n"); @@ -208,7 +221,14 @@ static int synaptics_query_hardware(stru if (synaptics_capability(psmouse)) return -1; - mode = SYN_BIT_ABSOLUTE_MODE | SYN_BIT_HIGH_RATE; + return 0; +} + +static int synaptics_set_mode(struct psmouse *psmouse, int mode) +{ + struct synaptics_data *priv = psmouse->private; + + mode |= SYN_BIT_ABSOLUTE_MODE | SYN_BIT_HIGH_RATE; if (SYN_ID_MAJOR(priv->identity) >= 4) mode |= SYN_BIT_DISABLE_GESTURE; if (SYN_CAP_EXTENDED(priv->capabilities)) @@ -265,49 +285,38 @@ static void synaptics_pass_pt_packet(str } } -int synaptics_pt_init(struct psmouse *psmouse) +static void synaptics_pt_activate(struct psmouse *psmouse) { - struct synaptics_data *priv = psmouse->private; - struct serio *port; - struct psmouse *child; + struct psmouse *child = psmouse->ptport->serio.private; - if (psmouse->type != PSMOUSE_SYNAPTICS) - return -1; - if (!SYN_CAP_EXTENDED(priv->capabilities)) - return -1; - if (!SYN_CAP_PASS_THROUGH(priv->capabilities)) - return -1; + /* adjust the touchpad to child's choice of protocol */ + if (child && child->type >= PSMOUSE_GENPS) { + if (synaptics_set_mode(psmouse, SYN_BIT_FOUR_BYTE_CLIENT)) + printk(KERN_INFO "synaptics: failed to enable 4-byte guest protocol\n"); + } +} + +static void synaptics_pt_create(struct psmouse *psmouse) +{ + struct psmouse_ptport *port; - priv->ptport = port = kmalloc(sizeof(struct serio), GFP_KERNEL); + psmouse->ptport = port = kmalloc(sizeof(struct psmouse_ptport), GFP_KERNEL); if (!port) { - printk(KERN_ERR "synaptics: not enough memory to allocate serio port\n"); - return -1; + printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); + return; } - memset(port, 0, sizeof(struct serio)); - port->type = SERIO_PS_PSTHRU; - port->name = "Synaptics pass-through"; - port->phys = "synaptics-pt/serio0"; - port->write = synaptics_pt_write; - port->open = synaptics_pt_open; - port->close = synaptics_pt_close; - port->driver = psmouse; + memset(port, 0, sizeof(struct psmouse_ptport)); - printk(KERN_INFO "serio: %s port at %s\n", port->name, psmouse->phys); - serio_register_slave_port(port); + port->serio.type = SERIO_PS_PSTHRU; + port->serio.name = "Synaptics pass-through"; + port->serio.phys = "synaptics-pt/serio0"; + port->serio.write = synaptics_pt_write; + port->serio.open = synaptics_pt_open; + port->serio.close = synaptics_pt_close; + port->serio.driver = psmouse; - /* adjust the touchpad to child's choice of protocol */ - child = port->private; - if (child && child->type >= PSMOUSE_GENPS) { - if (synaptics_mode_cmd(psmouse, (SYN_BIT_ABSOLUTE_MODE | - SYN_BIT_HIGH_RATE | - SYN_BIT_DISABLE_GESTURE | - SYN_BIT_FOUR_BYTE_CLIENT | - SYN_BIT_W_MODE))) - printk(KERN_INFO "synaptics: failed to enable 4-byte guest protocol\n"); - } - - return 0; + port->activate = synaptics_pt_activate; } /***************************************************************************** @@ -371,6 +380,39 @@ static void set_input_params(struct inpu clear_bit(REL_Y, dev->relbit); } +static void synaptics_disconnect(struct psmouse *psmouse) +{ + synaptics_mode_cmd(psmouse, 0); + kfree(psmouse->private); +} + +static int synaptics_reconnect(struct psmouse *psmouse) +{ + struct synaptics_data *priv = psmouse->private; + struct synaptics_data old_priv = *priv; + + if (synaptics_detect(psmouse)) + return -1; + + if (synaptics_query_hardware(psmouse)) { + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + return -1; + } + + if (old_priv.identity != priv->identity || + old_priv.model_id != priv->model_id || + old_priv.capabilities != priv->capabilities || + old_priv.ext_cap != priv->ext_cap) + return -1; + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); + return -1; + } + + return 0; +} + int synaptics_init(struct psmouse *psmouse) { struct synaptics_data *priv; @@ -385,13 +427,24 @@ int synaptics_init(struct psmouse *psmou memset(priv, 0, sizeof(struct synaptics_data)); if (synaptics_query_hardware(psmouse)) { - printk(KERN_ERR "Unable to query/initialize Synaptics hardware.\n"); + printk(KERN_ERR "Unable to query Synaptics hardware.\n"); + goto init_fail; + } + + if (synaptics_set_mode(psmouse, 0)) { + printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); goto init_fail; } + if (SYN_CAP_EXTENDED(priv->capabilities) && SYN_CAP_PASS_THROUGH(priv->capabilities)) + synaptics_pt_create(psmouse); + print_ident(priv); set_input_params(&psmouse->dev, priv); + psmouse->disconnect = synaptics_disconnect; + psmouse->reconnect = synaptics_reconnect; + return 0; init_fail: @@ -399,20 +452,6 @@ int synaptics_init(struct psmouse *psmou return -1; } -void synaptics_disconnect(struct psmouse *psmouse) -{ - struct synaptics_data *priv = psmouse->private; - - if (psmouse->type == PSMOUSE_SYNAPTICS && priv) { - synaptics_mode_cmd(psmouse, 0); - if (priv->ptport) { - serio_unregister_slave_port(priv->ptport); - kfree(priv->ptport); - } - kfree(priv); - } -} - /***************************************************************************** * Functions to interpret the absolute mode packets ****************************************************************************/ @@ -613,8 +652,9 @@ void synaptics_process_byte(struct psmou printk(KERN_NOTICE "Synaptics driver resynced.\n"); } - if (priv->ptport && synaptics_is_pt_packet(psmouse->packet)) - synaptics_pass_pt_packet(priv->ptport, psmouse->packet); + if (psmouse->ptport && psmouse->ptport->serio.dev && + synaptics_is_pt_packet(psmouse->packet)) + synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet); else synaptics_process_packet(psmouse); @@ -628,6 +668,7 @@ void synaptics_process_byte(struct psmou psmouse->pktcnt = 0; if (psmouse_resetafter > 0 && priv->out_of_sync == psmouse_resetafter) { psmouse->state = PSMOUSE_IGNORE; - serio_rescan(psmouse->serio); + printk(KERN_NOTICE "synaptics: issuing reconnect request\n"); + serio_reconnect(psmouse->serio); } } diff -puN drivers/input/mouse/synaptics.h~synaptics-reconnect drivers/input/mouse/synaptics.h --- linux/drivers/input/mouse/synaptics.h~synaptics-reconnect 2003-09-25 20:19:02.000000000 +0200 +++ linux-petero/drivers/input/mouse/synaptics.h 2003-09-25 20:19:02.000000000 +0200 @@ -12,8 +12,6 @@ extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); extern int synaptics_init(struct psmouse *psmouse); -extern int synaptics_pt_init(struct psmouse *psmouse); -extern void synaptics_disconnect(struct psmouse *psmouse); /* synaptics queries */ #define SYN_QUE_IDENTIFY 0x00 @@ -105,8 +103,6 @@ struct synaptics_data { /* Data for normal processing */ unsigned int out_of_sync; /* # of packets out of sync */ int old_w; /* Previous w value */ - - struct serio *ptport; /* pass-through port */ }; #endif /* _SYNAPTICS_H */ _ ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-25 22:30 ` Vojtech Pavlik 2003-09-26 5:24 ` Peter Osterlund @ 2003-09-26 7:24 ` Dmitry Torokhov 2003-09-26 7:54 ` Vojtech Pavlik 1 sibling, 1 reply; 29+ messages in thread From: Dmitry Torokhov @ 2003-09-26 7:24 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: akpm, petero2, Andries.Brouwer, linux-kernel On Thursday 25 September 2003 05:30 pm, Vojtech Pavlik wrote: > On Thu, Sep 25, 2003 at 01:23:33PM -0500, Dmitry Torokhov wrote: > > - Introducing BTN_TOUCH as far as I can seen does nothing to prevent > > joydev grabbing either Synaptics or touchscreens... Is there a patch > > missing? > > No. It's a statement you're missing near the beginning of > joydev_connect(). > Ok.. I see... and I hate it. We have a mechanism to match input devices to input handler and we violate it. What could be done is adding a black list to the input handler structure similar to the white list we have now. This way all matching conditions will be kept in one place... ...But, unless I am missing something again, with introduction of BTN_TOUCH, tsdev now will happily claim Synaptics touchpads. We could filter it out by checking for example ABS_PRESSURE in tsdev but it would be just a another band aid. I could easily see a touch screen reporting pressure and multiple fingers. As far as capabilities go touchscreens are almost indistinguishable from touch pads, they just operate as true absolute devices. IMHO we should let input device driver explicitly request which input handler it wishes to bind to (for example by passing a bitmap of desired input handlers when registering input device and everyone binds to evdev). It is not as flexible as capabilities checking solution but much more simple and predictable. I do not thing that there will be that many handlers implemented... Should I try to cook something along these lines? > > BTW, any chance on including pass-through patches? Do you want me to > > re-diff them? > > Hmm, I thought I've merged them in already, but obviously I did not. > Please resend them (rediffed if possible). Thanks. I meant reconnect patches that Peter sent in his last mail, sorry for the confusion. Dmitry ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-26 7:24 ` Dmitry Torokhov @ 2003-09-26 7:54 ` Vojtech Pavlik 2003-09-27 1:58 ` Dmitry Torokhov 2003-09-27 20:19 ` Pavel Machek 0 siblings, 2 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-26 7:54 UTC (permalink / raw) To: Dmitry Torokhov Cc: Vojtech Pavlik, akpm, petero2, Andries.Brouwer, linux-kernel On Fri, Sep 26, 2003 at 02:24:53AM -0500, Dmitry Torokhov wrote: > On Thursday 25 September 2003 05:30 pm, Vojtech Pavlik wrote: > > On Thu, Sep 25, 2003 at 01:23:33PM -0500, Dmitry Torokhov wrote: > > > - Introducing BTN_TOUCH as far as I can seen does nothing to prevent > > > joydev grabbing either Synaptics or touchscreens... Is there a patch > > > missing? > > > > No. It's a statement you're missing near the beginning of > > joydev_connect(). > > > > Ok.. I see... and I hate it. We have a mechanism to match input devices to > input handler and we violate it. Well, the mechanism is: check the bit table, if doesn't match, go forward to next handler. Then call the connect function, if it fails, go to next handler. Originally there only was the connect function which was doing all the decisions, but that meant you have to load all the handler modules to check if they will attach to a device. Now the number of modules is limited, because the hotplug agent can check the tables. But still the tables aren't (and will never be) the only way to decide if a handler will attach to a specific device. > What could be done is adding a black list > to the input handler structure similar to the white list we have now. This > way all matching conditions will be kept in one place... > > ...But, unless I am missing something again, with introduction of BTN_TOUCH, > tsdev now will happily claim Synaptics touchpads. We could filter it out > by checking for example ABS_PRESSURE in tsdev but it would be just a another > band aid. I could easily see a touch screen reporting pressure and multiple > fingers. As far as capabilities go touchscreens are almost indistinguishable > from touch pads, they just operate as true absolute devices. You're right. And it's a problem. > IMHO we should let input device driver explicitly request which input > handler it wishes to bind to (for example by passing a bitmap of desired > input handlers when registering input device and everyone binds to evdev). > It is not as flexible as capabilities checking solution but much more > simple and predictable. I do not thing that there will be that many handlers > implemented... No, it won't work. It assumes that all the handlers are known beforehand. Someone may want to load their own input handler module and it wouldn't bind to any device, because it wouldn't be on the list. Also, we need to communicate the information not just to kernel handlers, but also to userspace programs/drivers ... One thing I tried to avoid is a 'device class' kind of field, that'd tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. I tried to avoid it because there are devices that don't fall into any predefined class and if we make enough classes, someone someday will make a device that won't fit again. Adding a device class field and ioctl would solve the touchpad / touchscreen problem nicely. Another option is defining a set of features (events) a touchpad must have and which a touchscreen must have and based on this do the decision on the class. But now I think this is just another bandaid. > Should I try to cook something along these lines? If you do it the device-class way (be it an int or be it a bitmap), I think it's worth trying. > > > BTW, any chance on including pass-through patches? Do you want me to > > > re-diff them? > > > > Hmm, I thought I've merged them in already, but obviously I did not. > > Please resend them (rediffed if possible). Thanks. > > I meant reconnect patches that Peter sent in his last mail, sorry for the > confusion. I don't think I'll apply those, sorry. We really should try to go the driver-model way and not invent our own ways how to restore devices hierarchically. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-26 7:54 ` Vojtech Pavlik @ 2003-09-27 1:58 ` Dmitry Torokhov 2003-09-27 20:19 ` Pavel Machek 1 sibling, 0 replies; 29+ messages in thread From: Dmitry Torokhov @ 2003-09-27 1:58 UTC (permalink / raw) To: Vojtech Pavlik Cc: Vojtech Pavlik, akpm, petero2, Andries.Brouwer, linux-kernel On Friday 26 September 2003 02:54 am, Vojtech Pavlik wrote: > On Fri, Sep 26, 2003 at 02:24:53AM -0500, Dmitry Torokhov wrote: > > On Thursday 25 September 2003 05:30 pm, Vojtech Pavlik wrote: > > > > BTW, any chance on including pass-through patches? Do you want me > > > > to re-diff them? > > > > > > Hmm, I thought I've merged them in already, but obviously I did > > > not. Please resend them (rediffed if possible). Thanks. > > > > I meant reconnect patches that Peter sent in his last mail, sorry for > > the confusion. > > I don't think I'll apply those, sorry. We really should try to go the > driver-model way and not invent our own ways how to restore devices > hierarchically. Reconnect patches are merely an extension of serio_rescan mechanism - the only difference is that reconnect tries to keep the same input device if the hardware didn't change. It does not care about any hierarchy, it just a way for someone to try to re-initialize driver (probably the driver itself). I for example never suspend, but my docking station resets the touch pad back to relative mode. With reconnect it is possible to dock and undock with X and GPM running and it will not screw your input devices (rescan would create brand new input devices while X and GPM still use old ones). The pass-through support of all things implements device hierarchy in non driver-model way and you just included it. The entire input subsystem is not based on the driver model at the moment.. Are there plans to change it in 2.6 timeframe? If not for 2.6 then I would ask you to reconsider, reconnect will make life of users much easier. If you have something in works could I have a peek so I could probably adjust my patches. BTW, is it possible with current driver model to reinitialize an arbitrary device, not entire bus? Dmitry ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-26 7:54 ` Vojtech Pavlik 2003-09-27 1:58 ` Dmitry Torokhov @ 2003-09-27 20:19 ` Pavel Machek 2003-09-27 21:05 ` Vojtech Pavlik 1 sibling, 1 reply; 29+ messages in thread From: Pavel Machek @ 2003-09-27 20:19 UTC (permalink / raw) To: Vojtech Pavlik Cc: Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel Hi! > > IMHO we should let input device driver explicitly request which input > > handler it wishes to bind to (for example by passing a bitmap of desired > > input handlers when registering input device and everyone binds to evdev). > > It is not as flexible as capabilities checking solution but much more > > simple and predictable. I do not thing that there will be that many handlers > > implemented... > > No, it won't work. It assumes that all the handlers are known > beforehand. Someone may want to load their own input handler module and > it wouldn't bind to any device, because it wouldn't be on the list. > > Also, we need to communicate the information not just to kernel > handlers, but also to userspace programs/drivers ... > > One thing I tried to avoid is a 'device class' kind of field, that'd > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > I tried to avoid it because there are devices that don't fall into any > predefined class and if we make enough classes, someone someday will > make a device that won't fit again. I believe having "is overlaid over screen" bit gets it right :-). Pavel -- When do you have a heart between your knees? [Johanka's followup: and *two* hearts?] ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 20:19 ` Pavel Machek @ 2003-09-27 21:05 ` Vojtech Pavlik 2003-09-27 21:09 ` Pavel Machek 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-27 21:05 UTC (permalink / raw) To: Pavel Machek Cc: Vojtech Pavlik, Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel On Sat, Sep 27, 2003 at 10:19:51PM +0200, Pavel Machek wrote: > Hi! > > > > IMHO we should let input device driver explicitly request which input > > > handler it wishes to bind to (for example by passing a bitmap of desired > > > input handlers when registering input device and everyone binds to evdev). > > > It is not as flexible as capabilities checking solution but much more > > > simple and predictable. I do not thing that there will be that many handlers > > > implemented... > > > > No, it won't work. It assumes that all the handlers are known > > beforehand. Someone may want to load their own input handler module and > > it wouldn't bind to any device, because it wouldn't be on the list. > > > > Also, we need to communicate the information not just to kernel > > handlers, but also to userspace programs/drivers ... > > > > One thing I tried to avoid is a 'device class' kind of field, that'd > > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > > I tried to avoid it because there are devices that don't fall into any > > predefined class and if we make enough classes, someone someday will > > make a device that won't fit again. > > I believe having "is overlaid over screen" bit gets it right :-). Tablets aren't. And they're handled the same way as touchscreens. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:05 ` Vojtech Pavlik @ 2003-09-27 21:09 ` Pavel Machek 2003-09-27 21:16 ` Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Pavel Machek @ 2003-09-27 21:09 UTC (permalink / raw) To: Vojtech Pavlik Cc: Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel Hi! > > > One thing I tried to avoid is a 'device class' kind of field, that'd > > > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > > > I tried to avoid it because there are devices that don't fall into any > > > predefined class and if we make enough classes, someone someday will > > > make a device that won't fit again. > > > > I believe having "is overlaid over screen" bit gets it right :-). > > Tablets aren't. And they're handled the same way as touchscreens. Ouch, so what's the difference between tablet and touchpad? Is it only in a way you are expected to use it? In such case "this is touchpad" bit is probably needed :-(. Pavel -- When do you have a heart between your knees? [Johanka's followup: and *two* hearts?] ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:09 ` Pavel Machek @ 2003-09-27 21:16 ` Vojtech Pavlik 2003-09-27 21:18 ` Pavel Machek 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-27 21:16 UTC (permalink / raw) To: Pavel Machek Cc: Vojtech Pavlik, Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel On Sat, Sep 27, 2003 at 11:09:48PM +0200, Pavel Machek wrote: > Hi! > > > > > One thing I tried to avoid is a 'device class' kind of field, that'd > > > > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > > > > I tried to avoid it because there are devices that don't fall into any > > > > predefined class and if we make enough classes, someone someday will > > > > make a device that won't fit again. > > > > > > I believe having "is overlaid over screen" bit gets it right :-). > > > > Tablets aren't. And they're handled the same way as touchscreens. > > Ouch, so what's the difference between tablet and touchpad? Is it only > in a way you are expected to use it? In such case "this is touchpad" > bit is probably needed :-(. For a tablet, the cursor follows the pen movement all the time. For a touchpad, if you lift the finger and place it elsewhere, nothing happens. This way you can move the cursor further by repeatedly stroking the pad. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:16 ` Vojtech Pavlik @ 2003-09-27 21:18 ` Pavel Machek 2003-09-27 21:21 ` Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Pavel Machek @ 2003-09-27 21:18 UTC (permalink / raw) To: Vojtech Pavlik Cc: Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel Hi! > > > > > One thing I tried to avoid is a 'device class' kind of field, that'd > > > > > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > > > > > I tried to avoid it because there are devices that don't fall into any > > > > > predefined class and if we make enough classes, someone someday will > > > > > make a device that won't fit again. > > > > > > > > I believe having "is overlaid over screen" bit gets it right :-). > > > > > > Tablets aren't. And they're handled the same way as touchscreens. > > > > Ouch, so what's the difference between tablet and touchpad? Is it only > > in a way you are expected to use it? In such case "this is touchpad" > > bit is probably needed :-(. > > For a tablet, the cursor follows the pen movement all the time. For a > touchpad, if you lift the finger and place it elsewhere, nothing > happens. This way you can move the cursor further by repeatedly stroking > the pad. But difference is only in software, right? You could use synaptics as a tablet, its just little small. So perhaps "this is touchpad" bit is needed. Pavel -- When do you have a heart between your knees? [Johanka's followup: and *two* hearts?] ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:18 ` Pavel Machek @ 2003-09-27 21:21 ` Vojtech Pavlik 2003-09-27 21:58 ` Matt Gibson 0 siblings, 1 reply; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-27 21:21 UTC (permalink / raw) To: Pavel Machek Cc: Vojtech Pavlik, Dmitry Torokhov, akpm, petero2, Andries.Brouwer, linux-kernel On Sat, Sep 27, 2003 at 11:18:38PM +0200, Pavel Machek wrote: > Hi! > > > > > > > One thing I tried to avoid is a 'device class' kind of field, that'd > > > > > > tell if a device is a mouse a touchpad, touchscreen, tablet, whatever. > > > > > > I tried to avoid it because there are devices that don't fall into any > > > > > > predefined class and if we make enough classes, someone someday will > > > > > > make a device that won't fit again. > > > > > > > > > > I believe having "is overlaid over screen" bit gets it right :-). > > > > > > > > Tablets aren't. And they're handled the same way as touchscreens. > > > > > > Ouch, so what's the difference between tablet and touchpad? Is it only > > > in a way you are expected to use it? In such case "this is touchpad" > > > bit is probably needed :-(. > > > > For a tablet, the cursor follows the pen movement all the time. For a > > touchpad, if you lift the finger and place it elsewhere, nothing > > happens. This way you can move the cursor further by repeatedly stroking > > the pad. > > But difference is only in software, right? You could use synaptics as > a tablet, its just little small. So perhaps "this is touchpad" bit is > needed. Yes, exactly so. We may have similar problems with differentiation elsewhere (touchpad vs 6dof device), so we'll probably need the 'class' field. -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:21 ` Vojtech Pavlik @ 2003-09-27 21:58 ` Matt Gibson 2003-09-28 9:49 ` Vojtech Pavlik 0 siblings, 1 reply; 29+ messages in thread From: Matt Gibson @ 2003-09-27 21:58 UTC (permalink / raw) To: linux-kernel On Saturday 27 Sep 2003 22:21, Vojtech Pavlik wrote: > Yes, exactly so. We may have similar problems with differentiation > elsewhere (touchpad vs 6dof device), so we'll probably need the 'class' > field. I don't know if this is relevant, but there are some devices which can work in either relative (like a touchpad) or absolute (like a touchscreen) mode. For example, using a combination of the kernel and the X drivers, at the moment I have my Wacom tablet working in relative mode when I'm using its mouse, but absolute mode when I'm using its pen. I'm wondering whether we don't so much need a device class, as something to say whether the device works in absolute or relative mode, and that possibly we might have devices where this could be dynamically changed. M -- "It's the small gaps between the rain that count, and learning how to live amongst them." -- Jeff Noon ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev. 2003-09-27 21:58 ` Matt Gibson @ 2003-09-28 9:49 ` Vojtech Pavlik 0 siblings, 0 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-28 9:49 UTC (permalink / raw) To: Matt Gibson; +Cc: linux-kernel On Sat, Sep 27, 2003 at 10:58:05PM +0100, Matt Gibson wrote: > On Saturday 27 Sep 2003 22:21, Vojtech Pavlik wrote: > > Yes, exactly so. We may have similar problems with differentiation > > elsewhere (touchpad vs 6dof device), so we'll probably need the 'class' > > field. > > I don't know if this is relevant, but there are some devices which can work > in either relative (like a touchpad) or absolute (like a touchscreen) mode. > For example, using a combination of the kernel and the X drivers, at the > moment I have my Wacom tablet working in relative mode when I'm using its > mouse, but absolute mode when I'm using its pen. > > I'm wondering whether we don't so much need a device class, as something to > say whether the device works in absolute or relative mode, and that possibly > we might have devices where this could be dynamically changed. That's a pretty neat idea, actually. Thanks! -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes. 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik @ 2003-09-25 22:57 ` Andrew Morton 2003-09-25 23:21 ` Vojtech Pavlik 2003-09-25 23:38 ` Andries Brouwer 2 siblings, 1 reply; 29+ messages in thread From: Andrew Morton @ 2003-09-25 22:57 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: dtor_core, petero2, Andries.Brouwer, linux-kernel Vojtech Pavlik <vojtech@suse.cz> wrote: > > input: Create new KD?BENT ioctls with a bigger key range (int), so that > it's posible to recompile kbdutils on 2.6 and load keymaps for > keys beyond 128. kbdutils compiled on 2.4 will keep working on > 2.6, unfortunately not vice versa, without changing kbdutils. Doesn't compile with older gcc's diff -puN drivers/char/vt_ioctl.c~input-06-extend-entries-fix drivers/char/vt_ioctl.c --- 25/drivers/char/vt_ioctl.c~input-06-extend-entries-fix Thu Sep 25 15:55:42 2003 +++ 25-akpm/drivers/char/vt_ioctl.c Thu Sep 25 15:55:44 2003 @@ -77,7 +77,7 @@ asmlinkage long sys_ioperm(unsigned long static inline int do_kdsk_ioctl(int cmd, void *user_kbe, int perm, struct kbd_struct *kbd) { - struct kbentry tmp, *kbe = user_kbe;; + struct kbentry tmp, *kbe = user_kbe; struct kbentry_old old, *old_kbe = user_kbe; ushort *key_map, val, ov; _ ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes. 2003-09-25 22:57 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Andrew Morton @ 2003-09-25 23:21 ` Vojtech Pavlik 0 siblings, 0 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-25 23:21 UTC (permalink / raw) To: Andrew Morton Cc: Vojtech Pavlik, dtor_core, petero2, Andries.Brouwer, linux-kernel On Thu, Sep 25, 2003 at 03:57:28PM -0700, Andrew Morton wrote: > Vojtech Pavlik <vojtech@suse.cz> wrote: > > > > input: Create new KD?BENT ioctls with a bigger key range (int), so that > > it's posible to recompile kbdutils on 2.6 and load keymaps for > > keys beyond 128. kbdutils compiled on 2.4 will keep working on > > 2.6, unfortunately not vice versa, without changing kbdutils. > > Doesn't compile with older gcc's Thanks, applied. > diff -puN drivers/char/vt_ioctl.c~input-06-extend-entries-fix drivers/char/vt_ioctl.c > --- 25/drivers/char/vt_ioctl.c~input-06-extend-entries-fix Thu Sep 25 15:55:42 2003 > +++ 25-akpm/drivers/char/vt_ioctl.c Thu Sep 25 15:55:44 2003 > @@ -77,7 +77,7 @@ asmlinkage long sys_ioperm(unsigned long > static inline int > do_kdsk_ioctl(int cmd, void *user_kbe, int perm, struct kbd_struct *kbd) > { > - struct kbentry tmp, *kbe = user_kbe;; > + struct kbentry tmp, *kbe = user_kbe; > struct kbentry_old old, *old_kbe = user_kbe; > ushort *key_map, val, ov; > > > _ > -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes. 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik 2003-09-25 22:57 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Andrew Morton @ 2003-09-25 23:38 ` Andries Brouwer 2003-09-26 6:20 ` Vojtech Pavlik 2 siblings, 1 reply; 29+ messages in thread From: Andries Brouwer @ 2003-09-25 23:38 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel On Thu, Sep 25, 2003 at 06:50:12PM +0200, Vojtech Pavlik wrote: > -struct kbentry { > +struct kbentry_old { > unsigned char kb_table; > unsigned char kb_index; > unsigned short kb_value; > }; > +#define KDGKBENT_OLD 0x4B46 /* gets one entry in translation table (old) */ > +#define KDSKBENT_OLD 0x4B47 /* sets one entry in translation table (old) */ > + > +struct kbentry { > + unsigned int kb_table; > + unsigned int kb_index; > + unsigned short kb_value; > +}; > -#define KDGKBENT 0x4B46 /* gets one entry in translation table */ > -#define KDSKBENT 0x4B47 /* sets one entry in translation table */ > +#define KDGKBENT 0x4B73 /* gets one entry in translation table */ > +#define KDSKBENT 0x4B74 /* sets one entry in translation table */ Please don't. As said already, no new ioctls are needed today, but if you add some anyway, please leave old names unchanged and add something new, like KDSKBENT32 or so. Reusing old ioctl names for new uses is very bad practice. Andries ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes. 2003-09-25 23:38 ` Andries Brouwer @ 2003-09-26 6:20 ` Vojtech Pavlik 0 siblings, 0 replies; 29+ messages in thread From: Vojtech Pavlik @ 2003-09-26 6:20 UTC (permalink / raw) To: Andries Brouwer Cc: Vojtech Pavlik, akpm, dtor_core, petero2, Andries.Brouwer, linux-kernel On Fri, Sep 26, 2003 at 01:38:37AM +0200, Andries Brouwer wrote: > On Thu, Sep 25, 2003 at 06:50:12PM +0200, Vojtech Pavlik wrote: > > > -struct kbentry { > > +struct kbentry_old { > > unsigned char kb_table; > > unsigned char kb_index; > > unsigned short kb_value; > > }; > > +#define KDGKBENT_OLD 0x4B46 /* gets one entry in translation table (old) */ > > +#define KDSKBENT_OLD 0x4B47 /* sets one entry in translation table (old) */ > > + > > +struct kbentry { > > + unsigned int kb_table; > > + unsigned int kb_index; > > + unsigned short kb_value; > > +}; > > > -#define KDGKBENT 0x4B46 /* gets one entry in translation table */ > > -#define KDSKBENT 0x4B47 /* sets one entry in translation table */ > > +#define KDGKBENT 0x4B73 /* gets one entry in translation table */ > > +#define KDSKBENT 0x4B74 /* sets one entry in translation table */ > > Please don't. > > As said already, no new ioctls are needed today, Well, as already said, there are two ways to go: 1) Keep NR_KEYS at 512 (or more in the future, iff needed), and have new ioctls. 2) Decrease NR_KEYS to 256 or better 255 or 254, so that for() cycles don't break because of limited range of the iterator, and optimize the KEY_* macros in input.h to fit in that range. This however means moving some already #defined macros to other values, which hopefully is not too big a problem, as few are using it. And it's likely we overflow the 254 entries soon, nevertheless, so we will need the new ioctls anyway. > but if you add some anyway, please leave old names unchanged and add > something new, like KDSKBENT32 or so. > > Reusing old ioctl names for new uses is very bad practice. Ok, I'm willing to give approach #2 a chance. But I'll need help from you - as you have the most extensive list of extended keyboards - would you please help me by creating a list of most used (and most standard) keys on those keyboards and scancodes (unxlated set2) associated with those? I'd then add what USB and Sun and others use and this way we should be able to trim down the amount of defined keys down a bit. I'm postponing the KD?KBENT patch for the moment ... -- Vojtech Pavlik SuSE Labs, SuSE CR ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 5/8] Rely less on sanity of AT keyboards. 2003-09-25 16:50 ` [PATCH 5/8] Rely less on sanity of AT keyboards Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik @ 2003-10-05 15:12 ` Martin Josefsson 1 sibling, 0 replies; 29+ messages in thread From: Martin Josefsson @ 2003-10-05 15:12 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: linux-kernel On Thu, 2003-09-25 at 18:50, Vojtech Pavlik wrote: > diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c > --- a/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:20 2003 > +++ b/drivers/input/mouse/psmouse-base.c Thu Sep 25 18:37:20 2003 > @@ -28,6 +28,8 @@ > MODULE_PARM_DESC(psmouse_noext, "Disable any protocol extensions. Useful for KVM switches."); > MODULE_PARM(psmouse_resolution, "i"); > MODULE_PARM_DESC(psmouse_resolution, "Resolution, in dpi."); > +MODULE_PARM(psmouse_rate, "i"); > +MODULE_PARM_DESC(psmouse_rate, "Report rate, in reports per second."); > MODULE_PARM(psmouse_smartscroll, "i"); > MODULE_PARM_DESC(psmouse_smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled."); > MODULE_PARM(psmouse_resetafter, "i"); > @@ -38,6 +40,7 @@ > > static int psmouse_noext; > int psmouse_resolution; > +unsigned int psmouse_rate = 60; Please change this back to 200. Mousebehaviour is _really_ horrible with 60. There's currently no way to change it for kernels with this driver compiled in. Here's a patch to change it back to 200 and readd the fallback to a lower rate if the requested failed to be set. --- linux-2.6.0-test6-mm4/drivers/input/mouse/psmouse-base.c.orig 2003-10-05 17:02:23.000000000 +0200 +++ linux-2.6.0-test6-mm4/drivers/input/mouse/psmouse-base.c 2003-10-05 17:06:55.000000000 +0200 @@ -40,7 +40,7 @@ static int psmouse_noext; int psmouse_resolution; -unsigned int psmouse_rate = 60; +unsigned int psmouse_rate = 200; int psmouse_smartscroll = PSMOUSE_LOGITECH_SMARTSCROLL; unsigned int psmouse_resetafter; @@ -450,6 +450,11 @@ int i = 0; while (rates[i] > psmouse_rate) i++; + + /* set lower rate in case requested rate fails */ + if (rates[i]) + psmouse_command(psmouse, rates + i + 1, PSMOUSE_CMD_SETRATE); + psmouse_command(psmouse, rates + i, PSMOUSE_CMD_SETRATE); } -- /Martin ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: My current patches 2003-09-25 16:48 My current patches Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 1/8] Revert synaptics->pktcnt change Vojtech Pavlik @ 2003-09-25 18:13 ` Peter Osterlund 1 sibling, 0 replies; 29+ messages in thread From: Peter Osterlund @ 2003-09-25 18:13 UTC (permalink / raw) To: Vojtech Pavlik; +Cc: akpm, dtor_core, Andries.Brouwer, linux-kernel Vojtech Pavlik <vojtech@suse.cz> writes: > I'm sending you my current set of patches for review and testing. > Please forward to whoever can test them. If no problems are found, I'll > be sending them to Linus for inclusion in 2.6 tomorrow or so. I tried this patch set on my Clevo laptop and the touchpad is working fine. The patch set also fixes keyboard problems that I started seeing a few days ago. (Very slow auto repeat and randomly stuck CTRL key.) -- Peter Osterlund - petero2@telia.com http://w1.894.telia.com/~u89404340 ^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2003-10-05 15:12 UTC | newest] Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-09-25 16:48 My current patches Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 1/8] Revert synaptics->pktcnt change Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 2/8] Fix multibutton handling in synaptics.c Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 3/8] Synaptics code cleanups Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 4/8] Add touchpad support to mousedev.c Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 5/8] Rely less on sanity of AT keyboards Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 7/8] Fix handling of rotated Synaptics touchpads Vojtech Pavlik 2003-09-25 16:50 ` [PATCH 8/8] Add BTN_TOUCH to Synaptics driver. Update mousedev Vojtech Pavlik 2003-09-25 18:23 ` Dmitry Torokhov 2003-09-25 22:30 ` Vojtech Pavlik 2003-09-26 5:24 ` Peter Osterlund 2003-09-26 7:24 ` Dmitry Torokhov 2003-09-26 7:54 ` Vojtech Pavlik 2003-09-27 1:58 ` Dmitry Torokhov 2003-09-27 20:19 ` Pavel Machek 2003-09-27 21:05 ` Vojtech Pavlik 2003-09-27 21:09 ` Pavel Machek 2003-09-27 21:16 ` Vojtech Pavlik 2003-09-27 21:18 ` Pavel Machek 2003-09-27 21:21 ` Vojtech Pavlik 2003-09-27 21:58 ` Matt Gibson 2003-09-28 9:49 ` Vojtech Pavlik 2003-09-25 22:57 ` [PATCH 6/8] Extend KD?BENT to handle > 256 keycodes Andrew Morton 2003-09-25 23:21 ` Vojtech Pavlik 2003-09-25 23:38 ` Andries Brouwer 2003-09-26 6:20 ` Vojtech Pavlik 2003-10-05 15:12 ` [PATCH 5/8] Rely less on sanity of AT keyboards Martin Josefsson 2003-09-25 18:13 ` My current patches Peter Osterlund
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).