On Thu, 2014-10-23 at 01:52 -0700, russ.dill@xxxxxxxxx wrote: > From: Russ Dill <Russ.Dill@xxxxxxxxx> > > This patch provides the FTDI genuine product verification steps > as contained within the new 2.12.00 official release. It ensures > that counterfeiters don't exploit engineering investment made > by FTDI. Counterfeit ICs are destroying innovation in the > industry. > > FTDI recommends that to guarantee genuine FTDI products > please purchase either from FTDI directly or an authorised > distributor. > > This is definitely not targeting end users - if you're unsure if > ICs are genuine then please don't use the drivers. So you don't want this merged? If you want to have it merged please explain the benefit. > +static void ftdi_verify(struct usb_serial_port *port) > +{ > + struct ftdi_private *priv = usb_get_serial_port_data(port); > + u16 *eeprom_data; > + u16 checksum; > + int eeprom_size; > + int i; > + > + switch (priv->chip_type) { > + case FT232RL: > + eeprom_size = 0x40; > + break; > + default: > + /* Unsupported for verification */ > + return; > + } > + > + /* Latency timer needs to be 0x77 to unlock EEPROM programming */ > + if (priv->latency != 0x77) { > + int orig_latency = priv->latency; > + priv->latency = 0x77; > + write_latency_timer(port); > + priv->latency = orig_latency; > + } > + > + eeprom_data = kzalloc(eeprom_size * 2, GFP_KERNEL); > + if (!eeprom_data) > + return; > + > + /* Read in EEPROM */ > + for (i = 0; i < eeprom_size; i++) > + if (read_eeprom(port, i, eeprom_data + i) < 0) > + goto end_verify; > + > + /* Verify EEPROM is valid */ > + checksum = ftdi_checksum(eeprom_data, eeprom_size); > + if (checksum != eeprom_data[eeprom_size - 1]) > + goto end_verify; > + > + /* Attempt to set Vendor ID to 0 */ > + eeprom_data[1] = 0; > + > + /* Calculate new checksum to avoid bricking devices */ > + checksum = ftdi_checksum(eeprom_data, eeprom_size); > + > + /* Verify EEPROM programming behavior/nonbehavior */ > + write_eeprom(port, 1, 0); In case of disconnect here, what have we just done to the device? > + write_eeprom(port, eeprom_size - 1, checksum); > + > +end_verify: > + kfree(eeprom_data); > +} > + Oliver -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html