Browse Source

Accept "@" separator for serial/path in --scan to match --device and --set-device better

Luke Dashjr 12 years ago
parent
commit
ec164d2698
2 changed files with 8 additions and 6 deletions
  1. 3 3
      README
  2. 5 3
      miner.c

+ 3 - 3
README

@@ -337,9 +337,9 @@ On Windows, <arg> is usually of the format \\.\COMn
 
 The official supplied binaries are compiled with support for all ASICs/FPGAs.
 To force the code to only attempt detection with a specific driver,
-prepend the argument with the driver name followed by a colon.
-For example, "icarus:/dev/ttyUSB0" or "bitforce:\\.\COM5"
-or using the short name: "ica:/dev/ttyUSB0" or "bfl:\\.\COM5"
+prepend the argument with the driver name followed by an "at" symbol.
+For example, "icarus@/dev/ttyUSB0" or "bitforce@\\.\COM5"
+or using the short name: "ica@/dev/ttyUSB0" or "bfl@\\.\COM5"
 
 Some FPGAs do not have non-volatile storage for their bitstreams and must be
 programmed every power cycle, including first use. To use these devices, you

+ 5 - 3
miner.c

@@ -10435,8 +10435,8 @@ void *probe_device_thread(void *p)
 	DL_FOREACH_SAFE(scan_devices, sd_iter, sd_tmp)
 	{
 		const char * const dname = sd_iter->string;
-		const char * const colon = strchr(dname, ':');
-		if (!colon)
+		const char * const colon = strpbrk(dname, ":@");
+		if (!(colon && colon != dname))
 			continue;
 		const char * const ser = &colon[1];
 		LL_FOREACH2(infolist, info, same_devid_next)
@@ -10460,6 +10460,7 @@ void *probe_device_thread(void *p)
 		DL_FOREACH_SAFE(scan_devices, sd_iter, sd_tmp)
 		{
 			const char * const dname = sd_iter->string;
+			// NOTE: Only checking flags here, NOT path/serial, so @ is unacceptable
 			const char *colon = strchr(dname, ':');
 			if (!colon)
 				colon = &dname[-1];
@@ -10489,6 +10490,7 @@ void *probe_device_thread(void *p)
 	DL_FOREACH_SAFE(scan_devices, sd_iter, sd_tmp)
 	{
 		const char * const dname = sd_iter->string;
+		// NOTE: Only checking flags here, NOT path/serial, so @ is unacceptable
 		const char * const colon = strchr(dname, ':');
 		if (!colon)
 		{
@@ -10498,7 +10500,7 @@ void *probe_device_thread(void *p)
 #ifdef NEED_BFG_LOWL_VCOM
 					(info->lowl == &lowl_vcom && !strcasecmp(dname, "all")) ||
 #endif
-					_probe_device_match(info, dname))
+					_probe_device_match(info, (dname[0] == '@') ? &dname[1] : dname))
 				{
 					BFG_FOREACH_DRIVER_BY_PRIORITY(dreg, dreg_tmp)
 					{