Browse Source

Merge branch 'uniscan2' into bfgminer

Luke Dashjr 12 years ago
parent
commit
339c5a9cbc
3 changed files with 11 additions and 16 deletions
  1. 9 2
      lowl-hid.c
  2. 0 13
      mcp2210.c
  3. 2 1
      miner.c

+ 9 - 2
lowl-hid.c

@@ -50,6 +50,7 @@ int HID_API_EXPORT (*dlsym_hid_write)(hid_device *, const unsigned char *, size_
 } while(0)
 
 static bool hidapi_libusb;
+static struct hid_device_info *_probe_hid_enum;
 
 static
 bool hidapi_try_lib(const char * const dlname)
@@ -73,7 +74,7 @@ bool hidapi_try_lib(const char * const dlname)
 		applog(LOG_DEBUG, "%s: Loaded %s, but no devices enumerated; trying other libraries", __func__, dlname);
 		goto fail;
 	}
-	dlsym_hid_free_enumeration(hid_enum);
+	_probe_hid_enum = hid_enum;
 	
 	LOAD_SYM(hid_open_path);
 	LOAD_SYM(hid_close);
@@ -156,7 +157,13 @@ struct lowlevel_device_info *hid_devinfo_scan()
 	struct hid_device_info *hid_enum, *hid_item;
 	struct lowlevel_device_info *info, *devinfo_list = NULL;
 	
-	hid_enum = hid_enumerate(0, 0);
+	if (_probe_hid_enum)
+	{
+		hid_enum = _probe_hid_enum;
+		_probe_hid_enum = NULL;
+	}
+	else
+		hid_enum = hid_enumerate(0, 0);
 	if (!hid_enum)
 	{
 		applog(LOG_DEBUG, "%s: No HID devices found", __func__);

+ 0 - 13
mcp2210.c

@@ -9,19 +9,6 @@
 
 #include "config.h"
 
-#ifndef WIN32
-#include <dlfcn.h>
-typedef void *dlh_t;
-#else
-#include <winsock2.h>
-#include <windows.h>
-#define dlopen(lib, flags) LoadLibrary(lib)
-#define dlsym(h, sym)  ((void*)GetProcAddress(h, sym))
-#define dlerror()  "unknown"
-#define dlclose(h)  FreeLibrary(h)
-typedef HMODULE dlh_t;
-#endif
-
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>

+ 2 - 1
miner.c

@@ -513,7 +513,7 @@ char *devpath_to_devid(const char *devpath)
 		return NULL;
 	devpath += 3;
 	char *p;
-	const int com = strtol(devpath, &p, 10);
+	strtol(devpath, &p, 10);
 	if (p[0])
 		return NULL;
 	const int sz = (p - devpath);
@@ -576,6 +576,7 @@ bool cgpu_match(const char * const pattern, const struct cgpu_info * const cgpu)
 		p2 = (p[0] == '@') ? &p[1] : p;
 		const size_t serlen = (p - ser);
 		p = "";
+		n = 0;
 		const char * const devpath = cgpu->device_path ?: "";
 		const char * const devser = cgpu->dev_serial ?: "";
 		if ((!strncmp(devpath, ser, serlen)) && devpath[serlen] == '\0')