close usb handle after faile (#1352)

old-commit-hash: dd05d1df835a0e7766f15fe7b9bf437988def8cb
This commit is contained in:
Dean Lee
2020-04-14 06:10:47 +08:00
committed by GitHub
parent ea0392cc2a
commit 7c22a08b30
+5
View File
@@ -161,6 +161,11 @@ bool usb_connect() {
ignition_last = false;
if (dev_handle != NULL){
libusb_close(dev_handle);
dev_handle = NULL;
}
dev_handle = libusb_open_device_with_vid_pid(ctx, 0xbbaa, 0xddcc);
if (dev_handle == NULL) { goto fail; }