1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

change drivers to use usb_interface() - required for multi interface change

This commit is contained in:
Kano 2013-09-14 01:20:21 +10:00
parent 08483717aa
commit a9faec4a4b
3 changed files with 19 additions and 17 deletions

View File

@ -531,7 +531,7 @@ static void avalon_initialise(struct cgpu_info *avalon)
if (avalon->usbinfo.nodev) if (avalon->usbinfo.nodev)
return; return;
interface = avalon->usbdev->found->interface; interface = usb_interface(avalon);
// Reset // Reset
err = usb_transfer(avalon, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, err = usb_transfer(avalon, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
FTDI_VALUE_RESET, interface, C_RESET); FTDI_VALUE_RESET, interface, C_RESET);

View File

@ -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) 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) // TODO: does x-link bypass the other device FTDI? (I think it does)
// So no initialisation required except for the master device? // 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) if (bflsc->usbinfo.nodev)
return; return;
interface = usb_interface(bflsc);
// Reset // Reset
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_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", applog(LOG_DEBUG, "%s%i: reset got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);
@ -477,7 +478,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set data control // Set data control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_DATA, 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", applog(LOG_DEBUG, "%s%i: setdata got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);
@ -487,7 +488,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set the baud // Set the baud
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BAS, 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); C_SETBAUD);
applog(LOG_DEBUG, "%s%i: setbaud got err %d", applog(LOG_DEBUG, "%s%i: setbaud got err %d",
@ -498,7 +499,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set Flow Control // Set Flow Control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_FLOW, 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", applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);
@ -508,7 +509,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Set Modem Control // Set Modem Control
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_MODEM, 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", applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);
@ -518,7 +519,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Clear any sent data // Clear any sent data
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, 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", applog(LOG_DEBUG, "%s%i: purgetx got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);
@ -528,7 +529,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
// Clear any received data // Clear any received data
err = usb_transfer(bflsc, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, 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", applog(LOG_DEBUG, "%s%i: purgerx got err %d",
bflsc->drv->name, bflsc->device_id, err); bflsc->drv->name, bflsc->device_id, err);

View File

@ -81,7 +81,7 @@ struct device_drv bitforce_drv;
static void bitforce_initialise(struct cgpu_info *bitforce, bool lock) static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
{ {
int err; int err, interface;
if (lock) if (lock)
mutex_lock(&bitforce->device_mutex); mutex_lock(&bitforce->device_mutex);
@ -89,9 +89,10 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
if (bitforce->usbinfo.nodev) if (bitforce->usbinfo.nodev)
goto failed; goto failed;
interface = usb_interface(bitforce);
// Reset // Reset
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: reset got err %d", applog(LOG_DEBUG, "%s%i: reset got err %d",
bitforce->drv->name, bitforce->device_id, err); bitforce->drv->name, bitforce->device_id, err);
@ -101,7 +102,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set data control // Set data control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_DATA, 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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: setdata got err %d", applog(LOG_DEBUG, "%s%i: setdata got err %d",
bitforce->drv->name, bitforce->device_id, err); bitforce->drv->name, bitforce->device_id, err);
@ -111,7 +112,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set the baud // Set the baud
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BFL, 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); C_SETBAUD);
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "%s%i: setbaud got err %d", 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 // Set Flow Control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_FLOW, 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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d", applog(LOG_DEBUG, "%s%i: setflowctrl got err %d",
bitforce->drv->name, bitforce->device_id, err); bitforce->drv->name, bitforce->device_id, err);
@ -132,7 +133,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
// Set Modem Control // Set Modem Control
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_MODEM, 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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d", applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d",
bitforce->drv->name, bitforce->device_id, err); 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 // Clear any sent data
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, 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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: purgetx got err %d", applog(LOG_DEBUG, "%s%i: purgetx got err %d",
bitforce->drv->name, bitforce->device_id, err); 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 // Clear any received data
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, 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) if (opt_debug)
applog(LOG_DEBUG, "%s%i: purgerx got err %d", applog(LOG_DEBUG, "%s%i: purgerx got err %d",
bitforce->drv->name, bitforce->device_id, err); bitforce->drv->name, bitforce->device_id, err);