Re: [PATCH v2] usb: serial: Repair FTDI FT232R bricked eeprom

From: Oliver Neukum
Date: Wed Sep 09 2020 - 23:03:45 EST


Am Mittwoch, den 09.09.2020, 13:34 -0600 schrieb James Hilliard:
> This patch detects and reverses the effects of the malicious FTDI
> Windows driver version 2.12.00(FTDIgate).

Hi,

this raises questions.
Should we do this unconditionally without asking?
Does this belong into kernel space?

> +static int ftdi_repair_brick(struct usb_serial_port *port)
> +{
> + struct ftdi_private *priv = usb_get_serial_port_data(port);
> + int orig_latency;
> + int rv;
> + u16 *eeprom_data;
> + u16 checksum;
> + int eeprom_size;
> + int result;
> +
> + switch (priv->chip_type) {
> + case FT232RL:
> + eeprom_size = 0x40;
> + break;
> + default:
> + /* Unsupported for brick repair */
> + return 0;
> + }
> +
> + /* Latency timer needs to be 0x77 to unlock EEPROM programming */
> + if (priv->latency != 0x77) {
> + orig_latency = priv->latency;
> + priv->latency = 0x77;
> + rv = write_latency_timer(port);
> + priv->latency = orig_latency;
> + if (rv < 0)
> + return -EIO;
> + }

Do you really want to change this without returning to the original?

Regards
Oliver