1

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 = &lt;&amp;i2c_csi_dsi&gt;;
    __overlay__ {
        #address-cells = &lt;1&gt;;
        #size-cells = &lt;0&gt;;

        tca8418: keypad@34 {
            compatible = &quot;ti,tca8418&quot;;
            reg = &lt;0x34&gt;;
            interrupt-parent = &lt;&amp;gpio&gt;;
            interrupts = &lt;6 2&gt;; // GPIO6 for interrupt, falling edge
            key-debounce = &lt;32&gt;; // Debounce time in milliseconds

            linux,keymap = &lt;
                /* 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 */
            &gt;;    
            keypad,num-rows = &lt;8&gt;;
            keypad,num-columns = &lt;8&gt;; // 8 columns (COL0-COL7)
        };
    };
};

fragment@1 {
    target = &lt;&amp;gpio&gt;;
    __overlay__ {
        tca8418_pins: tca8418_pins {
            brcm,pins = &lt;6&gt;; // GPIO6 (interrupt)
            brcm,function = &lt;0&gt;; // Input mode
            brcm,pull = &lt;2&gt;; // 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.

0 Answers0