X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.c;h=777733a9c82427a2cc9d3f343a3330d7a88c42c2;hp=b87aa1c43297ab8012070333332ea176044d4932;hb=c9eeb2f12fe5632bab5b35766c1b6261e591872a;hpb=9f2b912eceaab315474c9987ae77b2aa3bea13a5 diff --git a/src/ftdi.c b/src/ftdi.c index b87aa1c..777733a 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -2596,6 +2596,47 @@ int ftdi_eeprom_set_strings(struct ftdi_context *ftdi, char * manufacturer, return 0; } +int ftdi_eeprom_get_strings(struct ftdi_context *ftdi, + char *manufacturer, int mnf_len, + char *product, int prod_len, + char *serial, int serial_len) +{ + struct ftdi_eeprom *eeprom; + + if (ftdi == NULL) + ftdi_error_return(-1, "No struct ftdi_context"); + + if (ftdi->eeprom == NULL) + ftdi_error_return(-2,"No struct ftdi_eeprom"); + + eeprom = ftdi->eeprom; + + if (ftdi->usb_dev == NULL) + ftdi_error_return(-3, "No connected device or device not yet opened"); + + if (manufacturer) + { + strncpy(manufacturer, eeprom->manufacturer, mnf_len); + if (mnf_len > 0) + manufacturer[mnf_len - 1] = '\0'; + } + + if (product) + { + strncpy(product, eeprom->product, prod_len); + if (prod_len > 0) + product[prod_len - 1] = '\0'; + } + + if (serial) + { + strncpy(serial, eeprom->serial, serial_len); + if (serial_len > 0) + serial[serial_len - 1] = '\0'; + } + + return 0; +} /*FTD2XX doesn't check for values not fitting in the ACBUS Signal options*/ void set_ft232h_cbus(struct ftdi_eeprom *eeprom, unsigned char * output)