summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oinputsystem.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/oinputsystem.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/oinputsystem.cpp15
1 files changed, 15 insertions, 0 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
@@ -42,2 +42,7 @@ using namespace Opie::Core;
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
@@ -142 +147,11 @@ QString OInputDevice::uniq() const
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