Browse Source

Merge branch 'bfgminer' of https://github.com/luke-jr/bfgminer into bfgminer

Jason Hughes 12 years ago
parent
commit
1ec0a60b0a
3 changed files with 52 additions and 23 deletions
  1. 9 3
      driver-hashbuster2.c
  2. 18 0
      lowl-vcom.c
  3. 25 20
      miner.c

+ 9 - 3
driver-hashbuster2.c

@@ -156,9 +156,15 @@ bool hashbuster2_lowl_probe(const struct lowlevel_device_info * const info)
 		applogr(false, LOG_DEBUG, "%s: Wrong VID/PID", __func__);
 	
 	libusb_device *dev = info->lowl_data;
-	libusb_open(dev, &h);
-	libusb_set_configuration(h, 1);
-	libusb_claim_interface(h, 0);
+	if ( (j = libusb_open(dev, &h)) )
+		applogr(false, LOG_ERR, "%s: Failed to open device with serial \"%s\": %s",
+		        __func__, serial, bfg_strerror(j, BST_LIBUSB));
+	if ( (j = libusb_set_configuration(h, 1)) )
+		applogr(false, LOG_ERR, "%s: Failed to set configuration 1 on serial \"%s\": %s",
+		        __func__, serial, bfg_strerror(j, BST_LIBUSB));
+	if ( (j = libusb_claim_interface(h, 0)) )
+		applogr(false, LOG_ERR, "%s: Failed to claim interface 0 on serial \"%s\": %s",
+		        __func__, serial, bfg_strerror(j, BST_LIBUSB));
 	struct lowl_usb_endpoint * const ep = usb_open_ep_pair(h, 0x81, 64, 0x01, 64);
 	usb_ep_set_timeouts_ms(ep, 100, 0);
 	

+ 18 - 0
lowl-vcom.c

@@ -643,6 +643,23 @@ extern void _vcom_devinfo_scan_querydosdevice(struct lowlevel_device_info **);
 extern void _vcom_devinfo_scan_lsdev(struct lowlevel_device_info **);
 #endif
 
+void _vcom_devinfo_scan_user(struct lowlevel_device_info ** const devinfo_list)
+{
+	struct string_elist *sd_iter, *sd_tmp;
+	DL_FOREACH_SAFE(scan_devices, sd_iter, sd_tmp)
+	{
+		const char * const dname = sd_iter->string;
+		const char * const colon = strpbrk(dname, ":@");
+		const char *dev;
+		if (!(colon && colon != dname))
+			dev = dname;
+		else
+			dev = &colon[1];
+		if (!access(dev, F_OK))
+			_vcom_devinfo_findorcreate(devinfo_list, dev);
+	}
+}
+
 extern bool lowl_usb_attach_kernel_driver(const struct lowlevel_device_info *);
 
 bool vcom_lowl_probe_wrapper(const struct lowlevel_device_info * const info, detectone_func_t detectone)
@@ -744,6 +761,7 @@ struct lowlevel_device_info *vcom_devinfo_scan()
 #else
 	_vcom_devinfo_scan_lsdev(&devinfo_hash);
 #endif
+	_vcom_devinfo_scan_user(&devinfo_hash);
 	
 	// Convert hash to simple list
 	HASH_ITER(hh, devinfo_hash, devinfo, tmp)

+ 25 - 20
miner.c

@@ -3481,6 +3481,10 @@ static void text_print_status(int thr_id)
 #ifdef HAVE_CURSES
 static int attr_bad = A_BOLD;
 
+#ifdef WIN32
+#define swprintf snwprintf
+#endif
+
 static
 void bfg_waddstr(WINDOW *win, const char *s)
 {
@@ -3618,12 +3622,26 @@ static void curses_print_status(const int ts)
 		);
 	}
 	wattroff(statuswin, A_BOLD);
-	wmove(statuswin, 5, 1);
-	bfg_waddstr(statuswin, statusline);
-	wclrtoeol(statuswin);
+	
+	wattron(statuswin, menu_attr);
+	cg_mvwprintw(statuswin, 1, 0, " [M]anage devices [P]ool management [S]ettings [D]isplay options  [H]elp [Q]uit ");
+	wattroff(statuswin, menu_attr);
 
+	if ((pool_strategy == POOL_LOADBALANCE  || pool_strategy == POOL_BALANCE) && total_pools > 1) {
+		cg_mvwprintw(statuswin, 2, 0, " Connected to multiple pools with%s block change notify",
+			have_longpoll ? "": "out");
+	} else if (pool->has_stratum) {
+		cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with stratum as user %s",
+			pool->sockaddr_url, pool->diff, pool->rpc_user);
+	} else {
+		cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with%s LP as user %s",
+			pool->sockaddr_url, pool->diff, have_longpoll ? "": "out", pool->rpc_user);
+	}
+	wclrtoeol(statuswin);
+	cg_mvwprintw(statuswin, 3, 0, " Block: %s  Diff:%s (%s)  Started: %s",
+		  current_hash, block_diff, net_hashrate, blocktime);
+	
 	income = total_diff_accepted * 3600 * block_subsidy / total_secs / current_diff;
-
 	char bwstr[12], incomestr[13];
 	format_unit3(incomestr, sizeof(incomestr), FUP_BTC, "BTC/hr", H2B_SHORT, income/1e8, -1);
 	cg_mvwprintw(statuswin, 4, 0, " ST:%d  F:%d  NB:%d  AS:%d  BW:[%s]  E:%.2f  I:%s  BS:%s",
@@ -3639,19 +3657,10 @@ static void curses_print_status(const int ts)
 		incomestr,
 		best_share);
 	wclrtoeol(statuswin);
-	if ((pool_strategy == POOL_LOADBALANCE  || pool_strategy == POOL_BALANCE) && total_pools > 1) {
-		cg_mvwprintw(statuswin, 2, 0, " Connected to multiple pools with%s block change notify",
-			have_longpoll ? "": "out");
-	} else if (pool->has_stratum) {
-		cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with stratum as user %s",
-			pool->sockaddr_url, pool->diff, pool->rpc_user);
-	} else {
-		cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with%s LP as user %s",
-			pool->sockaddr_url, pool->diff, have_longpoll ? "": "out", pool->rpc_user);
-	}
+	
+	mvwaddstr(statuswin, 5, 0, " ");
+	bfg_waddstr(statuswin, statusline);
 	wclrtoeol(statuswin);
-	cg_mvwprintw(statuswin, 3, 0, " Block: %s  Diff:%s (%s)  Started: %s",
-		  current_hash, block_diff, net_hashrate, blocktime);
 	
 	logdiv = statusy - 1;
 	bfg_hline(statuswin, 6);
@@ -3671,10 +3680,6 @@ static void curses_print_status(const int ts)
 		mvwadd_wch(statuswin, logdiv, offset, WACS_BTEE);
 	}
 #endif
-	
-	wattron(statuswin, menu_attr);
-	cg_mvwprintw(statuswin, 1, 0, " [M]anage devices [P]ool management [S]ettings [D]isplay options  [H]elp [Q]uit ");
-	wattroff(statuswin, menu_attr);
 }
 
 static void adj_width(int var, int *length)