diff options
author | Andrew Duggan <aduggan@synaptics.com> | 2016-05-17 13:30:06 -0700 |
---|---|---|
committer | Andrew Duggan <aduggan@synaptics.com> | 2016-05-17 13:30:49 -0700 |
commit | f5c049f2f81e296448b33d1a25b4a00b55b314a3 (patch) | |
tree | 9adeb7e0d74ee22fba980b803ba8647cac800b8f | |
parent | 8efee6b49cdcc97054a49f05434e58c1a8ee7ec6 (diff) | |
download | rmi4utils-f5c049f2f81e296448b33d1a25b4a00b55b314a3.tar.gz |
Make sure the RMIDevice's members are cleared on close
-rw-r--r-- | rmidevice/hiddevice.cpp | 2 | ||||
-rw-r--r-- | rmidevice/rmidevice.cpp | 9 | ||||
-rw-r--r-- | rmidevice/rmidevice.h | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/rmidevice/hiddevice.cpp b/rmidevice/hiddevice.cpp index be1071d..f57c8d8 100644 --- a/rmidevice/hiddevice.cpp +++ b/rmidevice/hiddevice.cpp @@ -385,6 +385,8 @@ int HIDDevice::SetMode(int mode) void HIDDevice::Close() { + RMIDevice::Close(); + if (!m_deviceOpen) return; diff --git a/rmidevice/rmidevice.cpp b/rmidevice/rmidevice.cpp index 6926304..668301c 100644 --- a/rmidevice/rmidevice.cpp +++ b/rmidevice/rmidevice.cpp @@ -206,6 +206,15 @@ int RMIDevice::QueryBasicProperties() return 0; } +void RMIDevice::Close() +{ + m_functionList.clear(); + m_bCancel = false; + m_bytesPerReadRequest = 0; + m_page = -1; + m_deviceType = RMI_DEVICE_TYPE_ANY; +} + void RMIDevice::PrintProperties() { fprintf(stdout, "manufacturerID:\t\t%d\n", m_manufacturerID); diff --git a/rmidevice/rmidevice.h b/rmidevice/rmidevice.h index c8abdca..7959801 100644 --- a/rmidevice/rmidevice.h +++ b/rmidevice/rmidevice.h @@ -51,7 +51,7 @@ public: virtual int GetAttentionReport(struct timeval * timeout, unsigned int source_mask, unsigned char *buf, unsigned int *len) { return -1; /* Unsupported */ } - virtual void Close() = 0; + virtual void Close(); virtual void Cancel() { m_bCancel = true; } virtual void RebindDriver() = 0; |