From 4c47e15bee4ca0abf8505df7da58a6374c349cc7 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sun, 10 Nov 2019 18:55:06 +0800 Subject: [PATCH] input: fix wrong menu button trigger. --- input.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/input.cpp b/input.cpp index 1b7bccc..8877273 100644 --- a/input.cpp +++ b/input.cpp @@ -1709,6 +1709,8 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int //check if device is a part of multifunctional device if (input[dev].bind >= 0) dev = input[dev].bind; + if (ev->type == EV_KEY && !ev->code) return; + //mouse if (ev->type == EV_KEY && ev->code >= BTN_MOUSE && ev->code < BTN_JOYSTICK) { @@ -1760,16 +1762,19 @@ static void input_cb(struct input_event *ev, struct input_absinfo *absinfo, int int old_combo = input[dev].osd_combo; - if (ev->code == input[dev].mmap[SYS_BTN_OSD_KTGL + 2]) + if (ev->type == EV_KEY) { - if (ev->value) input[dev].osd_combo |= 2; - else input[dev].osd_combo &= ~2; - } + if (ev->code == input[dev].mmap[SYS_BTN_OSD_KTGL + 2]) + { + if (ev->value) input[dev].osd_combo |= 2; + else input[dev].osd_combo &= ~2; + } - if (ev->code == input[dev].mmap[SYS_BTN_OSD_KTGL + 1]) - { - if (ev->value) input[dev].osd_combo |= 1; - else input[dev].osd_combo &= ~1; + if (ev->code == input[dev].mmap[SYS_BTN_OSD_KTGL + 1]) + { + if (ev->value) input[dev].osd_combo |= 1; + else input[dev].osd_combo &= ~1; + } } int osd_event = 0;