From aaa2f0a0bd5ea73ee8cd7049db7563a663f3100f Mon Sep 17 00:00:00 2001
From: Christoph Haag <christoph.haag@collabora.com>
Date: Thu, 7 May 2020 21:21:19 +0200
Subject: [PATCH] d/vive_controller: read from usb with timeout

This aligns with the vive HMD driver and fixes high CPU usage.
---
 src/xrt/drivers/vive/vive_controller_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xrt/drivers/vive/vive_controller_driver.c b/src/xrt/drivers/vive/vive_controller_driver.c
index 70a7c1c52..fa21b0f71 100644
--- a/src/xrt/drivers/vive/vive_controller_driver.c
+++ b/src/xrt/drivers/vive/vive_controller_driver.c
@@ -867,7 +867,8 @@ vive_controller_device_update(struct vive_controller_device *d)
 {
 	uint8_t buf[FEATURE_BUFFER_SIZE];
 	do {
-		int ret = os_hid_read(d->controller_hid, buf, sizeof(buf), 0);
+		int ret =
+		    os_hid_read(d->controller_hid, buf, sizeof(buf), 1000);
 		if (ret < 0) {
 			return ret;
 		}