Reuse the DRIVER_ macros to avoid having yet another definition for DRV_
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
diff --git a/usbutils.c b/usbutils.c
index 2a20b7f..bb39618 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -42,36 +42,6 @@
pthread_setcancelstate(_pth_state, NULL); \
} while (0)
-#ifdef USE_BFLSC
-#define DRV_BFLSC 1
-#endif
-
-#ifdef USE_BITFORCE
-#define DRV_BITFORCE 2
-#endif
-
-#ifdef USE_MODMINER
-#define DRV_MODMINER 3
-#endif
-
-#ifdef USE_ZTEX
-#define DRV_ZTEX 4
-#endif
-
-#ifdef USE_ICARUS
-#define DRV_ICARUS 5
-#endif
-
-#ifdef USE_AVALON
-#define DRV_AVALON 6
-#endif
-
-#ifdef USE_BITFURY
-#define DRV_BITFURY 8
-#endif
-
-#define DRV_LAST -1
-
#define USB_CONFIG 1
#ifdef WIN32
@@ -245,7 +215,7 @@ static struct usb_intinfo cmr2_ints[] = {
static struct usb_find_devices find_dev[] = {
#ifdef USE_BFLSC
{
- .drv = DRV_BFLSC,
+ .drv = DRIVER_bflsc,
.name = "BAS",
.ident = IDENT_BAS,
.idVendor = IDVENDOR_FTDI,
@@ -259,7 +229,7 @@ static struct usb_find_devices find_dev[] = {
#endif
#ifdef USE_BITFORCE
{
- .drv = DRV_BITFORCE,
+ .drv = DRIVER_bitforce,
.name = "BFL",
.ident = IDENT_BFL,
.idVendor = IDVENDOR_FTDI,
@@ -273,7 +243,7 @@ static struct usb_find_devices find_dev[] = {
#endif
#ifdef USE_BITFURY
{
- .drv = DRV_BITFURY,
+ .drv = DRIVER_bitfury,
.name = "BF1",
.ident = IDENT_BFU,
.idVendor = 0x03eb,
@@ -288,7 +258,7 @@ static struct usb_find_devices find_dev[] = {
#endif
#ifdef USE_MODMINER
{
- .drv = DRV_MODMINER,
+ .drv = DRIVER_modminer,
.name = "MMQ",
.ident = IDENT_MMQ,
.idVendor = 0x1fc9,
@@ -300,7 +270,7 @@ static struct usb_find_devices find_dev[] = {
#endif
#ifdef USE_AVALON
{
- .drv = DRV_AVALON,
+ .drv = DRIVER_avalon,
.name = "BTB",
.ident = IDENT_BTB,
.idVendor = IDVENDOR_FTDI,
@@ -312,7 +282,7 @@ static struct usb_find_devices find_dev[] = {
.latency = 10,
INTINFO(ava_ints) },
{
- .drv = DRV_AVALON,
+ .drv = DRIVER_avalon,
.name = "AVA",
.ident = IDENT_AVA,
.idVendor = IDVENDOR_FTDI,
@@ -324,7 +294,7 @@ static struct usb_find_devices find_dev[] = {
#endif
#ifdef USE_ICARUS
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "ICA",
.ident = IDENT_ICA,
.idVendor = 0x067b,
@@ -334,7 +304,7 @@ static struct usb_find_devices find_dev[] = {
.latency = LATENCY_UNUSED,
INTINFO(ica_ints) },
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "AMU",
.ident = IDENT_AMU,
.idVendor = 0x10c4,
@@ -344,7 +314,7 @@ static struct usb_find_devices find_dev[] = {
.latency = LATENCY_UNUSED,
INTINFO(amu_ints) },
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "BLT",
.ident = IDENT_BLT,
.idVendor = IDVENDOR_FTDI,
@@ -356,7 +326,7 @@ static struct usb_find_devices find_dev[] = {
INTINFO(llt_ints) },
// For any that don't match the above "BLT"
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "LLT",
.ident = IDENT_LLT,
.idVendor = IDVENDOR_FTDI,
@@ -366,7 +336,7 @@ static struct usb_find_devices find_dev[] = {
.latency = LATENCY_STD,
INTINFO(llt_ints) },
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "CMR",
.ident = IDENT_CMR1,
.idVendor = IDVENDOR_FTDI,
@@ -377,7 +347,7 @@ static struct usb_find_devices find_dev[] = {
.latency = LATENCY_STD,
INTINFO(cmr1_ints) },
{
- .drv = DRV_ICARUS,
+ .drv = DRIVER_icarus,
.name = "CMR",
.ident = IDENT_CMR2,
.idVendor = IDVENDOR_FTDI,
@@ -392,7 +362,7 @@ static struct usb_find_devices find_dev[] = {
// This is here so cgminer -n shows them
// the ztex driver (as at 201303) doesn't use usbutils
{
- .drv = DRV_ZTEX,
+ .drv = DRIVER_ztex,
.name = "ZTX",
.ident = IDENT_ZTX,
.idVendor = 0x221a,
@@ -403,7 +373,7 @@ static struct usb_find_devices find_dev[] = {
.intinfo_count = 0,
.intinfos = NULL },
#endif
- { DRV_LAST, NULL, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, NULL }
+ { DRIVER_MAX, NULL, 0, 0, 0, NULL, NULL, 0, 0, 0, 0, NULL }
};
#define STRBUFLEN 256
@@ -787,7 +757,7 @@ static void usb_full(ssize_t *count, libusb_device *dev, char **buf, size_t *off
if (!opt_usb_list_all) {
bool known = false;
- for (i = 0; find_dev[i].drv != DRV_LAST; i++)
+ for (i = 0; find_dev[i].drv != DRIVER_MAX; i++)
if ((find_dev[i].idVendor == desc.idVendor) &&
(find_dev[i].idProduct == desc.idProduct)) {
known = true;
@@ -1774,7 +1744,7 @@ bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find
int uninitialised_var(ret);
int i;
- for (i = 0; find_dev[i].drv != DRV_LAST; i++) {
+ for (i = 0; find_dev[i].drv != DRIVER_MAX; i++) {
if (find_dev[i].drv == found_match->drv &&
find_dev[i].idVendor == found_match->idVendor &&
find_dev[i].idProduct == found_match->idProduct) {
@@ -1851,7 +1821,7 @@ static struct usb_find_devices *usb_check_each(int drvnum, struct device_drv *dr
struct usb_find_devices *found;
int i;
- for (i = 0; find_dev[i].drv != DRV_LAST; i++)
+ for (i = 0; find_dev[i].drv != DRIVER_MAX; i++)
if (find_dev[i].drv == drvnum) {
if (usb_check_device(drv, dev, &(find_dev[i]))) {
found = malloc(sizeof(*found));
@@ -1876,32 +1846,32 @@ static struct usb_find_devices *usb_check(__maybe_unused struct device_drv *drv,
#ifdef USE_BFLSC
if (drv->drv_id == DRIVER_bflsc)
- return usb_check_each(DRV_BFLSC, drv, dev);
+ return usb_check_each(DRIVER_bflsc, drv, dev);
#endif
#ifdef USE_BITFORCE
if (drv->drv_id == DRIVER_bitforce)
- return usb_check_each(DRV_BITFORCE, drv, dev);
+ return usb_check_each(DRIVER_bitforce, drv, dev);
#endif
#ifdef USE_BITFURY
if (drv->drv_id == DRIVER_bitfury)
- return usb_check_each(DRV_BITFURY, drv, dev);
+ return usb_check_each(DRIVER_bitfury, drv, dev);
#endif
#ifdef USE_MODMINER
if (drv->drv_id == DRIVER_modminer)
- return usb_check_each(DRV_MODMINER, drv, dev);
+ return usb_check_each(DRIVER_modminer, drv, dev);
#endif
#ifdef USE_ICARUS
if (drv->drv_id == DRIVER_icarus)
- return usb_check_each(DRV_ICARUS, drv, dev);
+ return usb_check_each(DRIVER_icarus, drv, dev);
#endif
#ifdef USE_AVALON
if (drv->drv_id == DRIVER_avalon)
- return usb_check_each(DRV_AVALON, drv, dev);
+ return usb_check_each(DRIVER_avalon, drv, dev);
#endif
return NULL;