diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-04-24 13:19:46 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-04-26 10:10:30 +0200 |
commit | 214d9db2a3a2c28ee385454f80c53f7fab290bf8 (patch) | |
tree | d2f9bbfd36f87cf019acb23382809854f9a47183 /device.cc | |
parent | 0f0c75ae659400e1df639d9644f58930291e7309 (diff) | |
download | libnitrokey-214d9db2a3a2c28ee385454f80c53f7fab290bf8.tar.gz libnitrokey-214d9db2a3a2c28ee385454f80c53f7fab290bf8.tar.bz2 |
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 <szczepan@nitrokey.com>
Diffstat (limited to 'device.cc')
-rw-r--r-- | device.cc | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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() { |