From 146c46da8e7028c206381034b693b60073b106d2 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 25 Mar 2012 20:08:38 +0200 Subject: [PATCH] neutrino: fix input device repeat setting for pre 2.6.17 kernels --- src/driver/rcinput.cpp | 2 +- src/system/setting_helpers.cpp | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 40cbed62a..535ca984f 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -155,7 +155,7 @@ void CRCInput::open() for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { - if ((fd_rc[i] = ::open(RC_EVENT_DEVICE[i], O_RDONLY)) == -1) + if ((fd_rc[i] = ::open(RC_EVENT_DEVICE[i], O_RDWR)) == -1) perror(RC_EVENT_DEVICE[i]); else { diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index fb5cb0ff9..eeb72a2a5 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -461,17 +461,19 @@ bool CKeySetupNotifier::changeNotify(const neutrino_locale_t, void *) ioctl(fd, IOC_IR_SET_X_DELAY, xdelay); #else /* if we have a good input device, we don't need the private ioctl above */ - struct my_repeat { - unsigned int delay; /* in ms */ - unsigned int period; /* in ms */ - }; - struct my_repeat n; + struct input_event ie; + ie.type = EV_REP; /* increase by 10 ms to trick the repeat checker code in the * rcinput loop into accepting the key event... */ - n.delay = fdelay + 10; - n.period = xdelay + 10; - if (ioctl(fd, EVIOCSREP, &n)) - perror("CKeySetupNotifier::changeNotify EVIOCSREP"); + ie.value = fdelay + 10; + ie.code = REP_DELAY; + if (write(fd, &ie, sizeof(ie)) == -1) + perror("CKeySetupNotifier::changeNotify REP_DELAY"); + + ie.value = xdelay + 10; + ie.code = REP_PERIOD; + if (write(fd, &ie, sizeof(ie)) == -1) + perror("CKeySetupNotifier::changeNotify REP_PERIOD"); #endif return false; }