1 // FGEventInput.hxx -- handle event driven input devices for the Linux O/S
3 // Written by Torsten Dreyer, started July 2009
5 // Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __FGLINUXEVENTINPUT_HXX
24 #define __FGLINUXEVENTINPUT_HXX
26 #include "FGEventInput.hxx"
27 #include <linux/input.h>
29 struct FGLinuxEventData : public FGEventData {
30 FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
31 FGEventData( (double)event.value, dt, modifiers ),
40 * A implementation for linux event devices
42 class FGLinuxInputDevice : public FGInputDevice {
45 FGLinuxInputDevice( std::string name, std::string devname );
46 virtual ~FGLinuxInputDevice();
50 virtual void Send( const char * eventName, double value );
51 virtual const char * TranslateEventName( FGEventData & eventData );
53 void SetDevname( const std::string name );
54 std::string GetDevname() const { return devname; }
56 int GetFd() { return fd; }
58 double Normalize( struct input_event & event );
63 std::map<unsigned int,input_absinfo> absinfo;
66 class FGLinuxEventInput : public FGEventInput {
69 virtual ~ FGLinuxEventInput();
70 virtual void update (double dt);
71 virtual void postinit();