2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
20 #ifndef LINUXINPUTDEVICES_H_
21 #define LINUXINPUTDEVICES_H_
25 #include "windowing/XBMC_events.h"
26 #include "input/XBMC_keyboard.h"
27 #include "threads/SingleLock.h"
35 unsigned short altShift;
38 class CLinuxInputDevice
41 CLinuxInputDevice(const std::string fileName, int index);
43 XBMC_Event ReadEvent();
44 char* GetDeviceName();
48 void SetupKeyboardAutoRepeat(int fd);
49 XBMCKey TranslateKey(unsigned short code);
50 bool KeyEvent(const struct input_event& levt, XBMC_Event& devt);
51 bool RelEvent(const struct input_event& levt, XBMC_Event& devt);
52 bool AbsEvent(const struct input_event& levt, XBMC_Event& devt);
53 bool TranslateEvent(const struct input_event& levt, XBMC_Event& devt);
54 void SetLed(int led, int state);
58 unsigned short KeyboardReadValue(unsigned char table, unsigned char index);
59 XBMCMod UpdateModifiers(XBMC_Event& devt);
60 bool GetKeymapEntry(KeymapEntry& entry);
61 int KeyboardGetSymbol(unsigned short value);
66 std::string m_fileName;
73 char m_deviceName[256];
75 int m_devicePreferredId;
77 int m_deviceMinKeyCode;
78 int m_deviceMaxKeyCode;
80 bool m_bSkipNonKeyEvents;
84 class CLinuxInputDevices
88 void CheckHotplugged();
89 XBMC_Event ReadEvent();
90 bool IsRemoteLowBattery();
91 bool IsRemoteNotPaired();
93 CCriticalSection m_devicesListLock;
94 bool CheckDevice(const char *device);
95 std::vector<CLinuxInputDevice*> m_devices;
97 time_t m_lastHotplugCheck;
100 #endif /* LINUXINPUTDEVICES_H_ */