summaryrefslogtreecommitdiff
path: root/examples
Unidiff
Diffstat (limited to 'examples') (more/less context) (show whitespace changes)
-rw-r--r--examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
index 6c95048..b49df99 100644
--- a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
+++ b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp
@@ -42,78 +42,82 @@ using namespace Opie::Core;
42int main( int argc, char** argv ) 42int main( int argc, char** argv )
43{ 43{
44 OInputSystem* sys = OInputSystem::instance(); 44 OInputSystem* sys = OInputSystem::instance();
45 OInputSystem::DeviceIterator it = sys->iterator(); 45 OInputSystem::DeviceIterator it = sys->iterator();
46 46
47 OInputDevice* dev = 0; 47 OInputDevice* dev = 0;
48 48
49 while ( it.current() ) 49 while ( it.current() )
50 { 50 {
51 odebug << "DEMO: OInputSystem contains OInputDevice '" << it.current()->name() << "'" << oendl; 51 odebug << "DEMO: OInputSystem contains OInputDevice '" << it.current()->name() << "'" << oendl;
52 52
53 dev = it.current(); 53 dev = it.current();
54 54
55 QString features; 55 QString features;
56 features += QString( "\nSynchronous: " ); 56 features += QString( "\nSynchronous: " );
57 if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]"; 57 if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]";
58 features += QString( "\nKeys or Buttons: " ); 58 features += QString( "\nKeys or Buttons: " );
59 if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]"; 59 if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]";
60 features += QString( "\nRelative Axes: " ); 60 features += QString( "\nRelative Axes: " );
61 if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]"; 61 if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]";
62 features += QString( "\nAbsolute Axes: " ); 62 features += QString( "\nAbsolute Axes: " );
63 if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]"; 63 if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]";
64 features += QString( "\nMiscellaneous: " ); 64 features += QString( "\nMiscellaneous: " );
65 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]"; 65 if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]";
66 features += QString( "\nSwitches: " );
67 if ( dev->hasFeature( OInputDevice::Switches ) ) features += "[ x ]"; else features += "[ ]";
66 features += QString( "\nLeds: " ); 68 features += QString( "\nLeds: " );
67 if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]"; 69 if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]";
68 features += QString( "\nSound: " ); 70 features += QString( "\nSound: " );
69 if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]"; 71 if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]";
70 features += QString( "\nAutoRepeat " ); 72 features += QString( "\nAutoRepeat " );
71 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]"; 73 if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]";
72 features += QString( "\nForceFeedback: " ); 74 features += QString( "\nForceFeedback: " );
73 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]"; 75 if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]";
74 features += QString( "\nPowerManagement: " ); 76 features += QString( "\nPowerManagement: " );
75 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]"; 77 if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]";
76 features += QString( "\nFeedbackStatus: " ); 78 features += QString( "\nFeedbackStatus: " );
77 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]"; 79 if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]";
78 80
79 odebug << "========================================" 81 odebug << "========================================"
80 << "\nDevice: " << dev->name() 82 << "\nDevice: " << dev->name()
81 << "\nName: " << dev->identity() 83 << "\nName: " << dev->identity()
82 << "\nPath: " << dev->path() 84 << "\nPath: " << dev->path()
83 << "\nUniq: " << dev->uniq() 85 << "\nUniq: " << dev->uniq()
84 << features << "\n" 86 << features << "\n"
85 << oendl; 87 << oendl;
86 88
87 if ( dev->isHeld( OInputDevice::Key_LEFTSHIFT ) ) 89 if ( dev->isHeld( OInputDevice::Key_LEFTSHIFT ) )
88 odebug << "Left Shift is being held." << oendl; 90 odebug << "Left Shift is being held." << oendl;
89 else odebug << "Left Shift is _not_ being held." << oendl; 91 else odebug << "Left Shift is _not_ being held." << oendl;
90 92
91 if ( dev->isHeld( OInputDevice::Button_LEFT ) ) 93 if ( dev->isHeld( OInputDevice::Button_LEFT ) )
92 odebug << "Left Mouse Button is being held." << oendl; 94 odebug << "Left Mouse Button is being held." << oendl;
93 else odebug << "Left Mouse Button is _not_ being held." << oendl; 95 else odebug << "Left Mouse Button is _not_ being held." << oendl;
94 96
95 odebug << "Global key mask: " << dev->globalKeyMask() << oendl; 97 odebug << "Global key mask: " << dev->globalKeyMask() << oendl;
98 odebug << "Global switch mask: " << dev->globalSwitchMask() << oendl;
99
96 100
97 ++it; 101 ++it;
98 } 102 }
99} 103}
100 104
101#else 105#else
102 106
103#include <fcntl.h> 107#include <fcntl.h>
104#include <unistd.h> 108#include <unistd.h>
105#include <cstdlib> 109#include <cstdlib>
106#include <cstdio> 110#include <cstdio>
107#include <string> 111#include <string>
108 112
109#include <sys/types.h> 113#include <sys/types.h>
110#include <linux/input.h> 114#include <linux/input.h>
111 115
112using std::string; 116using std::string;
113 117
114const unsigned char BUT1 = 0x01; 118const unsigned char BUT1 = 0x01;
115const unsigned char BUT2 = 0x04; 119const unsigned char BUT2 = 0x04;
116const unsigned char BUT3 = 0x02; 120const unsigned char BUT3 = 0x02;
117const unsigned char BUT4 = 0x40; 121const unsigned char BUT4 = 0x40;
118const unsigned char BUT5 = 0x80; 122const unsigned char BUT5 = 0x80;
119 123