X-Git-Url: http://developer.intra2net.com/git/?a=blobdiff_plain;f=src%2Fftdi.c;h=c62ede7a49e5e911a993c04c824959af10494b4a;hb=6335545d29051b1de8d2d482c25a3c1e2e4ff62c;hp=16f8f1f8745810465ae968f91e8d5cee8646e61e;hpb=22d12cda4aed8d25fb79588a7261ca489db5ecd7;p=libftdi diff --git a/src/ftdi.c b/src/ftdi.c index 16f8f1f..c62ede7 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -63,7 +63,7 @@ */ int ftdi_init(struct ftdi_context *ftdi) { - int i; + unsigned int i; ftdi->usb_dev = NULL; ftdi->usb_read_timeout = 5000; @@ -960,7 +960,7 @@ static int _usb_get_async_urbs_pending(struct ftdi_context *ftdi) { struct usbdevfs_urb *urb; int pending=0; - int i; + unsigned int i; for (i=0; i < ftdi->async_usb_buffer_size; i++) { @@ -1053,8 +1053,8 @@ static int _usb_bulk_write_async(struct ftdi_context *ftdi, int ep, char *bytes, { struct usbdevfs_urb *urb; int bytesdone = 0, requested; - int ret, i; - int cleanup_count; + int ret, cleanup_count; + unsigned int i; do { @@ -1954,7 +1954,8 @@ int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *buf, int size) // Addr 04: Product ID eeprom->product_id = buf[0x04] + (buf[0x05] << 8); - switch (buf[0x06] + (buf[0x07]<<8)) + value = buf[0x06] + (buf[0x07]<<8); + switch (value) { case 0x0400: eeprom->BM_type_chip = 1; @@ -2183,12 +2184,15 @@ int ftdi_read_eeprom_getsize(struct ftdi_context *ftdi, unsigned char *eeprom, i int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom) { unsigned short usb_val, status; - int i; + int i, ret; /* These commands were traced while running MProg */ - ftdi_usb_reset(ftdi); - ftdi_poll_modem_status(ftdi, &status); - ftdi_set_latency_timer(ftdi, 0x77); + if ((ret = ftdi_usb_reset(ftdi)) != 0) + return ret; + if ((ret = ftdi_poll_modem_status(ftdi, &status)) != 0) + return ret; + if ((ret = ftdi_set_latency_timer(ftdi, 0x77)) != 0) + return ret; for (i = 0; i < ftdi->eeprom_size/2; i++) {