无法在Linux驱动程序中的Raspberry Pi上请求键盘IRQ 1

时间:2019-03-07 11:06:50

标签: linux-kernel raspberry-pi linux-device-driver raspberry-pi3

这是我的驱动程序源代码的一部分:

#define KEYBOARD_IRQ        1

err = request_irq(KEYBOARD_IRQ, (irq_handler_t) st7735_keyboard_interrupt, 
                  IRQF_SHARED, "st7735_keyboard_interrupt", 
                  (void *)(st7735_keyboard_interrupt));
if(err) {
        printk(KERN_ERR "ST7735 : ERROR : Failed to request keyboard interrupt\n");
        return err;
}

返回值为-22-EINVAL。我怀疑问题出在键盘IRQ号中。键盘已连接到RPi。

cat / proc / bus / input / devices:

I: Bus=0003 Vendor=1c4f Product=0026 Version=0110
N: Name="SIGMACHIP USB Keyboard"
P: Phys=usb-3f980000.usb-1.4/input0
S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:1C4F:0026.0001/input/input0
U: Uniq=
H: Handlers=sysrq kbd leds event0 
B: PROP=0
B: EV=120013
B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=1c4f Product=0026 Version=0110
N: Name="SIGMACHIP USB Keyboard"
P: Phys=usb-3f980000.usb-1.4/input1
S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:1C4F:0026.0002/input/input1
U: Uniq=
H: Handlers=kbd event1 
B: PROP=0
B: EV=1f
B: KEY=3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 1 130c13 b17c000 267bfa d941dfed 9e1680 4400 0 10000002
B: REL=40
B: ABS=1 0
B: MSC=10

cat / proc / interrupts:

           CPU0       CPU1       CPU2       CPU3       
 16:          0          0          0          0  bcm2836-timer   0 Edge      arch_timer
 17:      11098      13199      12423       3164  bcm2836-timer   1 Edge      arch_timer
 21:          0          0          0          0  bcm2836-pmu   9 Edge      arm-pmu
 23:        929          0          0          0  ARMCTRL-level   1 Edge      3f00b880.mailbox
 24:          2          0          0          0  ARMCTRL-level   2 Edge      VCHIQ doorbell
 46:          0          0          0          0  ARMCTRL-level  48 Edge      bcm2708_fb dma
 48:          0          0          0          0  ARMCTRL-level  50 Edge      DMA IRQ
 50:          0          0          0          0  ARMCTRL-level  52 Edge      DMA IRQ
 51:        355          0          0          0  ARMCTRL-level  53 Edge      DMA IRQ
 54:       1995          0          0          0  ARMCTRL-level  56 Edge      DMA IRQ
 55:          0          0          0          0  ARMCTRL-level  57 Edge      DMA IRQ
 56:          0          0          0          0  ARMCTRL-level  58 Edge      DMA IRQ
 59:          0          0          0          0  ARMCTRL-level  61 Edge      bcm2835-auxirq
 62:    1348363          0          0          0  ARMCTRL-level  64 Edge      dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb1
 83:          0          0          0          0  ARMCTRL-level  85 Edge      3f804000.i2c
 84:     102410          0          0          0  ARMCTRL-level  86 Edge      3f204000.spi
 86:        285          0          0          0  ARMCTRL-level  88 Edge      mmc0
 87:       4819          0          0          0  ARMCTRL-level  89 Edge      uart-pl011
 92:      30543          0          0          0  ARMCTRL-level  94 Edge      mmc1
FIQ:              usb_fiq
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:       3946      26730      81970      29799  Rescheduling interrupts
IPI3:         17          4          7          7  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:       1854       1806       5681        314  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts

请帮助我了解如何在系统中请求键盘IRQ。

1 个答案:

答案 0 :(得分:0)

您不能像这样定义自己的IRQ号。 IRQ1可能是一个非常低级的核心系统中断。这似乎是USB键盘,理想情况下应该是开箱即用还是某些自定义芯片?请看一下如何编写通过USB接口的驱动程序。例如,请参见here。参见Chapter13

相关问题