summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2005-02-02 16:37:12 (UTC)
committer mickeyl <mickeyl>2005-02-02 16:37:12 (UTC)
commit8ea35f618c5811b59f4460d0f2198b9818db281e (patch) (unidiff)
tree0ef5a73e14c9b236dde77cb866401ab0ad3a103f /libopie2
parent896b1f8f0855feec3bb6cb9944c5f7a7b2d6cd1f (diff)
downloadopie-8ea35f618c5811b59f4460d0f2198b9818db281e.zip
opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.gz
opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.bz2
more input system stuff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oinputsystem.cpp17
-rw-r--r--libopie2/opiecore/oinputsystem.h7
2 files changed, 20 insertions, 4 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp
index bfdc31f..fde36c3 100644
--- a/libopie2/opiecore/oinputsystem.cpp
+++ b/libopie2/opiecore/oinputsystem.cpp
@@ -40,5 +40,10 @@ using namespace Opie::Core;
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41 41
42#define BUFSIZE 256 42#define BUFSIZE 256
43#define BIT_MASK( name, numbits ) \
44 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \
45 memset( name, 0, sizeof( name ) )
46#define BIT_TEST( bitmask, bit ) \
47 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) )
43 48
44/*====================================================================================== 49/*======================================================================================
@@ -141,2 +146,12 @@ QString OInputDevice::uniq() const
141} 146}
142 147
148bool OInputDevice::hasFeature( Feature bit ) const
149{
150 BIT_MASK( features, EV_MAX );
151
152 if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
153 return false;
154 else
155 return BIT_TEST( features, bit );
156}
157
diff --git a/libopie2/opiecore/oinputsystem.h b/libopie2/opiecore/oinputsystem.h
index 350656b..4d913a1 100644
--- a/libopie2/opiecore/oinputsystem.h
+++ b/libopie2/opiecore/oinputsystem.h
@@ -94,12 +94,12 @@ class OInputDevice : public QObject
94 public: 94 public:
95 95
96 enum EventType 96 enum Feature
97 { 97 {
98 Synchronous = EV_SYN, 98 Synchronous = EV_SYN,
99 Keyboard = EV_KEY, 99 Keys = EV_KEY,
100 Relative = EV_REL, 100 Relative = EV_REL,
101 Absolute = EV_ABS, 101 Absolute = EV_ABS,
102 Miscellaneous = EV_MSC, 102 Miscellaneous = EV_MSC,
103 Led = EV_LED, 103 Leds = EV_LED,
104 Sound = EV_SND, 104 Sound = EV_SND,
105 AutoRepeat = EV_REP, 105 AutoRepeat = EV_REP,
@@ -135,4 +135,5 @@ class OInputDevice : public QObject
135 QString path() const; 135 QString path() const;
136 QString uniq() const; 136 QString uniq() const;
137 bool hasFeature( Feature ) const;
137 138
138 private: 139 private: