summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Rogalsky <ed.rogalsky@googlemail.com>2014-03-03 21:55:20 (GMT)
committerEd Rogalsky <ed.rogalsky@googlemail.com>2014-03-03 21:55:20 (GMT)
commit64834d517d243b2a7672080453324bf8872ed60d (patch)
tree136a8d4acff681e74d73897ef38bad2efbea0c7d
parentfabec436114bfe0a226453fc2c5ad2eb85cb54a0 (diff)
jogshuttle: keys count method added to jogshuttle
-rw-r--r--src/jogshuttle.cpp13
-rw-r--r--src/jogshuttle.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp
index 4506985..a005080 100644
--- a/src/jogshuttle.cpp
+++ b/src/jogshuttle.cpp
@@ -420,6 +420,19 @@ DeviceMap JogShuttle::enumerateDevices(const QString& devPath)
return devs;
}
+int JogShuttle::keysCount(const QString& devPath)
+{
+ struct media_ctrl mc;
+ int keysCount = 0;
+
+ QString fileLink = enumerateDevice(devPath);
+ media_ctrl_open2(&mc, (char*)fileLink.toUtf8().data());
+ if (mc.fd > 0 && mc.device) {
+ keysCount = media_ctrl_get_keys_count(&mc);
+ }
+
+ return keysCount;
+}
// #include "jogshuttle.moc"
diff --git a/src/jogshuttle.h b/src/jogshuttle.h
index dbcd179..2533dcd 100644
--- a/src/jogshuttle.h
+++ b/src/jogshuttle.h
@@ -70,6 +70,7 @@ public:
void initDevice(const QString &device);
static QString enumerateDevice(const QString& device);
static DeviceMap enumerateDevices(const QString& devPath);
+ static int keysCount(const QString& devPath);
protected:
virtual void customEvent(QEvent * e);