mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
rcinput: use a dynamic list of input devices
Instead of the fixed, static list of input devices, scan /dev/input/ for proper event devices. A "good" input device is one that supports the EVIOCGBIT ioctl and at least the EV_KEY event type. This probably needs further fixes, e.g. in repeat rate setting code.
This commit is contained in:
committed by
M. Liebmann
parent
e35969afe2
commit
7b3aa2b181
@@ -39,6 +39,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <OpenThreads/Mutex>
|
||||
#include <OpenThreads/ScopedLock>
|
||||
|
||||
#ifdef BOXMODEL_CS_HD2
|
||||
#ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H
|
||||
#include <cs_ir_generic.h>
|
||||
@@ -138,6 +141,12 @@ class CRCInput
|
||||
bool correct_time;
|
||||
};
|
||||
|
||||
struct in_dev
|
||||
{
|
||||
int fd;
|
||||
std::string path;
|
||||
};
|
||||
|
||||
uint32_t timerid;
|
||||
std::vector<timer> timers;
|
||||
|
||||
@@ -147,21 +156,19 @@ class CRCInput
|
||||
int fd_pipe_high_priority[2];
|
||||
int fd_pipe_low_priority[2];
|
||||
int fd_gamerc;
|
||||
#ifdef HAVE_SPARK_HARDWARE
|
||||
#define NUMBER_OF_EVENT_DEVICES 2
|
||||
#else
|
||||
#define NUMBER_OF_EVENT_DEVICES 1
|
||||
#endif
|
||||
int fd_rc[NUMBER_OF_EVENT_DEVICES];
|
||||
std::vector<in_dev> indev;
|
||||
int fd_keyb;
|
||||
int fd_event;
|
||||
|
||||
int fd_max;
|
||||
int clickfd;
|
||||
__u16 rc_last_key;
|
||||
OpenThreads::Mutex mutex;
|
||||
void set_dsp();
|
||||
|
||||
void open(int dev = -1);
|
||||
void open(bool recheck = false);
|
||||
bool checkpath(in_dev id);
|
||||
bool checkdev();
|
||||
void close();
|
||||
int translate(int code);
|
||||
void calculateMaxFd(void);
|
||||
@@ -280,7 +287,9 @@ class CRCInput
|
||||
|
||||
inline int getFileHandle(void) /* used for plugins (i.e. games) only */
|
||||
{
|
||||
return fd_rc[0];
|
||||
if (indev.empty())
|
||||
return -1;
|
||||
return indev[0].fd;
|
||||
}
|
||||
void stopInput(const bool ext = false);
|
||||
void restartInput(const bool ext = false);
|
||||
|
Reference in New Issue
Block a user