aboutsummaryrefslogtreecommitdiff
path: root/src/device/device_io_hid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/device/device_io_hid.cpp')
-rw-r--r--src/device/device_io_hid.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/device/device_io_hid.cpp b/src/device/device_io_hid.cpp
index 1aadfb9ea..36c7a241b 100644
--- a/src/device/device_io_hid.cpp
+++ b/src/device/device_io_hid.cpp
@@ -148,7 +148,7 @@ namespace hw {
return this->usb_device != NULL;
}
- int device_io_hid::exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len) {
+ int device_io_hid::exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input) {
unsigned char buffer[400];
unsigned char padding_buffer[MAX_BLOCK+1];
unsigned int result;
@@ -177,7 +177,11 @@ namespace hw {
//get first response
memset(buffer, 0, sizeof(buffer));
- hid_ret = hid_read_timeout(this->usb_device, buffer, MAX_BLOCK, this->timeout);
+ if (!user_input) {
+ hid_ret = hid_read_timeout(this->usb_device, buffer, MAX_BLOCK, this->timeout);
+ } else {
+ hid_ret = hid_read(this->usb_device, buffer, MAX_BLOCK);
+ }
ASSERT_X(hid_ret>=0, "Unable to read hidapi response. Error "+std::to_string(result)+": "+ safe_hid_error(this->usb_device));
result = (unsigned int)hid_ret;
io_hid_log(1, buffer, result);