static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { struct atkbd *atkbd = serio->private; unsigned int code = data; int scroll = 0, click = -1; int value; #ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); #endif #if !defined(__i386__) && !defined (__x86_64__) if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); serio_write(serio, ATKBD_CMD_RESEND); atkbd->resend = 1; goto out; } if (!flags && data == ATKBD_RET_ACK) atkbd->resend = 0; #endif if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) if (ps2_handle_ack(&atkbd->ps2dev, data)) goto out; if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_CMD)) if (ps2_handle_response(&atkbd->ps2dev, data)) goto out; if (!atkbd->enabled) goto out; input_event(&atkbd->dev, EV_MSC, MSC_RAW, code); if (atkbd->translated) { if (atkbd->emul || !(code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1 || code == ATKBD_RET_HANGUEL || code == ATKBD_RET_HANJA || code == ATKBD_RET_ERR || (code == ATKBD_RET_BAT && !atkbd->bat_xl))) { atkbd->release = code >> 7; code &= 0x7f; } if (!atkbd->emul && (code & 0x7f) == (ATKBD_RET_BAT & 0x7f)) atkbd->bat_xl = !atkbd->release; }
int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data) { switch (data) { case PS2_RET_ACK: ps2dev->nak = 0; break; case PS2_RET_NAK: ps2dev->flags |= PS2_FLAG_NAK; ps2dev->nak = PS2_RET_NAK; break; case PS2_RET_ERR: if (ps2dev->flags & PS2_FLAG_NAK) { ps2dev->flags &= ~PS2_FLAG_NAK; ps2dev->nak = PS2_RET_ERR; break; } /* * Workaround for mice which don't ACK the Get ID command. * These are valid mouse IDs that we recognize. */ case 0x00: case 0x03: case 0x04: if (ps2dev->flags & PS2_FLAG_WAITID) { ps2dev->nak = 0; break; } /* Fall through */ default: return 0; } if (!ps2dev->nak) { ps2dev->flags &= ~PS2_FLAG_NAK; if (ps2dev->cmdcnt) ps2dev->flags |= PS2_FLAG_CMD | PS2_FLAG_CMD1; } ps2dev->flags &= ~PS2_FLAG_ACK; wake_up(&ps2dev->wait); if (data != PS2_RET_ACK) ps2_handle_response(ps2dev, data); return 1; }
static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags) { struct atkbd *atkbd = serio_get_drvdata(serio); struct input_dev *dev = atkbd->dev; unsigned int code = data; int scroll = 0, hscroll = 0, click = -1; int value; unsigned short keycode; #ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); #endif #if !defined(__i386__) && !defined (__x86_64__) if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); serio_write(serio, ATKBD_CMD_RESEND); atkbd->resend = 1; goto out; } if (!flags && data == ATKBD_RET_ACK) atkbd->resend = 0; #endif if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) if (ps2_handle_ack(&atkbd->ps2dev, data)) goto out; if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_CMD)) if (ps2_handle_response(&atkbd->ps2dev, data)) goto out; if (!atkbd->enabled) goto out; input_event(dev, EV_MSC, MSC_RAW, code); if (atkbd->translated) { if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) { atkbd->release = code >> 7; code &= 0x7f; } if (!atkbd->emul) atkbd_calculate_xl_bit(atkbd, data); }