Thanks again for your reply Porcinus.
Okay, so this is the DTS file I've arrived at;
Code:
// Definitions for Freeplay Zero/CM3 gpio-keys
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
// Configure the gpio pin controller
target = <&gpio>;
__overlay__ {
pin_state: button_pins@0 {
brcm,pins = <6 5 4 17 16 24 19 26 14 23>; // gpio number
brcm,function = <0 0 0 0 0 0 0 0 0 0>; // 0 = input, 1 = output
brcm,pull = <2 2 2 2 2 2 2 2 2 2>; // 0 = none, 1 = pull down, 2 = pull up
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
button: Freeplay_GPIO_Keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pin_state>;
status = "okay";
key@6 {
linux,code = <28>; //KEY_ENTER
gpios = <&gpio 19 1>;
};
key@7 {
linux,code = <57>; //KEY_SPACE
gpios = <&gpio 26 1>;
};
key@20 { //shoulder-l
linux,code = <38>;
gpios = <&gpio 14 1>;
label = "KEY_L";
};
key@21 { //shoulder-r
linux,code = <19>;
gpios = <&gpio 23 1>;
label = "KEY_R";
};
};
};
};
fragment@2 {
target-path = "/";
__overlay__ {
gpio-mouse {
compatible = "gpio-mouse";
scan-interval-ms = <50>;
up-gpios = <&gpio 4 1>;
down-gpios = <&gpio 17 1>;
left-gpios = <&gpio 6 1>;
right-gpios = <&gpio 5 1>;
button-left-gpios = <&gpio 16 1>;
button-right-gpios = <&gpio 24 1>;
};
};
};
};
(sorry pasting the code hasn't preserved the indents, but they are there!)
It compiles to binary, and I've updated /boot/config.txt
But it still doesn't work
I've downloaded the the
evtest and
input-utils packages
And when I enter the command
lsinput I get the following:
Code:
/dev/input/event0
bustype : BUS_PARPORT
vendor : 0x1
product : 0x4
version : 256
name : "GPIO Controller 1"
phys : "input0"
bits ev : EV_SYN EV_KEY EV_ABS
/dev/input/event1
bustype : BUS_HOST
vendor : 0x1
product : 0x1
version : 256
name : "Freeplay_GPIO_Keys"
phys : "gpio-keys/input0"
bits ev : EV_SYN EV_KEY
So it isn't showing up as an input device...
Do you have any other recommendations for things I could try? I feel like we're so close to cracking it!