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();
46 void SetupKeyboardAutoRepeat(int fd);
47 XBMCKey TranslateKey(unsigned short code);
48 bool KeyEvent(const struct input_event& levt, XBMC_Event& devt);
49 bool RelEvent(const struct input_event& levt, XBMC_Event& devt);
50 bool AbsEvent(const struct input_event& levt, XBMC_Event& devt);
51 bool TranslateEvent(const struct input_event& levt, XBMC_Event& devt);
52 void SetLed(int led, int state);
56 unsigned short KeyboardReadValue(unsigned char table, unsigned char index);
57 XBMCMod UpdateModifiers(XBMC_Event& devt);
58 bool GetKeymapEntry(KeymapEntry& entry);
59 int KeyboardGetSymbol(unsigned short value);
64 std::string m_fileName;
71 char m_deviceName[256];
73 int m_devicePreferredId;
75 int m_deviceMinKeyCode;
76 int m_deviceMaxKeyCode;
78 bool m_bSkipNonKeyEvents;
81 class CLinuxInputDevices
85 XBMC_Event ReadEvent();
86 bool IsRemoteLowBattery();
87 bool IsRemoteNotPaired();
89 CCriticalSection m_devicesListLock;
90 bool CheckDevice(const char *device);
91 std::vector<CLinuxInputDevice*> m_devices;
94 #endif /* LINUXINPUTDEVICES_H_ */