Browse Source

modminer: Convert to lowl_probe

Luke Dashjr 12 years ago
parent
commit
d4464eacf8
1 changed files with 12 additions and 10 deletions
  1. 12 10
      driver-modminer.c

+ 12 - 10
driver-modminer.c

@@ -22,6 +22,7 @@
 #include "logging.h"
 #include "logging.h"
 #include "miner.h"
 #include "miner.h"
 #include "fpgautils.h"
 #include "fpgautils.h"
+#include "lowlevel.h"
 #include "util.h"
 #include "util.h"
 
 
 #define BITSTREAM_FILENAME "fpgaminer_x6500-overclocker-0402.bit"
 #define BITSTREAM_FILENAME "fpgaminer_x6500-overclocker-0402.bit"
@@ -100,6 +101,12 @@ _bailout(int fd, struct cgpu_info*modminer, int prio, const char *fmt, ...)
 // 45 noops sent when detecting, in case the device was left in "start job" reading
 // 45 noops sent when detecting, in case the device was left in "start job" reading
 static const char NOOP[] = MODMINER_PING "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
 static const char NOOP[] = MODMINER_PING "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
 
 
+static
+bool modminer_lowl_match(const struct lowlevel_device_info * const info)
+{
+	return lowlevel_match_lowlproduct(info, &lowl_vcom, "ModMiner");
+}
+
 static bool
 static bool
 modminer_detect_one(const char *devpath)
 modminer_detect_one(const char *devpath)
 {
 {
@@ -159,16 +166,10 @@ modminer_detect_one(const char *devpath)
 
 
 #undef bailout
 #undef bailout
 
 
-static int
-modminer_detect_auto()
-{
-	return serial_autodetect(modminer_detect_one, "ModMiner");
-}
-
-static void
-modminer_detect()
+static
+bool modminer_lowl_probe(const struct lowlevel_device_info * const info)
 {
 {
-	serial_detect_auto(&modminer_drv, modminer_detect_one, modminer_detect_auto);
+	return vcom_lowl_probe_wrapper(info, modminer_detect_one);
 }
 }
 
 
 #define bailout(...)  return _bailout(-1, modminer, __VA_ARGS__);
 #define bailout(...)  return _bailout(-1, modminer, __VA_ARGS__);
@@ -846,7 +847,8 @@ void modminer_wlogprint_status(struct cgpu_info *cgpu)
 struct device_drv modminer_drv = {
 struct device_drv modminer_drv = {
 	.dname = "modminer",
 	.dname = "modminer",
 	.name = "MMQ",
 	.name = "MMQ",
-	.drv_detect = modminer_detect,
+	.lowl_match = modminer_lowl_match,
+	.lowl_probe = modminer_lowl_probe,
 	.override_statline_temp2 = get_modminer_upload_percent,
 	.override_statline_temp2 = get_modminer_upload_percent,
 	.get_stats = modminer_get_stats,
 	.get_stats = modminer_get_stats,
 	.get_api_extra_device_status = get_modminer_drv_extra_device_status,
 	.get_api_extra_device_status = get_modminer_drv_extra_device_status,