2 * Copyright (C) 2005-2009 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, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 #ifndef LINUXINPUTDEVICES_H_
22 #define LINUXINPUTDEVICES_H_
26 #include "windowing/XBMC_events.h"
27 #include "input/XBMC_keyboard.h"
28 #include "threads/SingleLock.h"
36 unsigned short altShift;
39 class CLinuxInputDevice
42 CLinuxInputDevice(const std::string fileName, int index);
44 XBMC_Event ReadEvent();
47 void SetupKeyboardAutoRepeat(int fd);
48 XBMCKey TranslateKey(unsigned short code);
49 bool KeyEvent(const struct input_event& levt, XBMC_Event& devt);
50 bool RelEvent(const struct input_event& levt, XBMC_Event& devt);
51 bool AbsEvent(const struct input_event& levt, XBMC_Event& devt);
52 bool TranslateEvent(const struct input_event& levt, XBMC_Event& devt);
53 void SetLed(int led, int state);
57 unsigned short KeyboardReadValue(unsigned char table, unsigned char index);
58 XBMCMod UpdateModifiers(XBMC_Event& devt);
59 bool GetKeymapEntry(KeymapEntry& entry);
60 int KeyboardGetSymbol(unsigned short value);
65 std::string m_fileName;
72 char m_deviceName[256];
74 int m_devicePreferredId;
76 int m_deviceMinKeyCode;
77 int m_deviceMaxKeyCode;
79 bool m_bSkipNonKeyEvents;
82 class CLinuxInputDevices
86 XBMC_Event ReadEvent();
87 bool IsRemoteLowBattery();
88 bool IsRemoteNotPaired();
90 CCriticalSection m_devicesListLock;
91 bool CheckDevice(const char *device);
92 std::vector<CLinuxInputDevice*> m_devices;
95 #endif /* LINUXINPUTDEVICES_H_ */