if (libusb_get_device_descriptor(dev, &desc) < 0)
ftdi_error_return_free_device_list(-6, "libusb_get_device_descriptor() failed", devs);
- if (((vendor != 0 && product != 0) &&
+ if (((vendor || product) &&
desc.idVendor == vendor && desc.idProduct == product) ||
- ((vendor == 0 && product == 0) &&
+ (!(vendor || product) &&
(desc.idVendor == 0x403) && (desc.idProduct == 0x6001 || desc.idProduct == 0x6010
|| desc.idProduct == 0x6011 || desc.idProduct == 0x6014)))
{
{
output[0x1a + j] = eeprom->cbus_function[j];
}
+ output[0x0b] = eeprom->invert;
break;
}
}
return 0;
}
+/* Decode 230X / 232R type chips invert bits
+ * Prints directly to stdout.
+*/
+static void print_inverted_bits(int invert)
+{
+ char *r_bits[] = {"TXD","RXD","RTS","CTS","DTR","DSR","DCD","RI"};
+ int i;
+
+ fprintf(stdout,"Inverted bits:");
+ for (i=0; i<8; i++)
+ if ((invert & (1<<i)) == (1<<i))
+ fprintf(stdout," %s",r_bits[i]);
+
+ fprintf(stdout,"\n");
+}
/**
Decode binary EEPROM image into an ftdi_eeprom structure.
eeprom->group1_drive = (buf[0x0c] >> 4) & 0x03;
eeprom->group1_schmitt = (buf[0x0c] >> 4) & IS_SCHMITT;
eeprom->group1_slew = (buf[0x0c] >> 4) & SLOW_SLEW;
+
+ eeprom->invert = buf[0xb];
}
if (verbose)
if (eeprom->cbus_function[i]<= CBUSH_AWAKE)
fprintf(stdout,"CBUS%d Function: %s\n", i, cbush_mux[eeprom->cbus_function[i]]);
}
+
+ if (eeprom->invert)
+ print_inverted_bits(eeprom->invert);
}
if (ftdi->type == TYPE_R)
char *cbus_BB[] = {"RXF","TXE","RD", "WR"};
if (eeprom->invert)
- {
- char *r_bits[] = {"TXD","RXD","RTS", "CTS","DTR","DSR","DCD","RI"};
- fprintf(stdout,"Inverted bits:");
- for (i=0; i<8; i++)
- if ((eeprom->invert & (1<<i)) == (1<<i))
- fprintf(stdout," %s",r_bits[i]);
- fprintf(stdout,"\n");
- }
+ print_inverted_bits(eeprom->invert);
+
for (i=0; i<5; i++)
{
if (eeprom->cbus_function[i]<CBUS_BB)
break;
case CHIP_SIZE:
ftdi_error_return(-2, "EEPROM Value can't be changed");
+ break;
+
default :
ftdi_error_return(-1, "Request to unknown EEPROM value");
}