Browse Source

Merge commit '1a4cfde' into bfgminer-2.10.x

Luke Dashjr 13 years ago
parent
commit
080cf2ac00
1 changed files with 14 additions and 7 deletions
  1. 14 7
      miner.c

+ 14 - 7
miner.c

@@ -160,6 +160,11 @@ bool use_curses = true;
 #else
 #else
 bool use_curses;
 bool use_curses;
 #endif
 #endif
+#ifdef HAVE_LIBUSB
+bool have_libusb = true;
+#else
+const bool have_libusb;
+#endif
 static bool opt_submit_stale = true;
 static bool opt_submit_stale = true;
 static int opt_shares;
 static int opt_shares;
 static int opt_submit_threads = 0x40;
 static int opt_submit_threads = 0x40;
@@ -7441,6 +7446,7 @@ static void clean_up(void)
 	clear_adl(nDevs);
 	clear_adl(nDevs);
 #endif
 #endif
 #ifdef HAVE_LIBUSB
 #ifdef HAVE_LIBUSB
+	if (likely(have_libusb))
         libusb_exit(NULL);
         libusb_exit(NULL);
 #endif
 #endif
 
 
@@ -7798,9 +7804,8 @@ int main(int argc, char *argv[])
 #ifdef HAVE_LIBUSB
 #ifdef HAVE_LIBUSB
 	int err = libusb_init(NULL);
 	int err = libusb_init(NULL);
 	if (err) {
 	if (err) {
-		fprintf(stderr, "libusb_init() failed err %d", err);
-		fflush(stderr);
-		quit(1, "libusb_init() failed");
+		applog(LOG_WARNING, "libusb_init() failed err %d", err);
+		have_libusb = false;
 	}
 	}
 #endif
 #endif
 
 
@@ -7915,7 +7920,8 @@ int main(int argc, char *argv[])
 	}
 	}
 
 
 #ifdef USE_X6500
 #ifdef USE_X6500
-	ft232r_scan();
+	if (likely(have_libusb))
+		ft232r_scan();
 #endif
 #endif
 
 
 #ifdef HAVE_CURSES
 #ifdef HAVE_CURSES
@@ -8021,12 +8027,12 @@ int main(int argc, char *argv[])
 #endif
 #endif
 
 
 #ifdef USE_X6500
 #ifdef USE_X6500
-	if (!opt_scrypt)
+	if (likely(have_libusb) && !opt_scrypt)
 		x6500_api.api_detect();
 		x6500_api.api_detect();
 #endif
 #endif
 
 
 #ifdef USE_ZTEX
 #ifdef USE_ZTEX
-	if (!opt_scrypt)
+	if (likely(have_libusb) && !opt_scrypt)
 		ztex_api.api_detect();
 		ztex_api.api_detect();
 #endif
 #endif
 
 
@@ -8035,7 +8041,8 @@ int main(int argc, char *argv[])
 #endif
 #endif
 
 
 #ifdef USE_X6500
 #ifdef USE_X6500
-	ft232r_scan_free();
+	if (likely(have_libusb))
+		ft232r_scan_free();
 #endif
 #endif
 
 
 	for (i = 0; i < total_devices; ++i)
 	for (i = 0; i < total_devices; ++i)