I am working with a TCA8418 keypad controller connected to a Raspberry Pi via I2C. The keypad is an 8x8 matrix, and I have buttons connected to row 7. My goal is to detect key events properly, specifically KEY_UP, but I am only receiving EV_MSC events with MSC_SCAN codes.
Problem
Instead of expected EV_KEY events for keypresses, I am only getting:
event.type = EV_MSC
event.code = MSC_SCAN
event.value = <some value>
This happens for all keys on row 7 (no buttons on the other rows). No KEY_UP, KEY_DOWN, or other expected key events are appearing.
Device Tree Overlay
Here is the overlay file I am using for the Raspberry Pi:
/dts-v1/;
/plugin/;
{
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2c_csi_dsi>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
tca8418: keypad@34 {
compatible = "ti,tca8418";
reg = <0x34>;
interrupt-parent = <&gpio>;
interrupts = <6 2>; // GPIO6 for interrupt, falling edge
key-debounce = <32>; // Debounce time in milliseconds
linux,keymap = <
/* Row 7 - Assigned Keys */
0x00070067 /* KEY_UP */
0x0007011e /* KEY_LEFT */
0x00070221 /* KEY_RIGHT */
0x0007031f /* KEY_DOWN */
0x0007040e /* KEY_BACK */
0x00070571 /* KEY_PAUSE */
0x00070672 /* KEY_PLAY */
0x00070728 /* KEY_ENTER */
>;
keypad,num-rows = <8>;
keypad,num-columns = <8>; // 8 columns (COL0-COL7)
};
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
tca8418_pins: tca8418_pins {
brcm,pins = <6>; // GPIO6 (interrupt)
brcm,function = <0>; // Input mode
brcm,pull = <2>; // No pull
};
};
};
};
Troubleshooting Steps
Checked Kernel Messages (dmesg)
The device is detected and initialized correctly.
No errors or warnings.
Checked evtest Output
- Pressing any key only results in EV_MSC with MSC_SCAN, but no EV_KEY events.