/* twidjoy_interrupt() is called by the low level driver when characters are ready for us. We then buffer them for further processing, or call the packet processing routine.  */
static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
/* twidjoy_interrupt() is called by the low level driver when characters are ready for us. We then buffer them for further processing, or call the packet processing routine.  */
static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags)
{
	struct twidjoy *twidjoy = serio_get_drvdata(serio);
	if ((data & 0x80) == 0)
		twidjoy->idx = 0;
	else if (twidjoy->idx == 0)
		return IRQ_HANDLED;
	if (twidjoy->idx < TWIDJOY_MAX_LENGTH)
		twidjoy->data[twidjoy->idx++] = data;
	if (twidjoy->idx == TWIDJOY_MAX_LENGTH) {
		twidjoy_process_packet(twidjoy);
		twidjoy->idx = 0;
	}
	return IRQ_HANDLED;
}