键盘键盘损坏 1~4键无法使用,基于i8042 修改驱动使用F1~F4 替换

来源:互联网 发布:淘宝客服没人理怎么办 编辑:程序博客网 时间:2024/05/23 14:21

事件:刚上海,让家里把台式机寄过来,拿到到时候发现机箱变形,键盘也莫名其妙的1到4键无法使用本来想直接拆开 修修但苦于没有工具在身于是直接修改驱动层使用F1~F4键替代使用

OS:redhat 内核版本3.16

CODE:/home/sdk/linux-3.16/drivers/input/serio/i8042.c

直接来硬的基于中断处理函数替换


 static void i8042_key_replace(unsigned char * data) //直接实现keycode替换

在i8042_interrupt中断处理函数中调用 上述 函数替换 data

/*
  482  * i8042_interrupt() is the most important function in this driver -
  483  * it handles the interrupts from the i8042, and sends incoming bytes
  484  * to the upper layers.
  485  */
  486
  487 static irqreturn_t i8042_interrupt(int irq, void *dev_id)
  .

  .

  .

  559     i8042_key_replace(&data);
  560     port = &i8042_ports[port_no];
  561     serio = port->exists ? port->serio : NULL;
  562
  563     dbg("%02x <- i8042 (interrupt, %d, %d%s%s)\n",


0 0