donderdag 1 maart 2012

Keycodes and coffeeshops in the Linux kernel

We are using gpio-keys to configure 2 GPIO's coming from 2 sensors (left and right on our device) as keyboard interrupt lines.

So I had to choose 2 obscure keycodes to map on "proximity meter left" and "proximity meter right"...

Here are the results:

        {
                .gpio           = INT_PROX_L,
                .code           = KEY_COFFEE,
                .desc           = "Proximity Left",
        },
        {
                .gpio           = INT_PROX_R,
                .code           = KEY_SHOP,
                .desc           = "Proximity Right",
        },

These keynames and their order are easy to memorize now, because (since we read from left to right) we know that coffee = left and shop = right :-)