change drivers to use usb_interface() - required for multi interface change
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
diff --git a/driver-avalon.c b/driver-avalon.c
index 83cff74..348a2ae 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -531,7 +531,7 @@ static void avalon_initialise(struct cgpu_info *avalon)
if (avalon->usbinfo.nodev)
return;
- interface = avalon->usbdev->found->interface;
+ interface = usb_interface(avalon);
// Reset
err = usb_transfer(avalon, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
FTDI_VALUE_RESET, interface, C_RESET);
diff --git a/driver-bflsc.c b/driver-bflsc.c
index 570a65a..48cadf2 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -452,7 +452,7 @@ static bool bflsc_qres(struct cgpu_info *bflsc, char *buf, size_t bufsiz, int de
static void __bflsc_initialise(struct cgpu_info *bflsc)
{
- int err;
+ int err, interface;
// TODO: does x-link bypass the other device FTDI? (I think it does)
// So no initialisation required except for the master device?
@@ -460,9 +460,10 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
if (bflsc->usbinfo.nodev)
return;
+ interface = usb_interface(bflsc);
// Reset
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_RESET, bflsc->usbdev->found->interface, C_RESET);
+ FTDI_VALUE_RESET, interface, C_RESET);
applog(LOG_DEBUG, "%s%i: reset got err %d",
bflsc->drv->name, bflsc->device_id, err);
@@ -477,7 +478,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set data control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_DATA,
- FTDI_VALUE_DATA_BAS, bflsc->usbdev->found->interface, C_SETDATA);
+ FTDI_VALUE_DATA_BAS, interface, C_SETDATA);
applog(LOG_DEBUG, "%s%i: setdata got err %d",
bflsc->drv->name, bflsc->device_id, err);
@@ -487,7 +488,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set the baud
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BAS,
- (FTDI_INDEX_BAUD_BAS & 0xff00) | bflsc->usbdev->found->interface,
+ (FTDI_INDEX_BAUD_BAS & 0xff00) | interface,
C_SETBAUD);
applog(LOG_DEBUG, "%s%i: setbaud got err %d",
@@ -498,7 +499,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set Flow Control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_FLOW,
- FTDI_VALUE_FLOW, bflsc->usbdev->found->interface, C_SETFLOW);
+ FTDI_VALUE_FLOW, interface, C_SETFLOW);
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
bflsc->drv->name, bflsc->device_id, err);
@@ -508,7 +509,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set Modem Control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_MODEM,
- FTDI_VALUE_MODEM, bflsc->usbdev->found->interface, C_SETMODEM);
+ FTDI_VALUE_MODEM, interface, C_SETMODEM);
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
bflsc->drv->name, bflsc->device_id, err);
@@ -518,7 +519,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Clear any sent data
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_PURGE_TX, bflsc->usbdev->found->interface, C_PURGETX);
+ FTDI_VALUE_PURGE_TX, interface, C_PURGETX);
applog(LOG_DEBUG, "%s%i: purgetx got err %d",
bflsc->drv->name, bflsc->device_id, err);
@@ -528,7 +529,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Clear any received data
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_PURGE_RX, bflsc->usbdev->found->interface, C_PURGERX);
+ FTDI_VALUE_PURGE_RX, interface, C_PURGERX);
applog(LOG_DEBUG, "%s%i: purgerx got err %d",
bflsc->drv->name, bflsc->device_id, err);
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 41deae3..30a6b2d 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -81,7 +81,7 @@ struct device_drv bitforce_drv;
static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
{
- int err;
+ int err, interface;
if (lock)
mutex_lock(&bitforce->device_mutex);
@@ -89,9 +89,10 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
if (bitforce->usbinfo.nodev)
goto failed;
+ interface = usb_interface(bitforce);
// Reset
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_RESET, bitforce->usbdev->found->interface, C_RESET);
+ FTDI_VALUE_RESET, interface, C_RESET);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: reset got err %d",
bitforce->drv->name, bitforce->device_id, err);
@@ -101,7 +102,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set data control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_DATA,
- FTDI_VALUE_DATA_BFL, bitforce->usbdev->found->interface, C_SETDATA);
+ FTDI_VALUE_DATA_BFL, interface, C_SETDATA);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: setdata got err %d",
bitforce->drv->name, bitforce->device_id, err);
@@ -111,7 +112,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set the baud
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BFL,
- (FTDI_INDEX_BAUD_BFL & 0xff00) | bitforce->usbdev->found->interface,
+ (FTDI_INDEX_BAUD_BFL & 0xff00) | interface,
C_SETBAUD);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: setbaud got err %d",
@@ -122,7 +123,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set Flow Control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_FLOW,
- FTDI_VALUE_FLOW, bitforce->usbdev->found->interface, C_SETFLOW);
+ FTDI_VALUE_FLOW, interface, C_SETFLOW);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
bitforce->drv->name, bitforce->device_id, err);
@@ -132,7 +133,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set Modem Control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_MODEM,
- FTDI_VALUE_MODEM, bitforce->usbdev->found->interface, C_SETMODEM);
+ FTDI_VALUE_MODEM, interface, C_SETMODEM);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
bitforce->drv->name, bitforce->device_id, err);
@@ -142,7 +143,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Clear any sent data
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_PURGE_TX, bitforce->usbdev->found->interface, C_PURGETX);
+ FTDI_VALUE_PURGE_TX, interface, C_PURGETX);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: purgetx got err %d",
bitforce->drv->name, bitforce->device_id, err);
@@ -152,7 +153,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Clear any received data
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
- FTDI_VALUE_PURGE_RX, bitforce->usbdev->found->interface, C_PURGERX);
+ FTDI_VALUE_PURGE_RX, interface, C_PURGERX);
if (opt_debug)
applog(LOG_DEBUG, "%s%i: purgerx got err %d",
bitforce->drv->name, bitforce->device_id, err);