Browse Source

Common hotplug_trigger function to use regardless of platform-specific implementation

Luke Dashjr 12 years ago
parent
commit
985982f62c
1 changed files with 11 additions and 2 deletions
  1. 11 2
      miner.c

+ 11 - 2
miner.c

@@ -11022,6 +11022,15 @@ int scan_serial(const char *s)
 	return create_new_cgpus(_scan_serial, (void*)s);
 }
 
+#ifdef HAVE_BFG_HOTPLUG
+static
+void hotplug_trigger()
+{
+	applog(LOG_DEBUG, "%s: Triggering rescan", __func__);
+	scan_serial(NULL);
+}
+#endif
+
 #if defined(HAVE_LIBUDEV) && defined(HAVE_SYS_EPOLL_H)
 
 static
@@ -11062,7 +11071,7 @@ void *hotplug_thread(__maybe_unused void *p)
 		if (strcmp(action, "add"))
 			continue;
 		
-		scan_serial(NULL);
+		hotplug_trigger();
 	}
 	
 	applogfailr(NULL, LOG_ERR, "epoll_wait");
@@ -11075,7 +11084,7 @@ LRESULT CALLBACK hotplug_win_callback(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
 	if (msg == WM_DEVICECHANGE && wParam == DBT_DEVNODES_CHANGED)
 	{
 		applog(LOG_DEBUG, "%s: Received DBT_DEVNODES_CHANGED event", __func__);
-		scan_serial(NULL);
+		hotplug_trigger();
 	}
 	return DefWindowProc(hwnd, msg, wParam, lParam);
 }