Re: [PATCH] Synaptics: support for pass-through port (stick)

Peter Berg Larsen (pebl@math.ku.dk)
Sun, 6 Jul 2003 15:23:45 +0200 (CEST)


On Sun, 6 Jul 2003, Dmitry Torokhov wrote:

> - psmouse_process_packet(psmouse, regs);
> - psmouse->pktcnt = 0;
> +
> + if (psmouse->pktcnt == 1 && psmouse->packet[0] == PSMOUSE_RET_BAT) {
> + serio_rescan(serio);
> goto out;
> }
>
> - if (psmouse->pktcnt == 1 && psmouse->type == PSMOUSE_SYNAPTICS) {
> + if (psmouse->type == PSMOUSE_SYNAPTICS) {

Why did you move the rescan up above the synaptics test? if the synaptics
is out of sync, any byte can be recieved.

> +static int synaptics_pt_write(struct serio *port, unsigned char c)
> +{
> + struct psmouse *parent = port->driver;
> + char client_cmd = 0x28; // indicates that we want pass-through port

Could client_cmd be renamed to f.ex. rate_param?

> + if (child->init_done) {
> + serio_interrupt(ptport, packet[1], 0, NULL);
> + if (child->type >= PSMOUSE_GENPS)
> + serio_interrupt(ptport, packet[2], 0, NULL);
> + serio_interrupt(ptport, packet[4], 0, NULL);
> + serio_interrupt(ptport, packet[5], 0, NULL);

The 4th protocol byte from a guest is the 3rd byte in the encapsulated
packet from the pad. So I would move "if (..." last.

There might be a (de)multiplexing problem here. The button information
(pressed/released) in byte 0 and 3 is lost, and are not repeated in the
guest protocol.

> + 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;
> +
> + printk(KERN_INFO "serio: %s port at %s\n", port->name, psmouse->phys);
> + serio_register_slave_port(port);
> +
> + return 0;
> +}
> +

Bit 2 in the pads second mode byte must be set if the guest uses a 4 bytes
protocol. So you need to check which protocol is negotiated on the slave
port.

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/