libftdi Archives

Subject: Re: [PATCH] ftdi_eeprom: reliable device selection and flashing of new VID/PIDs

From: Robin Haberkorn <haberkorn@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 25 Feb 2015 20:56:58 +0100
Hi Thomas,

On 12.02.2015 22:39, Thomas Jarosch wrote:
> ...
> 
> I've reviewed and applied the 01-cbusx.patch.
> Thanks for this high quality contribution.
> 
Thank you for applying it!

> How did you generate the patch file? Using "Write commit to file" in gitk?
> Please use "git format-patch HEAD~XXX" the next time. Then I can just
> apply them via "git am" without manually copying the commit msg etc. over.
> 
No, I'm not using stupid Git GUIs :-)
Simply used `git show >foo.patch`, assuming you want to apply it like a
regular patch file.
I rebased the ftdi_eeprom "--device" patch on top of libftdi's current
master branch and I'm attaching it here again in git-format-patch style.

> Regarding the ftdi_eeprom patch: It alters the current behavior.
> If someone uses "--erase" together with "--flash", it is no longer possible.
> Imagine someone wants to flash a shorter eeprom than
> the one that's currently on the chip, then "--erase"
> is really helpful to ensure there's no garbage left.
> 
> What do you think?
> 
I'm not sure if erasing before flashing makes any sense. Is it even
possible for the EEPROM size to change on one chip?

Nevertheless, my patch does not really affect ftdi_eeprom's behaviour in
this regard as ftdi_eeprom used the following check on command-line
arguments in 1162549f which effectively limits you to performing a
single command per ftdi_eeprom invocation:

    if (argc != 2 && argc != 3)
    {
        printf("Syntax: %s [commands] config-file\n", argv[0]);
        printf("Valid commands:\n");
        printf("--read-eeprom  Read eeprom and write to -filename- from
config-file\n");
        printf("--erase-eeprom  Erase eeprom\n");
        printf("--flash-eeprom  Flash eeprom\n");
        exit (-1);
    }

What the patch changes is allowing an arbitrary number of parameters so
that the optional "--device" option can be supported.

So I see no reason not to apply it.

> Cheers,
> Thomas
> 
Regards,
Robin

> 
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   
> 

-- 
Robin Haberkorn
Developer

metraTec GmbH
Werner-Heisenberg-Str. 1
39106 Magdeburg
Germany

haberkorn@xxxxxxxxxxxx
www.metratec.com


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Attachment: 0001-ftdi_eeprom-added-device-option.patch
Description: Text Data

Current Thread