wugren пре 3 година
родитељ
комит
06a98f8fbf
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      src/HID.cc

+ 4 - 1
src/HID.cc

@@ -210,7 +210,10 @@ HID::recvAsync(uv_work_t* req)
   unsigned char buf[READ_BUFF_MAXSIZE];
   int len = hid_read(hid->_hidHandle, buf, sizeof buf);
   if (len < 0) {
-    iocb->_error = new JSException("could not read from HID device");
+	char buf[1024];
+	memset(buf, 0, sizeof(buf));
+	sprintf(buf, "could not read from HID device. error:%d", GetLastError());
+    iocb->_error = new JSException(buf);
   } else {
     iocb->_data = vector<unsigned char>(buf, buf + len);
   }