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>
28 #include <hal/libhal.h>
30 struct FGLinuxEventData : public FGEventData {
31 FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
32 FGEventData( (double)event.value, dt, modifiers ),
41 * A implementation for linux event devices
43 class FGLinuxInputDevice : public FGInputDevice {
46 FGLinuxInputDevice( string name, string devname );
47 virtual ~FGLinuxInputDevice();
51 virtual void Send( const char * eventName, double value );
52 virtual const char * TranslateEventName( FGEventData & eventData );
54 void SetDevname( const string name );
55 string GetDevname() const { return devname; }
57 int GetFd() { return fd; }
64 class FGLinuxEventInput : public FGEventInput {
67 virtual ~ FGLinuxEventInput();
68 virtual void update (double dt);
71 void AddHalDevice( const char * udi );
73 LibHalContext *halcontext;