Browse Source

usb add a numeric sub-indentity for each name

nfactor-troky
Kano 12 years ago
parent
commit
e89c921ab0
  1. 3
      driver-bflsc.c
  2. 14
      usbutils.c
  3. 20
      usbutils.h

3
driver-bflsc.c

@ -897,17 +897,20 @@ reinit: @@ -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;
}
}

14
usbutils.c

@ -123,6 +123,7 @@ static struct usb_find_devices find_dev[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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[] = { @@ -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 @@ -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);

20
usbutils.h

@ -50,9 +50,26 @@ struct usb_endpoints { @@ -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 { @@ -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;

Loading…
Cancel
Save