bradj074
Participant
Post count: 8

i modified the SNESDev.c lines in the coding in several different ways and am not having any luck getting it to register correctly. I have confirmed the button itself functions with the original code so it is in my editing.

I have pasted the modified code i tried that is the same method supersirlink said he had written in the interest of helping out both of us (i used the escape key instead of h). I left the shutdown command in and that will function if it gets those 5 key presses but for some reason it will not register any of the esc keys.

Can you have a look at the coding and tell me how it should be properly coded?

case BTN_STATE_PRESSED:
if (button.pressedCtr == 1 && button.duration >= 1) {
uinput_kbd_write(&uinp_kbd, KEY_ESC, 1, EV_KEY);
}
break;
case BTN_STATE_RELEASED:
if (button.pressedCtr == 1 && button.duration >= 1) {
uinput_kbd_write(&uinp_kbd, KEY_ESC, 0, EV_KEY);
} else if (button.pressedCtr == 3 && button.duration >= 1) {
// Sending ESC
uinput_kbd_write(&uinp_kbd, KEY_ESC, 1, EV_KEY);
usleep(50000);
uinput_kbd_write(&uinp_kbd, KEY_ESC, 0, EV_KEY);
} else if (button.pressedCtr == 5 && button.duration >= 1) {
uinput_kbd_write(&uinp_kbd, KEY_ESC, 1, EV_KEY);
usleep(50000);
uinput_kbd_write(&uinp_kbd, KEY_ESC, 0, EV_KEY);
// shutting down
system(“shutdown -t 3 -h now”);