author | mickeyl <mickeyl> | 2005-02-02 16:37:12 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-02-02 16:37:12 (UTC) |
commit | 8ea35f618c5811b59f4460d0f2198b9818db281e (patch) (unidiff) | |
tree | 0ef5a73e14c9b236dde77cb866401ab0ad3a103f /examples | |
parent | 896b1f8f0855feec3bb6cb9944c5f7a7b2d6cd1f (diff) | |
download | opie-8ea35f618c5811b59f4460d0f2198b9818db281e.zip opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.gz opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.bz2 |
more input system stuff
-rw-r--r-- | examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp index 5450966..a9c0fd2 100644 --- a/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp +++ b/examples/opiecore/oinputsystemdemo/oinputsystemdemo.cpp | |||
@@ -48,15 +48,40 @@ int main( int argc, char** argv ) | |||
48 | 48 | ||
49 | while ( it.current() ) | 49 | while ( it.current() ) |
50 | { | 50 | { |
51 | odebug << "DEMO: OInputSystem contains Device '" << 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; | ||
56 | features += QString( "\nSynchronous: " ); | ||
57 | if ( dev->hasFeature( OInputDevice::Synchronous ) ) features += "[ x ]"; else features += "[ ]"; | ||
58 | features += QString( "\nKeys or Buttons: " ); | ||
59 | if ( dev->hasFeature( OInputDevice::Keys ) ) features += "[ x ]"; else features += "[ ]"; | ||
60 | features += QString( "\nRelative Axes: " ); | ||
61 | if ( dev->hasFeature( OInputDevice::Relative ) ) features += "[ x ]"; else features += "[ ]"; | ||
62 | features += QString( "\nAbsolute Axes: " ); | ||
63 | if ( dev->hasFeature( OInputDevice::Absolute ) ) features += "[ x ]"; else features += "[ ]"; | ||
64 | features += QString( "\nMiscellaneous: " ); | ||
65 | if ( dev->hasFeature( OInputDevice::Miscellaneous ) ) features += "[ x ]"; else features += "[ ]"; | ||
66 | features += QString( "\nLeds: " ); | ||
67 | if ( dev->hasFeature( OInputDevice::Leds ) ) features += "[ x ]"; else features += "[ ]"; | ||
68 | features += QString( "\nSound: " ); | ||
69 | if ( dev->hasFeature( OInputDevice::Sound ) ) features += "[ x ]"; else features += "[ ]"; | ||
70 | features += QString( "\nAutoRepeat " ); | ||
71 | if ( dev->hasFeature( OInputDevice::AutoRepeat ) ) features += "[ x ]"; else features += "[ ]"; | ||
72 | features += QString( "\nForceFeedback: " ); | ||
73 | if ( dev->hasFeature( OInputDevice::ForceFeedback ) ) features += "[ x ]"; else features += "[ ]"; | ||
74 | features += QString( "\nPowerManagement: " ); | ||
75 | if ( dev->hasFeature( OInputDevice::PowerManagement ) ) features += "[ x ]"; else features += "[ ]"; | ||
76 | features += QString( "\nFeedbackStatus: " ); | ||
77 | if ( dev->hasFeature( OInputDevice::ForceFeedbackStatus ) ) features += "[ x ]"; else features += "[ ]"; | ||
78 | |||
55 | odebug << "========================================" | 79 | odebug << "========================================" |
56 | << "\nDevice: " << dev->name() | 80 | << "\nDevice: " << dev->name() |
57 | << "\nName: " << dev->identity() | 81 | << "\nName: " << dev->identity() |
58 | << "\nPath: " << dev->path() | 82 | << "\nPath: " << dev->path() |
59 | << "\nUniq: " << dev->uniq() | 83 | << "\nUniq: " << dev->uniq() |
84 | << features << "\n" | ||
60 | << oendl; | 85 | << oendl; |
61 | 86 | ||
62 | ++it; | 87 | ++it; |
@@ -138,25 +163,6 @@ int Open_cPad() | |||
138 | /* ... */ | 163 | /* ... */ |
139 | } | 164 | } |
140 | 165 | ||
141 | // Get device 'name' | ||
142 | |||
143 | char name[256] = "Unknown"; | ||
144 | if( ioctl( fd, EVIOCGNAME(sizeof name ), name) < 0 ) | ||
145 | { | ||
146 | perror( "event device ioctl" ); | ||
147 | }else | ||
148 | printf( "Device name '%s'\n", name ); | ||
149 | |||
150 | if(ioctl(fd, EVIOCGPHYS(sizeof(name)), name) < 0) { | ||
151 | perror("event ioctl"); | ||
152 | }else | ||
153 | printf("Device path '%s'\n", name ); | ||
154 | |||
155 | if(ioctl(fd, EVIOCGUNIQ(sizeof(name)), name) < 0) { | ||
156 | perror("event ioctl"); | ||
157 | }else | ||
158 | printf("Device identity '%s'\n", name ); | ||
159 | |||
160 | // Get feature types | 166 | // Get feature types |
161 | 167 | ||
162 | BITMASK( features, EV_MAX ); | 168 | BITMASK( features, EV_MAX ); |