From 18f427f6bf50f64ba3b4b2c1c1dd168f0c8fdb76 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 14 Oct 2016 12:17:50 +0200 Subject: Fixed bug with not releasing device on disconnect Signed-off-by: Szczepan Zalega --- device.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/device.cc b/device.cc index 6660276..a420a64 100644 --- a/device.cc +++ b/device.cc @@ -21,8 +21,10 @@ Device::Device() bool Device::disconnect() { Log::instance()(__PRETTY_FUNCTION__, Loglevel::DEBUG_L2); - hid_exit(); + if(mp_devhandle== nullptr) return false; + hid_close(mp_devhandle); mp_devhandle = NULL; + hid_exit(); return true; } bool Device::connect() { -- cgit v1.2.3