commit 92a86ad93f305238ce2f4b98f08e0f0e74265e40
parent 17f651981597f1f537338d2f7451e9466b345ced
Author: Brian Swetland <swetland@frotz.net>
Date: Tue, 4 Aug 2015 17:40:38 -0700
usb: clear halt condition at start
This ensures host and device data toggles match, which makes a big
difference on OSX which manages to always get them out of sync when
you exit the program...
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/usb.c b/tools/usb.c
@@ -73,6 +73,13 @@ usb_handle *usb_open(unsigned vid, unsigned pid, unsigned ifc) {
goto close_fail;
}
+#ifdef __APPLE__
+ // make sure everyone's data toggles agree
+ // makes things worse on Linux, but happy on OSX
+ libusb_clear_halt(usb->dev, usb->ei);
+ libusb_clear_halt(usb->dev, usb->eo);
+#endif
+
return usb;
close_fail: