summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oinputsystem.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/oinputsystem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oinputsystem.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/libopie2/opiecore/oinputsystem.cpp b/libopie2/opiecore/oinputsystem.cpp
index 29de35c..d1a28f5 100644
--- a/libopie2/opiecore/oinputsystem.cpp
+++ b/libopie2/opiecore/oinputsystem.cpp
@@ -147,13 +147,16 @@ QString OInputDevice::uniq() const
bool OInputDevice::hasFeature( Feature bit ) const
{
BIT_MASK( features, EV_MAX );
if( ioctl( _fd, EVIOCGBIT( 0, EV_MAX ), features) < 0 )
+ {
+ perror( "EVIOCGBIT" );
return false;
+ }
else
return BIT_TEST( features, bit );
}
bool OInputDevice::isHeld( Key bit ) const
@@ -167,6 +170,28 @@ bool OInputDevice::isHeld( Key bit ) const
}
else
{
return BIT_TEST( keys, bit );
}
}
+
+
+QString OInputDevice::globalKeyMask() const
+{
+ BIT_MASK( keys, KEY_MAX );
+
+ if( ioctl( _fd, EVIOCGKEY( sizeof(keys) ), keys ) < 0 )
+ {
+ perror( "EVIOCGKEY" );
+ }
+ else
+ {
+ QString keymask;
+ for ( int i = 0; i < KEY_MAX; ++i )
+ {
+ if ( BIT_TEST( keys, i ) ) keymask.append( QString().sprintf( "%0d, ", i ) );
+ }
+ return keymask;
+
+ }
+}
+