On Fri, 20 Feb 2015 18:21:09 -0600 Reggie McMurtrey reggie.mcmurtrey@gmail.com wrote:
This is my first time submitting a patch to a project, so let me know if I have done something wrong here.
I commonly use the C232HM cable from FTDI to program various parts of boards I design. This one cable allows me to program SPI, I2C, and JTAG parts. Simply adding some muxes to the design I have a single header to attach this cable to. The patch below allows control of the muxes from the GPIOL3-GPIOL0 signals on the cable and disable write protection. I figured other people may like this capability if they are using a similar breakout cable of have designed the ft2232 chip into their design.
Signed-off-by: Reggie McMurtrey reggie.mcmurtrey@gmail.com
@@ -262,6 +269,18 @@ int ft2232_spi_init(void) } free(arg);
- arg = extract_programmer_param("gpio_dir");
- if (arg) {
gpio_dir = (strtoul(arg, 0, 16) & (0xf0 & ~adapter_mask)) | gpio_dir;
- }
- free(arg);
- arg = extract_programmer_param("gpio_value");
- if (arg) {
gpio_value = (strtoul(arg, 0, 16) & (0xf0 & ~adapter_mask)) | gpio_value;
- }
- free(arg);
- arg = extract_programmer_param("port"); if (arg) { switch (toupper((unsigned char)*arg)) {
Hello Reggie,
thanks for your patch! I had no time to review it in detail but we definitely want some error/wrong input handling for the parameter parsing above. There are various similar checks throughout the code base that you may wanna look at... not all are perfect yet though. If you have any doubts then please refer to the strtol(3) manpage.
A more detailed review will follow when that's fixed.