aboutsummaryrefslogtreecommitdiff
path: root/rmidevice/hiddevice.h
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2017-03-27 19:53:45 -0700
committerAndrew Duggan <aduggan@synaptics.com>2017-03-30 09:53:39 -0700
commit1db0d35356ff384a4114f6b30aad9a9d0e89f4dc (patch)
tree2b6a89d436a80cadef6f79e308fe50347c08d9f3 /rmidevice/hiddevice.h
parent3781959e23f79fec610e87cfbc3a43c6b24ea7ba (diff)
downloadrmi4utils-1db0d35356ff384a4114f6b30aad9a9d0e89f4dc.tar.gz
For HID devices restore the original operating mode on close
Diffstat (limited to 'rmidevice/hiddevice.h')
-rw-r--r--rmidevice/hiddevice.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/rmidevice/hiddevice.h b/rmidevice/hiddevice.h
index f3a88f0..2c794c7 100644
--- a/rmidevice/hiddevice.h
+++ b/rmidevice/hiddevice.h
@@ -22,6 +22,12 @@
#include <string>
#include "rmidevice.h"
+enum rmi_hid_mode_type {
+ HID_RMI4_MODE_MOUSE = 0,
+ HID_RMI4_MODE_ATTN_REPORTS = 1,
+ HID_RMI4_MODE_NO_PACKED_ATTN_REPORTS = 2,
+};
+
class HIDDevice : public RMIDevice
{
public:
@@ -30,7 +36,9 @@ public:
m_inputReportSize(0),
m_outputReportSize(0),
m_featureReportSize(0),
- m_deviceOpen(false)
+ m_deviceOpen(false),
+ m_mode(HID_RMI4_MODE_ATTN_REPORTS),
+ m_initialMode(HID_RMI4_MODE_MOUSE)
{}
virtual int Open(const char * filename);
virtual int Read(unsigned short addr, unsigned char *buf,
@@ -69,12 +77,16 @@ private:
bool m_deviceOpen;
+ rmi_hid_mode_type m_mode;
+ rmi_hid_mode_type m_initialMode;
+
int GetReport(int *reportId, struct timeval * timeout = NULL);
void PrintReport(const unsigned char *report);
void ParseReportDescriptor();
// static HID utility functions
static bool LookupHidDeviceName(int bus, int vendorId, int productId, std::string &deviceName);
+ static bool LookupHidDriverName(std::string &deviceName, std::string &driverName);
static bool FindTransportDevice(int bus, std::string & hidDeviceName,
std::string & transportDeviceName, std::string & driverPath);
static bool WaitForHidRawDevice(int notifyFd, std::string & deviceName, std::string & hidraw);