From 214d9db2a3a2c28ee385454f80c53f7fab290bf8 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 24 Apr 2017 13:19:46 +0200 Subject: Use alternative device connection check Do not use hid_enumarate under OSX Hidapi: do not call event loop on OSX Signed-off-by: Szczepan Zalega --- device.cc | 10 ++++++---- hidapi | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/device.cc b/device.cc index 101ebd0..1c87f7f 100644 --- a/device.cc +++ b/device.cc @@ -145,16 +145,18 @@ bool Device::could_be_enumerated() { if (mp_devhandle==nullptr){ return false; } +#ifndef __APPLE__ auto pInfo = hid_enumerate(m_vid, m_pid); if (pInfo != nullptr){ hid_free_enumeration(pInfo); return true; } return false; - -// alternative: -// unsigned char buf[1]; -// return hid_read_timeout(mp_devhandle, buf, sizeof(buf), 20) != -1; +#else +// alternative for OSX + unsigned char buf[1]; + return hid_read_timeout(mp_devhandle, buf, sizeof(buf), 20) != -1; +#endif } void Device::show_stats() { diff --git a/hidapi b/hidapi index b24dd9c..76ed5c1 160000 --- a/hidapi +++ b/hidapi @@ -1 +1 @@ -Subproject commit b24dd9c36c4aacfd5ba7b1f0277d98bbbee43f1b +Subproject commit 76ed5c1e94a2cfbe0e7da373ac3633289898fb0d -- cgit v1.2.3