Skip to content

Instantly share code, notes, and snippets.

@jocover
Created June 13, 2015 10:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jocover/5a29e225ee7460d5f228 to your computer and use it in GitHub Desktop.
Save jocover/5a29e225ee7460d5f228 to your computer and use it in GitHub Desktop.
diff --git "a/C:\\Users\\JIANG_~1\\AppData\\Local\\Temp\\TortoiseGit\\hac7318.tmp\\hackrf-a1b8535-left.c" "b/C:\\Users\\jiang_000\\Desktop\\hackrf\\host\\libhackrf\\src\\hackrf.c"
index 2902a80..53b0259 100644
--- "a/C:\\Users\\JIANG_~1\\AppData\\Local\\Temp\\TortoiseGit\\hac7318.tmp\\hackrf-a1b8535-left.c"
+++ "b/C:\\Users\\jiang_000\\Desktop\\hackrf\\host\\libhackrf\\src\\hackrf.c"
@@ -410,12 +410,15 @@ static int hackrf_open_setup(libusb_device_handle* usb_device, hackrf_device** d
//int speed = libusb_get_device_speed(usb_device);
// TODO: Error or warning if not high speed USB?
-
+ int current_configuration = 0;
+ libusb_get_configuration(usb_device, &current_configuration);
+ if (current_configuration != 1){
result = libusb_set_configuration(usb_device, 1);
- if( result != 0 )
- {
- libusb_close(usb_device);
- return HACKRF_ERROR_LIBUSB;
+ if( result != 0 )
+ {
+ libusb_close(usb_device);
+ return HACKRF_ERROR_LIBUSB;
+ }
}
result = libusb_claim_interface(usb_device, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment