* [PATCH 0/8] New set of input patches
@ 2004-07-08 6:55 Dmitry Torokhov
2004-07-08 6:55 ` [PATCH 1/8] " Dmitry Torokhov
2004-07-08 20:32 ` [PATCH 0/8] New set of input patches Pavel Machek
0 siblings, 2 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:55 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
Hi Vojtech,
Here is the new set of input patches - stuff that does not depend on the
driver core changes that I have sent to Greg earlier. Please let me know
which ones you like and I'll move them to bkbits. The patches are against
tonight pull from your tree.
01-drivers-makefile.patch
- move input/serio closer to the top of drivers/Makefile so
serio_bus structure initialized early and is ready by the time
sunzilog and sunsu register their serio ports.
02-sunzilog-serio-register.patch
- Do not attempt to register serio ports while holding a spinlock
and with interrupts off. Fully initialize hardware first and
only then register. Cures lockup reported by WLI.
03-i8042-broken-mux-workaround.patch
- Some MUXes get confused what AUX port the byte came from. Assume
that is came from the same port previous byte came from if it
arrived within HZ/10
04-serio-pause-rx.patch
- Add serio_pause_rx and serio_continue_rx that take serio->lock and
can be used by drivers to protect their critical sections from
interrupt handler.
05-psmouse-set-state.patch
- Use serio_pause_rx/serio_continue_rx when changing psmosuee state
(active, ignore)
06-psmouse-initializing.patch
- Add a new state PSMOUSE_INITIALIZING and do not try to call protocol
handler for mice in this state. Shoudl help with OOPS caused by USB
Legacy emulation generating wierd data stream when probing for mouse
07-synaptics-passthrough-handling.patch
- If data looks like a pass-through packet and tuchpad has pass-
through capability do not pass it to the main handler if child port
is disconnected. Let serio core sort it out and bind a proper driver
to the port
08-psmouse-reconnect.patch
- Instead of wierd ruke that connect shoudl not activate mouse if
there is a pass-through port and have child do activation do the
following:
1. Connect/reconnect always activate port in question
2. If port is a pass-through port connect/reconnect will
deactivate parent at the beginning of the probe and will
activate it after everything is done.
This allows reliably reconnect children ports in response to user
request (echo -n "reconnect" > /sys/bus...)
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/8] New set of input patches
2004-07-08 6:55 [PATCH 0/8] New set of input patches Dmitry Torokhov
@ 2004-07-08 6:55 ` Dmitry Torokhov
2004-07-08 6:56 ` [PATCH 2/8] " Dmitry Torokhov
2004-07-12 3:17 ` synaptics driver Ari Pollak
2004-07-08 20:32 ` [PATCH 0/8] New set of input patches Pavel Machek
1 sibling, 2 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:55 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1820, 2004-07-08 00:21:54-05:00, dtor_core@ameritech.net
Input: move input/serio closer to the top of drivers/Makefile so
serio_bus is available early
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Makefile | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
===================================================================
diff -Nru a/drivers/Makefile b/drivers/Makefile
--- a/drivers/Makefile 2004-07-08 01:34:45 -05:00
+++ b/drivers/Makefile 2004-07-08 01:34:45 -05:00
@@ -15,6 +15,9 @@
# char/ comes before serial/ etc so that the VT console is the boot-time
# default.
obj-y += char/
+# we also need input/serio early so serio bus is initialized by the time
+# serial drivers start registering their serio ports
+obj-$(CONFIG_SERIO) += input/serio/
obj-y += serial/
obj-$(CONFIG_PARPORT) += parport/
obj-y += base/ block/ misc/ net/ media/
@@ -37,7 +40,6 @@
obj-$(CONFIG_TC) += tc/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_USB_GADGET) += usb/gadget/
-obj-$(CONFIG_SERIO) += input/serio/
obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_I2O) += message/
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/8] New set of input patches
2004-07-08 6:55 ` [PATCH 1/8] " Dmitry Torokhov
@ 2004-07-08 6:56 ` Dmitry Torokhov
2004-07-08 6:56 ` [PATCH 3/8] " Dmitry Torokhov
2004-07-12 3:17 ` synaptics driver Ari Pollak
1 sibling, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:56 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1821, 2004-07-08 00:23:10-05:00, dtor_core@ameritech.net
Input: rearrange code in sunzilog so it registers its serio ports
only after hardware was fully initialized and with interrupts
tuned back on, otherwise it deadlocks.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
sunzilog.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
===================================================================
diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
--- a/drivers/serial/sunzilog.c 2004-07-08 01:34:54 -05:00
+++ b/drivers/serial/sunzilog.c 2004-07-08 01:34:54 -05:00
@@ -1529,7 +1529,6 @@
static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel)
{
int baud, brg;
- struct serio *serio;
if (channel == KEYBOARD_LINE) {
up->flags |= SUNZILOG_FLAG_CONS_KEYB;
@@ -1546,8 +1545,15 @@
up->curregs[R15] = BRKIE;
brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
sunzilog_convert_to_zs(up, up->cflag, 0, brg);
+ sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS);
+ __sunzilog_startup(up);
+}
#ifdef CONFIG_SERIO
+static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int channel)
+{
+ struct serio *serio;
+
up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
if (serio) {
@@ -1576,11 +1582,8 @@
printk(KERN_WARNING "zs%d: not enough memory for serio port\n",
channel);
}
-#endif
-
- sunzilog_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS);
- __sunzilog_startup(up);
}
+#endif
static void __init sunzilog_init_hw(void)
{
@@ -1624,6 +1627,11 @@
}
spin_unlock_irqrestore(&up->port.lock, flags);
+
+#ifdef CONFIG_SERIO
+ if (i == KEYBOARD_LINE || i == MOUSE_LINE)
+ sunzilog_register_serio(up, i);
+#endif
}
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/8] New set of input patches
2004-07-08 6:56 ` [PATCH 2/8] " Dmitry Torokhov
@ 2004-07-08 6:56 ` Dmitry Torokhov
2004-07-08 6:57 ` [PATCH 4/8] " Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:56 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1822, 2004-07-08 00:23:44-05:00, dtor_core@ameritech.net
Input: workaround for i8042 active multiplexing controllers losing
track of where data is coming from. Also sprinkled some
"likely"s in i8042 interrupt handler.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
i8042.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 42 insertions(+), 18 deletions(-)
===================================================================
diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c 2004-07-08 01:35:04 -05:00
+++ b/drivers/input/serio/i8042.c 2004-07-08 01:35:04 -05:00
@@ -362,6 +362,7 @@
unsigned long flags;
unsigned char str, data = 0;
unsigned int dfl;
+ unsigned int aux_idx;
int ret;
mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
@@ -378,44 +379,67 @@
goto out;
}
- dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) |
- ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0);
-
- if (i8042_mux_values[0].exists && (str & I8042_STR_AUXDATA)) {
+ if (i8042_mux_present && (str & I8042_STR_AUXDATA)) {
+ static unsigned long last_transmit;
+ static unsigned char last_str;
+ dfl = 0;
if (str & I8042_STR_MUXERR) {
+ dbg("MUX error, status is %02x, data is %02x", str, data);
switch (data) {
+ default:
+/*
+ * When MUXERR condition is signalled the data register can only contain
+ * 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately
+ * it is not always the case. Some KBC just get confused which port the
+ * data came from and signal error leaving the data intact. They _do not_
+ * revert to legacy mode (actually I've never seen KBC reverting to legacy
+ * mode yet, when we see one we'll add proper handling).
+ * Anyway, we will assume that the data came from the same serio last byte
+ * was transmitted (if transmission happened not too long ago).
+ */
+ if (time_before(jiffies, last_transmit + HZ/10)) {
+ str = last_str;
+ break;
+ }
+ /* fall through - report timeout */
case 0xfd:
- case 0xfe: dfl = SERIO_TIMEOUT; break;
- case 0xff: dfl = SERIO_PARITY; break;
+ case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break;
+ case 0xff: dfl = SERIO_PARITY; data = 0xfe; break;
}
- data = 0xfe;
- } else dfl = 0;
+ }
+
+ aux_idx = (str >> 6) & 3;
dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)",
- data, (str >> 6), irq,
+ data, aux_idx, irq,
dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : "");
- serio_interrupt(i8042_mux_port[(str >> 6) & 3], data, dfl, regs);
+ if (likely(i8042_mux_values[aux_idx].exists))
+ serio_interrupt(i8042_mux_port[aux_idx], data, dfl, regs);
+ last_str = str;
+ last_transmit = jiffies;
goto irq_ret;
}
+ dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) |
+ ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0);
+
dbg("%02x <- i8042 (interrupt, %s, %d%s%s)",
data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq,
dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : "");
- if (i8042_aux_values.exists && (str & I8042_STR_AUXDATA)) {
- serio_interrupt(i8042_aux_port, data, dfl, regs);
- goto irq_ret;
- }
-
- if (!i8042_kbd_values.exists)
- goto irq_ret;
- serio_interrupt(i8042_kbd_port, data, dfl, regs);
+ if (str & I8042_STR_AUXDATA) {
+ if (likely(i8042_aux_values.exists))
+ serio_interrupt(i8042_aux_port, data, dfl, regs);
+ } else {
+ if (likely(i8042_kbd_values.exists))
+ serio_interrupt(i8042_kbd_port, data, dfl, regs);
+ }
irq_ret:
ret = 1;
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/8] New set of input patches
2004-07-08 6:56 ` [PATCH 3/8] " Dmitry Torokhov
@ 2004-07-08 6:57 ` Dmitry Torokhov
2004-07-08 6:57 ` [PATCH 5/8] " Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:57 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1823, 2004-07-08 00:24:20-05:00, dtor_core@ameritech.net
Input: add serio_pause_rx and serio_continue_rx so drivers can protect
their critical sections from port's interrupt handler
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/serio/serio.c | 18 ++++++++----------
include/linux/serio.h | 21 +++++++++++++++++++--
2 files changed, 27 insertions(+), 12 deletions(-)
===================================================================
diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c 2004-07-08 01:35:14 -05:00
+++ b/drivers/input/serio/serio.c 2004-07-08 01:35:14 -05:00
@@ -541,15 +541,14 @@
/* called from serio_driver->connect/disconnect methods under serio_sem */
int serio_open(struct serio *serio, struct serio_driver *drv)
{
- unsigned long flags;
-
- spin_lock_irqsave(&serio->lock, flags);
+ serio_pause_rx(serio);
serio->drv = drv;
- spin_unlock_irqrestore(&serio->lock, flags);
+ serio_continue_rx(serio);
+
if (serio->open && serio->open(serio)) {
- spin_lock_irqsave(&serio->lock, flags);
+ serio_pause_rx(serio);
serio->drv = NULL;
- spin_unlock_irqrestore(&serio->lock, flags);
+ serio_continue_rx(serio);
return -1;
}
return 0;
@@ -558,13 +557,12 @@
/* called from serio_driver->connect/disconnect methods under serio_sem */
void serio_close(struct serio *serio)
{
- unsigned long flags;
-
if (serio->close)
serio->close(serio);
- spin_lock_irqsave(&serio->lock, flags);
+
+ serio_pause_rx(serio);
serio->drv = NULL;
- spin_unlock_irqrestore(&serio->lock, flags);
+ serio_continue_rx(serio);
}
irqreturn_t serio_interrupt(struct serio *serio,
diff -Nru a/include/linux/serio.h b/include/linux/serio.h
--- a/include/linux/serio.h 2004-07-08 01:35:14 -05:00
+++ b/include/linux/serio.h 2004-07-08 01:35:14 -05:00
@@ -35,7 +35,7 @@
unsigned long type;
unsigned long event;
- spinlock_t lock;
+ spinlock_t lock; /* protects critical sections from port's interrupt handler */
int (*write)(struct serio *, unsigned char);
int (*open)(struct serio *);
@@ -43,7 +43,7 @@
struct serio *parent, *child;
- struct serio_driver *drv; /* Accessed from interrupt, writes must be protected by serio_lock */
+ struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock */
struct device dev;
@@ -81,6 +81,7 @@
void serio_register_port_delayed(struct serio *serio);
void serio_unregister_port(struct serio *serio);
void serio_unregister_port_delayed(struct serio *serio);
+
void serio_register_driver(struct serio_driver *drv);
void serio_unregister_driver(struct serio_driver *drv);
@@ -103,6 +104,22 @@
if (serio->drv && serio->drv->cleanup)
serio->drv->cleanup(serio);
}
+
+
+/*
+ * Use the following fucntions to protect critical sections in
+ * driver code from port's interrupt handler
+ */
+static __inline__ void serio_pause_rx(struct serio *serio)
+{
+ spin_lock_irq(&serio->lock);
+}
+
+static __inline__ void serio_continue_rx(struct serio *serio)
+{
+ spin_unlock_irq(&serio->lock);
+}
+
#endif
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 5/8] New set of input patches
2004-07-08 6:57 ` [PATCH 4/8] " Dmitry Torokhov
@ 2004-07-08 6:57 ` Dmitry Torokhov
2004-07-08 6:58 ` [PATCH 6/8] " Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:57 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1824, 2004-07-08 00:25:13-05:00, dtor_core@ameritech.net
Input: when changing psmouse state (activated, ignore) use srio_pause_rx/
serio_continue_rx so it will not fight with the interrupt handler
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
psmouse-base.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:23 -05:00
+++ b/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:23 -05:00
@@ -308,7 +308,7 @@
while (test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags) && timeout--) {
if (!test_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags)) {
-
+
if (command == PSMOUSE_CMD_RESET_BAT && timeout > 100000)
timeout = 100000;
@@ -626,6 +626,21 @@
}
/*
+ * psmouse_set_state() sets new psmouse state and resets all flags and
+ * counters while holding serio lock so fighting with interrupt handler
+ * is not a concern.
+ */
+
+static void psmouse_set_state(struct psmouse *psmouse, unsigned char new_state)
+{
+ serio_pause_rx(psmouse->serio);
+ psmouse->state = new_state;
+ psmouse->pktcnt = psmouse->cmdcnt = psmouse->out_of_sync = 0;
+ psmouse->flags = 0;
+ serio_continue_rx(psmouse->serio);
+}
+
+/*
* psmouse_activate() enables the mouse so that we get motion reports from it.
*/
@@ -634,7 +649,7 @@
if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE))
printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->serio->phys);
- psmouse->state = PSMOUSE_ACTIVATED;
+ psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
}
/*
@@ -657,7 +672,7 @@
struct psmouse *psmouse, *parent;
psmouse = serio->private;
- psmouse->state = PSMOUSE_CMD_MODE;
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) {
parent = serio->parent->private;
@@ -668,7 +683,7 @@
if (psmouse->disconnect)
psmouse->disconnect(psmouse);
- psmouse->state = PSMOUSE_IGNORE;
+ psmouse_set_state(psmouse, PSMOUSE_IGNORE);
input_unregister_device(&psmouse->dev);
serio_close(serio);
@@ -699,9 +714,9 @@
psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
- psmouse->state = PSMOUSE_CMD_MODE;
psmouse->serio = serio;
psmouse->dev.private = psmouse;
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
serio->private = psmouse;
if (serio_open(serio, drv)) {
@@ -780,12 +795,7 @@
return -1;
}
- psmouse->state = PSMOUSE_CMD_MODE;
-
- clear_bit(PSMOUSE_FLAG_ACK, &psmouse->flags);
- clear_bit(PSMOUSE_FLAG_CMD, &psmouse->flags);
-
- psmouse->pktcnt = psmouse->out_of_sync = 0;
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
if (psmouse->reconnect) {
if (psmouse->reconnect(psmouse))
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6/8] New set of input patches
2004-07-08 6:57 ` [PATCH 5/8] " Dmitry Torokhov
@ 2004-07-08 6:58 ` Dmitry Torokhov
2004-07-08 6:58 ` [PATCH 7/8] " Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:58 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1825, 2004-07-08 00:26:24-05:00, dtor_core@ameritech.net
Input: do not call protocol handler in psmouse unless mouse is
filly initialized - helps when USB Legacy emulation gets
in our way and starts generating junk data stream while
psmouse is detecting hardware
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
psmouse-base.c | 13 ++++++++++---
psmouse.h | 14 ++++++++------
2 files changed, 18 insertions(+), 9 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:32 -05:00
+++ b/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:32 -05:00
@@ -186,6 +186,9 @@
goto out;
}
+ if (psmouse->state == PSMOUSE_INITIALIZING)
+ goto out;
+
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",
@@ -631,7 +634,7 @@
* is not a concern.
*/
-static void psmouse_set_state(struct psmouse *psmouse, unsigned char new_state)
+static void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
{
serio_pause_rx(psmouse->serio);
psmouse->state = new_state;
@@ -716,7 +719,7 @@
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
psmouse->serio = serio;
psmouse->dev.private = psmouse;
- psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
serio->private = psmouse;
if (serio_open(serio, drv)) {
@@ -756,6 +759,8 @@
printk(KERN_INFO "input: %s on %s\n", psmouse->devname, serio->phys);
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+
psmouse_initialize(psmouse);
if (parent && parent->pt_activate)
@@ -795,7 +800,7 @@
return -1;
}
- psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+ psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
if (psmouse->reconnect) {
if (psmouse->reconnect(psmouse))
@@ -807,6 +812,8 @@
/* ok, the device type (and capabilities) match the old one,
* we can continue using it, complete intialization
*/
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+
psmouse_initialize(psmouse);
if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU)
diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
--- a/drivers/input/mouse/psmouse.h 2004-07-08 01:35:32 -05:00
+++ b/drivers/input/mouse/psmouse.h 2004-07-08 01:35:32 -05:00
@@ -17,16 +17,18 @@
#define PSMOUSE_RET_ACK 0xfa
#define PSMOUSE_RET_NAK 0xfe
-/* psmouse states */
-#define PSMOUSE_CMD_MODE 0
-#define PSMOUSE_ACTIVATED 1
-#define PSMOUSE_IGNORE 2
-
#define PSMOUSE_FLAG_ACK 0 /* Waiting for ACK/NAK */
#define PSMOUSE_FLAG_CMD 1 /* Waiting for command to finish */
#define PSMOUSE_FLAG_CMD1 2 /* First byte of command response */
#define PSMOUSE_FLAG_ID 3 /* First byte is not keyboard ID */
+enum psmouse_state {
+ PSMOUSE_IGNORE,
+ PSMOUSE_INITIALIZING,
+ PSMOUSE_CMD_MODE,
+ PSMOUSE_ACTIVATED,
+};
+
/* psmouse protocol handler return codes */
typedef enum {
PSMOUSE_BAD_DATA,
@@ -48,7 +50,7 @@
unsigned char model;
unsigned long last;
unsigned long out_of_sync;
- unsigned char state;
+ enum psmouse_state state;
unsigned char nak;
char error;
char devname[64];
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 7/8] New set of input patches
2004-07-08 6:58 ` [PATCH 6/8] " Dmitry Torokhov
@ 2004-07-08 6:58 ` Dmitry Torokhov
2004-07-08 6:59 ` [PATCH 8/8] " Dmitry Torokhov
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:58 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1826, 2004-07-08 01:28:44-05:00, dtor_core@ameritech.net
Input: synaptics - do not try to process packets from slave device
as if they were coming form the touchpad itself if pass-through
port is disconnected, just pass them to serio core and it will
attempt to bind proper driver to the port
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
synaptics.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
--- a/drivers/input/mouse/synaptics.c 2004-07-08 01:35:41 -05:00
+++ b/drivers/input/mouse/synaptics.c 2004-07-08 01:35:41 -05:00
@@ -233,17 +233,14 @@
{
struct psmouse *child = ptport->private;
- if (child) {
- if (child->state == PSMOUSE_ACTIVATED) {
- serio_interrupt(ptport, packet[1], 0, NULL);
- serio_interrupt(ptport, packet[4], 0, NULL);
- serio_interrupt(ptport, packet[5], 0, NULL);
- if (child->type >= PSMOUSE_GENPS)
- serio_interrupt(ptport, packet[2], 0, NULL);
- } else if (child->state != PSMOUSE_IGNORE) {
- serio_interrupt(ptport, packet[1], 0, NULL);
- }
- }
+ if (child && child->state == PSMOUSE_ACTIVATED) {
+ serio_interrupt(ptport, packet[1], 0, NULL);
+ serio_interrupt(ptport, packet[4], 0, NULL);
+ serio_interrupt(ptport, packet[5], 0, NULL);
+ if (child->type >= PSMOUSE_GENPS)
+ serio_interrupt(ptport, packet[2], 0, NULL);
+ } else
+ serio_interrupt(ptport, packet[1], 0, NULL);
}
static void synaptics_pt_activate(struct psmouse *psmouse)
@@ -472,9 +469,10 @@
if (unlikely(priv->pkt_type == SYN_NEWABS))
priv->pkt_type = synaptics_detect_pkt_type(psmouse);
- if (psmouse->serio->child && psmouse->serio->child->drv && synaptics_is_pt_packet(psmouse->packet))
- synaptics_pass_pt_packet(psmouse->serio->child, psmouse->packet);
- else
+ if (SYN_CAP_PASS_THROUGH(priv->capabilities) && synaptics_is_pt_packet(psmouse->packet)) {
+ if (psmouse->serio->child)
+ synaptics_pass_pt_packet(psmouse->serio->child, psmouse->packet);
+ } else
synaptics_process_packet(psmouse);
return PSMOUSE_FULL_PACKET;
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 8/8] New set of input patches
2004-07-08 6:58 ` [PATCH 7/8] " Dmitry Torokhov
@ 2004-07-08 6:59 ` Dmitry Torokhov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-08 6:59 UTC (permalink / raw)
To: Vojtech Pavlik; +Cc: LKML
===================================================================
ChangeSet@1.1827, 2004-07-08 01:29:31-05:00, dtor_core@ameritech.net
Input: rearrange activation/children probe sequence in psmouse so
reconnect on children ports works even after parent port is
fully activated:
- when connecting/reconnecting a port always activate it
- when connecting/reconnecting a pass-throgh port deactivate
parent first and activate it after connect is done
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
psmouse-base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
psmouse.h | 1 +
2 files changed, 38 insertions(+), 18 deletions(-)
===================================================================
diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:50 -05:00
+++ b/drivers/input/mouse/psmouse-base.c 2004-07-08 01:35:50 -05:00
@@ -655,6 +655,21 @@
psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
}
+
+/*
+ * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion
+ * reports from it unless we explicitely request it.
+ */
+
+static void psmouse_deactivate(struct psmouse *psmouse)
+{
+ if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_DISABLE))
+ printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n", psmouse->serio->phys);
+
+ psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+}
+
+
/*
* psmouse_cleanup() resets the mouse into power-on state.
*/
@@ -705,8 +720,14 @@
(serio->type & SERIO_TYPE) != SERIO_PS_PSTHRU)
return;
- if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU)
+ /*
+ * If this is a pass-through port deactivate parent so the device
+ * connected to this port can be successfully identified
+ */
+ if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) {
parent = serio->parent->private;
+ psmouse_deactivate(parent);
+ }
if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL)))
goto out;
@@ -766,21 +787,15 @@
if (parent && parent->pt_activate)
parent->pt_activate(parent);
- /*
- * OK, the device is ready, we just need to activate it (turn the
- * stream mode on). But if mouse has a pass-through port we don't
- * want to do it yet to not disturb child detection.
- * The child will activate this port when it's ready.
- */
-
if (serio->child) {
/*
* Nothing to be done here, serio core will detect that
* the driver set serio->child and will register it for us.
*/
printk(KERN_INFO "serio: %s port at %s\n", serio->child->name, psmouse->phys);
- } else
- psmouse_activate(psmouse);
+ }
+
+ psmouse_activate(psmouse);
out:
/* If this is a pass-through port the parent awaits to be activated */
@@ -794,20 +809,26 @@
struct psmouse *psmouse = serio->private;
struct psmouse *parent = NULL;
struct serio_driver *drv = serio->drv;
+ int rc = -1;
if (!drv || !psmouse) {
printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n");
return -1;
}
+ if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) {
+ parent = serio->parent->private;
+ psmouse_deactivate(parent);
+ }
+
psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
if (psmouse->reconnect) {
if (psmouse->reconnect(psmouse))
- return -1;
+ goto out;
} else if (psmouse_probe(psmouse) < 0 ||
psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0))
- return -1;
+ goto out;
/* ok, the device type (and capabilities) match the old one,
* we can continue using it, complete intialization
@@ -816,20 +837,18 @@
psmouse_initialize(psmouse);
- if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU)
- parent = serio->parent->private;
-
if (parent && parent->pt_activate)
parent->pt_activate(parent);
- if (!serio->child)
- psmouse_activate(psmouse);
+ psmouse_activate(psmouse);
+ rc = 0;
+out:
/* If this is a pass-through port the parent waits to be activated */
if (parent)
psmouse_activate(parent);
- return 0;
+ return rc;
}
diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
--- a/drivers/input/mouse/psmouse.h 2004-07-08 01:35:50 -05:00
+++ b/drivers/input/mouse/psmouse.h 2004-07-08 01:35:50 -05:00
@@ -9,6 +9,7 @@
#define PSMOUSE_CMD_GETID 0x02f2
#define PSMOUSE_CMD_SETRATE 0x10f3
#define PSMOUSE_CMD_ENABLE 0x00f4
+#define PSMOUSE_CMD_DISABLE 0x00f5
#define PSMOUSE_CMD_RESET_DIS 0x00f6
#define PSMOUSE_CMD_RESET_BAT 0x02ff
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] New set of input patches
2004-07-08 6:55 [PATCH 0/8] New set of input patches Dmitry Torokhov
2004-07-08 6:55 ` [PATCH 1/8] " Dmitry Torokhov
@ 2004-07-08 20:32 ` Pavel Machek
2004-07-09 3:48 ` Dmitry Torokhov
1 sibling, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2004-07-08 20:32 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Vojtech Pavlik, LKML
Hi!
> 03-i8042-broken-mux-workaround.patch
> - Some MUXes get confused what AUX port the byte came from. Assume
> that is came from the same port previous byte came from if it
> arrived within HZ/10
Does that mean that (even if my hw is ok) when I two mice at once
I get random movements?
--
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] New set of input patches
2004-07-08 20:32 ` [PATCH 0/8] New set of input patches Pavel Machek
@ 2004-07-09 3:48 ` Dmitry Torokhov
2004-07-09 5:06 ` Pavel Machek
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-09 3:48 UTC (permalink / raw)
To: Pavel Machek; +Cc: Vojtech Pavlik, LKML
On Thursday 08 July 2004 03:32 pm, Pavel Machek wrote:
> Hi!
>
> > 03-i8042-broken-mux-workaround.patch
> > - Some MUXes get confused what AUX port the byte came from. Assume
> > that is came from the same port previous byte came from if it
> > arrived within HZ/10
>
> Does that mean that (even if my hw is ok) when I two mice at once
> I get random movements?
No, that code will only kick in if your MUX gets confused and not during
normal course of operation. Some MUXes, when confused, raise MUXERR flag
but leave the data byte intact in violation of active multiplexing spec.
which says that with MUXERR the only valid data bytes are 0xfd, oxfe and
0xff (to signal timeout, resend or parity error). So if we get something
other than 0xfd, 0xfe or 0xff within HZ/10 of last successfully transmitted
byte we assume that MUX got confused and the byte was sent by the same
device that transmitted the previous byte.
Does it make any sense?
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] New set of input patches
2004-07-09 3:48 ` Dmitry Torokhov
@ 2004-07-09 5:06 ` Pavel Machek
0 siblings, 0 replies; 14+ messages in thread
From: Pavel Machek @ 2004-07-09 5:06 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Vojtech Pavlik, LKML
Hi!
> > > 03-i8042-broken-mux-workaround.patch
> > > - Some MUXes get confused what AUX port the byte came from. Assume
> > > that is came from the same port previous byte came from if it
> > > arrived within HZ/10
> >
> > Does that mean that (even if my hw is ok) when I two mice at once
> > I get random movements?
>
> No, that code will only kick in if your MUX gets confused and not during
> normal course of operation. Some MUXes, when confused, raise MUXERR flag
> but leave the data byte intact in violation of active multiplexing spec.
> which says that with MUXERR the only valid data bytes are 0xfd, oxfe and
> 0xff (to signal timeout, resend or parity error). So if we get something
> other than 0xfd, 0xfe or 0xff within HZ/10 of last successfully transmitted
> byte we assume that MUX got confused and the byte was sent by the same
> device that transmitted the previous byte.
>
> Does it make any sense?
Yes... Hmm, it is wonderfull in how many ways hardware can be
broken...
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
^ permalink raw reply [flat|nested] 14+ messages in thread
* synaptics driver
2004-07-08 6:55 ` [PATCH 1/8] " Dmitry Torokhov
2004-07-08 6:56 ` [PATCH 2/8] " Dmitry Torokhov
@ 2004-07-12 3:17 ` Ari Pollak
2004-07-12 3:41 ` Dmitry Torokhov
1 sibling, 1 reply; 14+ messages in thread
From: Ari Pollak @ 2004-07-12 3:17 UTC (permalink / raw)
To: linux-kernel
Hi again. I just wanted to let you know that under 2.6.8-mm1, I'm still
experiencing the same synaptics-not-being-detected-at-system-startup bug
that happens with the newer input patches since earlier -mm kernels.
Sometimes my synaptics touchpad will get detected correctly (generally
after a cold reboot) and both my trackpoint & touchpad will work
properly, but other times (after warm reboot usually) the trackpoint
won't work, and the Synaptics X driver won't enable the extra touchpad
features. Removing & reloading the psmouse module after the system has
booted fixes the problem. With the more recent kernels, this seems to
happen even if psmouse is loaded before all the USB controller modules.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: synaptics driver
2004-07-12 3:17 ` synaptics driver Ari Pollak
@ 2004-07-12 3:41 ` Dmitry Torokhov
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2004-07-12 3:41 UTC (permalink / raw)
To: linux-kernel; +Cc: Ari Pollak
On Sunday 11 July 2004 10:17 pm, Ari Pollak wrote:
> Hi again. I just wanted to let you know that under 2.6.8-mm1, I'm still
> experiencing the same synaptics-not-being-detected-at-system-startup bug
> that happens with the newer input patches since earlier -mm kernels.
> Sometimes my synaptics touchpad will get detected correctly (generally
> after a cold reboot) and both my trackpoint & touchpad will work
> properly, but other times (after warm reboot usually) the trackpoint
> won't work, and the Synaptics X driver won't enable the extra touchpad
> features. Removing & reloading the psmouse module after the system has
> booted fixes the problem. With the more recent kernels, this seems to
> happen even if psmouse is loaded before all the USB controller modules.
>
Usually that happens because of USB Legacy emulation screws up Synaptics
detection. You need to load your USB modules _before_ loading psmouse so
uhci (or ohci) would disable the legacy mode before psmouse starts
detection.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2004-07-12 3:41 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-08 6:55 [PATCH 0/8] New set of input patches Dmitry Torokhov
2004-07-08 6:55 ` [PATCH 1/8] " Dmitry Torokhov
2004-07-08 6:56 ` [PATCH 2/8] " Dmitry Torokhov
2004-07-08 6:56 ` [PATCH 3/8] " Dmitry Torokhov
2004-07-08 6:57 ` [PATCH 4/8] " Dmitry Torokhov
2004-07-08 6:57 ` [PATCH 5/8] " Dmitry Torokhov
2004-07-08 6:58 ` [PATCH 6/8] " Dmitry Torokhov
2004-07-08 6:58 ` [PATCH 7/8] " Dmitry Torokhov
2004-07-08 6:59 ` [PATCH 8/8] " Dmitry Torokhov
2004-07-12 3:17 ` synaptics driver Ari Pollak
2004-07-12 3:41 ` Dmitry Torokhov
2004-07-08 20:32 ` [PATCH 0/8] New set of input patches Pavel Machek
2004-07-09 3:48 ` Dmitry Torokhov
2004-07-09 5:06 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox