Browse Source

A quick flag to allow drivers to convey the desire to rescan devices (from lowlevel up)

Luke Dashjr 12 years ago
parent
commit
fd7d89dfef
2 changed files with 13 additions and 0 deletions
  1. 2 0
      deviceapi.h
  2. 11 0
      miner.c

+ 2 - 0
deviceapi.h

@@ -34,6 +34,8 @@ extern void _bfg_register_driver(const struct device_drv *);
 	}                                           \
 // END BFG_REGISTER_DRIVER
 
+extern bool bfg_need_detect_rescan;
+
 extern void request_work(struct thr_info *);
 extern struct work *get_work(struct thr_info *);
 extern bool hashes_done(struct thr_info *, int64_t hashes, struct timeval *tvp_hashes, uint32_t *max_nonce);

+ 11 - 0
miner.c

@@ -10112,9 +10112,14 @@ extern void setup_pthread_cancel_workaround();
 extern struct sigaction pcwm_orig_term_handler;
 #endif
 
+bool bfg_need_detect_rescan;
+
 static
 void drv_detect_all()
 {
+rescan:
+	bfg_need_detect_rescan = false;
+	
 #ifdef HAVE_BFG_LOWLEVEL
 	lowlevel_scan();
 #endif
@@ -10134,6 +10139,12 @@ void drv_detect_all()
 #ifdef HAVE_BFG_LOWLEVEL
 	lowlevel_scan_free();
 #endif
+	
+	if (bfg_need_detect_rescan)
+	{
+		applog(LOG_DEBUG, "Device rescan requested");
+		goto rescan;
+	}
 }
 
 static