From: Uwe Bonnes Date: Tue, 14 Sep 2010 14:07:56 +0000 (+0200) Subject: use_serial is used in all devices beside AM types. So move out of the switch(ftdi... X-Git-Tag: v1.0rc1~133^2~61 X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=commitdiff_plain;h=bf2f6ef7f73ba0a1bf3f04db4435ce2014231ba3 use_serial is used in all devices beside AM types. So move out of the switch(ftdi->type) construct --- diff --git a/src/ftdi.c b/src/ftdi.c index 0db9a4d..39337b6 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -2470,6 +2470,13 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) output[0x13] = serial_size*2 + 2; + if(ftdi->type > TYPE_AM) /*use_serial not used in AM devices*/ + { + if (eeprom->use_serial == USE_SERIAL_NUM ) + output[0x0A] |= USE_SERIAL_NUM; + else + output[0x0A] &= ~USE_SERIAL_NUM; + } /* Fixme: ftd2xx seems to append 0x02, 0x03 and 0x01 for PnP = 0 or 0x00 else */ // calculate checksum @@ -2482,10 +2489,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) case TYPE_BM: output[0x0C] = eeprom->usb_version & 0xff; output[0x0D] = (eeprom->usb_version>>8) & 0xff; - if (eeprom->use_serial == 1) - output[0x0A] |= 0x8; - else - output[0x0A] &= ~0x8; output[0x14] = eeprom->chip; break; case TYPE_2232C: @@ -2524,10 +2527,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) output[0x0A] |= 0x4; else output[0x0A] &= ~0x4; - if (eeprom->use_serial == USE_SERIAL_NUM ) - output[0x0A] |= USE_SERIAL_NUM; - else - output[0x0A] &= ~0x8; output[0x0C] = eeprom->usb_version & 0xff; output[0x0D] = (eeprom->usb_version>>8) & 0xff; output[0x14] = eeprom->chip; @@ -2541,10 +2540,6 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) output[0x0A] |= 0x4; else output[0x0A] &= ~0x4; - if (eeprom->use_serial == USE_SERIAL_NUM) - output[0x0A] |= USE_SERIAL_NUM; - else - output[0x0A] &= ~0x8; output[0x0B] = eeprom->invert; output[0x0C] = eeprom->usb_version & 0xff; output[0x0D] = (eeprom->usb_version>>8) & 0xff;