Commit 176cae270069806e20649e7bdf371a034ef51a8b

Con Kolivas 2013-10-13T18:42:33

Add basic definitions for hashfast device recognition.

diff --git a/01-cgminer.rules b/01-cgminer.rules
index 89443ad..972468c 100644
--- a/01-cgminer.rules
+++ b/01-cgminer.rules
@@ -27,3 +27,6 @@ ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204b", SUBSYSTEMS=="usb", ACTION=="a
 
 #Klondike
 ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f60a", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev"
+
+#HashFast
+ATTRS{idVendor}=="297c", ATTRS{idProduct}=="0001", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev", ENV{ID_MM_DEVICE_IGNORE}="1"
diff --git a/usbutils.c b/usbutils.c
index 2db31a2..f865a36 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -67,6 +67,7 @@
 #define AVALON_TIMEOUT_MS 999
 #define KLONDIKE_TIMEOUT_MS 999
 #define ICARUS_TIMEOUT_MS 999
+#define HASHFAST_TIMEOUT_MS 999
 #else
 #define BFLSC_TIMEOUT_MS 300
 #define BITFORCE_TIMEOUT_MS 200
@@ -75,6 +76,7 @@
 #define AVALON_TIMEOUT_MS 200
 #define KLONDIKE_TIMEOUT_MS 200
 #define ICARUS_TIMEOUT_MS 200
+#define HASHFAST_TIMEOUT_MS 200
 #endif
 
 #define USB_READ_MINPOLL 40
@@ -134,6 +136,25 @@ static struct usb_intinfo bfu_ints[] = {
 };
 #endif
 
+#ifdef USE_HASHFAST
+#include "driver-hashfast.h"
+
+static struct usb_epinfo hfa0_epinfos[] = {
+	{ LIBUSB_TRANSFER_TYPE_INTERRUPT,	8,	EPI(3), 0, 0, 0 }
+};
+
+static struct usb_epinfo hfa1_epinfos[] = {
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(1), 0, 0, 0 },
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(2), 0, 0, 0 }
+};
+
+/* Default to interface 1 */
+static struct usb_intinfo hfa_ints[] = {
+	USB_EPS(1,  hfa1_epinfos),
+	USB_EPS(0,  hfa0_epinfos)
+};
+#endif
+
 #ifdef USE_MODMINER
 static struct usb_epinfo mmq_epinfos[] = {
 	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(3), 0, 0, 0 },
@@ -325,7 +346,14 @@ static struct usb_find_devices find_dev[] = {
 		.drv = DRIVER_hashfast,
 		.name = "HFA",
 		.ident = IDENT_HFA,
-	},
+		.idVendor = HF_USB_VENDOR_ID,
+		.idProduct = HF_USB_PRODUCT_ID_G1,
+		.iManufacturer = "HashFast LLC",
+		.iProduct = "M1 Module",
+		.config = 1,
+		.timeout = HASHFAST_TIMEOUT_MS,
+		.latency = LATENCY_UNUSED,
+		INTINFO(hfa_ints) },
 #endif
 #ifdef USE_KLONDIKE
 	{
@@ -3191,6 +3219,7 @@ void usb_cleanup(void)
 			case DRIVER_icarus:
 			case DRIVER_avalon:
 			case DRIVER_klondike:
+			case DRIVER_hashfast:
 				DEVWLOCK(cgpu, pstate);
 				release_cgpu(cgpu);
 				DEVWUNLOCK(cgpu, pstate);