summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oinputsystem.cpp
authormickeyl <mickeyl>2005-02-02 16:37:12 (UTC)
committer mickeyl <mickeyl>2005-02-02 16:37:12 (UTC)
commit8ea35f618c5811b59f4460d0f2198b9818db281e (patch) (side-by-side diff)
tree0ef5a73e14c9b236dde77cb866401ab0ad3a103f /libopie2/opiecore/oinputsystem.cpp
parent896b1f8f0855feec3bb6cb9944c5f7a7b2d6cd1f (diff)
downloadopie-8ea35f618c5811b59f4460d0f2198b9818db281e.zip
opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.gz
opie-8ea35f618c5811b59f4460d0f2198b9818db281e.tar.bz2
more input system stuff
Diffstat (limited to 'libopie2/opiecore/oinputsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oinputsystem.cpp17
1 files changed, 16 insertions, 1 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
@@ -39,7 +39,12 @@ using namespace Opie::Core;
#include <sys/fcntl.h>
#include <sys/ioctl.h>
-#define BUFSIZE 256
+#define BUFSIZE 256
+#define BIT_MASK( name, numbits ) \
+ unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \
+ memset( name, 0, sizeof( name ) )
+#define BIT_TEST( bitmask, bit ) \
+ ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) )
/*======================================================================================
* OInputSystem
@@ -140,3 +145,13 @@ QString OInputDevice::uniq() const
return buf;
}
+bool OInputDevice::hasFeature( Feature bit ) const
+{
+ BIT_MASK( features, EV_MAX );
+
+ if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
+ return false;
+ else
+ return BIT_TEST( features, bit );
+}
+