Browse Source

Merge branch 'uniscan' into bfgminer

Luke Dashjr 12 years ago
parent
commit
73e2bd192f
2 changed files with 25 additions and 2 deletions
  1. 23 2
      deviceapi.c
  2. 2 0
      miner.c

+ 23 - 2
deviceapi.c

@@ -28,6 +28,7 @@
 #include "deviceapi.h"
 #include "deviceapi.h"
 #include "fpgautils.h"
 #include "fpgautils.h"
 #include "logging.h"
 #include "logging.h"
+#include "lowlevel.h"
 #include "miner.h"
 #include "miner.h"
 #include "util.h"
 #include "util.h"
 
 
@@ -802,6 +803,18 @@ bool add_cgpu_slave(struct cgpu_info *cgpu, struct cgpu_info *prev_cgpu)
 	return true;
 	return true;
 }
 }
 
 
+#ifdef HAVE_FPGAUTILS
+bool _serial_detect_all(struct lowlevel_device_info * const info, void * const userp)
+{
+	detectone_func_t detectone = userp;
+	
+	if (serial_claim(info->path, NULL))
+		applogr(false, LOG_DEBUG, "%s is already claimed... skipping probes", info->path);
+	
+	return detectone(info->path);
+}
+#endif
+
 int _serial_detect(struct device_drv *api, detectone_func_t detectone, autoscan_func_t autoscan, int flags)
 int _serial_detect(struct device_drv *api, detectone_func_t detectone, autoscan_func_t autoscan, int flags)
 {
 {
 	struct string_elist *iter, *tmp;
 	struct string_elist *iter, *tmp;
@@ -810,6 +823,7 @@ int _serial_detect(struct device_drv *api, detectone_func_t detectone, autoscan_
 	char found = 0;
 	char found = 0;
 	bool forceauto = flags & 1;
 	bool forceauto = flags & 1;
 	bool hasname;
 	bool hasname;
+	bool doall = false;
 	size_t namel = strlen(api->name);
 	size_t namel = strlen(api->name);
 	size_t dnamel = strlen(api->dname);
 	size_t dnamel = strlen(api->dname);
 
 
@@ -841,6 +855,9 @@ int _serial_detect(struct device_drv *api, detectone_func_t detectone, autoscan_
 		else
 		else
 		if (!detectone)
 		if (!detectone)
 		{}  // do nothing
 		{}  // do nothing
+		else
+		if (!strcmp(dev, "all"))
+			doall = true;
 #ifdef HAVE_FPGAUTILS
 #ifdef HAVE_FPGAUTILS
 		else
 		else
 		if (serial_claim(dev, NULL))
 		if (serial_claim(dev, NULL))
@@ -851,12 +868,16 @@ int _serial_detect(struct device_drv *api, detectone_func_t detectone, autoscan_
 #endif
 #endif
 		else if (detectone(dev)) {
 		else if (detectone(dev)) {
 			string_elist_del(&scan_devices, iter);
 			string_elist_del(&scan_devices, iter);
-			inhibitauto = true;
 			++found;
 			++found;
 		}
 		}
 	}
 	}
 
 
-	if ((forceauto || !inhibitauto) && autoscan)
+#ifdef HAVE_FPGAUTILS
+	if (doall && detectone)
+		found += lowlevel_detect_id(_serial_detect_all, detectone, &lowl_vcom, 0, 0);
+#endif
+	
+	if ((forceauto || !(inhibitauto || found)) && autoscan)
 		found += autoscan();
 		found += autoscan();
 
 
 	return found;
 	return found;

+ 2 - 0
miner.c

@@ -889,6 +889,7 @@ char *set_request_diff(const char *arg, float *p)
 
 
 extern struct lowlevel_device_info *_vcom_devinfo_findorcreate(struct lowlevel_device_info **, const char *);
 extern struct lowlevel_device_info *_vcom_devinfo_findorcreate(struct lowlevel_device_info **, const char *);
 
 
+#ifdef FPGAUTILS_H
 #ifdef WIN32
 #ifdef WIN32
 void _vcom_devinfo_scan_querydosdevice(struct lowlevel_device_info ** const devinfo_list)
 void _vcom_devinfo_scan_querydosdevice(struct lowlevel_device_info ** const devinfo_list)
 {
 {
@@ -948,6 +949,7 @@ trydev:
 	closedir(D);
 	closedir(D);
 }
 }
 #endif
 #endif
+#endif
 
 
 static char *add_serial(const char *arg)
 static char *add_serial(const char *arg)
 {
 {