usb add a numeric sub-indentity for each name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
diff --git a/driver-bflsc.c b/driver-bflsc.c
index a532e0d..9c1528c 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -897,17 +897,20 @@ reinit:
sc_info->scan_sleep_time = BAM_SCAN_TIME;
sc_info->results_sleep_time = BAM_RES_TIME;
sc_info->default_ms_work = BAM_WORK_TIME;
+ bflsc->usbdev->ident = IDENT_BAM;
} else {
if (sc_info->sc_devs[0].engines < 34) { // 16 * 2 + 2
newname = BFLSC_JALAPENO;
sc_info->scan_sleep_time = BAJ_SCAN_TIME;
sc_info->results_sleep_time = BAJ_RES_TIME;
sc_info->default_ms_work = BAJ_WORK_TIME;
+ bflsc->usbdev->ident = IDENT_BAJ;
} else if (sc_info->sc_devs[0].engines < 130) { // 16 * 8 + 2
newname = BFLSC_LITTLESINGLE;
sc_info->scan_sleep_time = BAL_SCAN_TIME;
sc_info->results_sleep_time = BAL_RES_TIME;
sc_info->default_ms_work = BAL_WORK_TIME;
+ bflsc->usbdev->ident = IDENT_BAL;
}
}
diff --git a/usbutils.c b/usbutils.c
index 2d286d1..4d51dcf 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -123,6 +123,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_BFLSC,
.name = "BAS",
+ .ident = IDENT_BAS,
.idVendor = IDVENDOR_FTDI,
.idProduct = 0x6014,
.iManufacturer = "Butterfly Labs",
@@ -138,6 +139,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_BITFORCE,
.name = "BFL",
+ .ident = IDENT_BFL,
.idVendor = IDVENDOR_FTDI,
.idProduct = 0x6014,
.iManufacturer = "Butterfly Labs Inc.",
@@ -153,6 +155,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_MODMINER,
.name = "MMQ",
+ .ident = IDENT_MMQ,
.idVendor = 0x1fc9,
.idProduct = 0x0003,
.kernel = 0,
@@ -166,6 +169,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_AVALON,
.name = "AVA",
+ .ident = IDENT_AVA,
.idVendor = IDVENDOR_FTDI,
.idProduct = 0x6001,
.kernel = 0,
@@ -179,6 +183,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ICARUS,
.name = "ICA",
+ .ident = IDENT_ICA,
.idVendor = 0x067b,
.idProduct = 0x2303,
.kernel = 0,
@@ -190,6 +195,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ICARUS,
.name = "AMU",
+ .ident = IDENT_AMU,
.idVendor = 0x10c4,
.idProduct = 0xea60,
.kernel = 0,
@@ -201,6 +207,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ICARUS,
.name = "BLT",
+ .ident = IDENT_BLT,
.idVendor = IDVENDOR_FTDI,
.idProduct = 0x6001,
.iProduct = "FT232R USB UART",
@@ -214,6 +221,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ICARUS,
.name = "LLT",
+ .ident = IDENT_LLT,
.idVendor = IDVENDOR_FTDI,
.idProduct = 0x6001,
.kernel = 0,
@@ -225,6 +233,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ICARUS,
.name = "CMR",
+ .ident = IDENT_CMR,
.idVendor = 0x067b,
.idProduct = 0x0230,
.iProduct = "Cairnsmore1",
@@ -241,6 +250,7 @@ static struct usb_find_devices find_dev[] = {
{
.drv = DRV_ZTEX,
.name = "ZTX",
+ .ident = IDENT_ZTX,
.idVendor = 0x221a,
.idProduct = 0x0100,
.kernel = 0,
@@ -250,7 +260,7 @@ static struct usb_find_devices find_dev[] = {
.epcount = 0,
.eps = NULL },
#endif
- { DRV_LAST, NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL }
+ { DRV_LAST, NULL, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL }
};
#ifdef USE_BFLSC
@@ -1335,6 +1345,8 @@ static int _usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct u
if (found->idVendor == IDVENDOR_FTDI)
cgusb->usb_type = USB_TYPE_FTDI;
+ cgusb->ident = found->ident;
+
cgusb->descriptor = calloc(1, sizeof(*(cgusb->descriptor)));
err = libusb_get_device_descriptor(dev, cgusb->descriptor);
diff --git a/usbutils.h b/usbutils.h
index 64a4546..ed82ac6 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -50,9 +50,26 @@ struct usb_endpoints {
bool found;
};
+enum sub_ident {
+ IDENT_BAJ,
+ IDENT_BAL,
+ IDENT_BAS,
+ IDENT_BAM,
+ IDENT_BFL,
+ IDENT_MMQ,
+ IDENT_AVA,
+ IDENT_ICA,
+ IDENT_AMU,
+ IDENT_BLT,
+ IDENT_LLT,
+ IDENT_CMR,
+ IDENT_ZTX
+};
+
struct usb_find_devices {
int drv;
const char *name;
+ enum sub_ident ident;
uint16_t idVendor;
uint16_t idProduct;
char *iManufacturer;
@@ -75,8 +92,9 @@ struct cg_usb_device {
libusb_device_handle *handle;
pthread_mutex_t *mutex;
struct libusb_device_descriptor *descriptor;
- uint16_t usbver;
enum usb_types usb_type;
+ enum sub_ident ident;
+ uint16_t usbver;
int speed;
char *prod_string;
char *manuf_string;