# HG changeset patch # User Mychaela Falconia # Date 1693859872 0 # Node ID b2c891299e83e17b67ea2ceffde72d2bbd134c08 # Parent d4151cef9d9572776482c6fda1c4db68319b511f ftee-gen*: look for EEPROM config file in /opt/freecalypso/ftdi diff -r d4151cef9d95 -r b2c891299e83 fteeprom/Makefile --- a/fteeprom/Makefile Mon Sep 04 06:38:29 2023 +0000 +++ b/fteeprom/Makefile Mon Sep 04 20:37:52 2023 +0000 @@ -9,14 +9,14 @@ all: ${PROGS} -ftee-gen2232c: ftee-gen2232c.c - ${CC} ${CFLAGS} -o $@ $@.c +ftee-gen2232c: ftee-gen2232c.o filesearch.o + ${CC} ${CFLAGS} -o $@ $@.o filesearch.o -ftee-gen2232h: ftee-gen2232h.c - ${CC} ${CFLAGS} -o $@ $@.c +ftee-gen2232h: ftee-gen2232h.o filesearch.o + ${CC} ${CFLAGS} -o $@ $@.o filesearch.o -ftee-gen232r: ftee-gen232r.c - ${CC} ${CFLAGS} -o $@ $@.c +ftee-gen232r: ftee-gen232r.o filesearch.o + ${CC} ${CFLAGS} -o $@ $@.o filesearch.o ftee-mkblank: ftee-mkblank.c ${CC} ${CFLAGS} -o $@ $@.c diff -r d4151cef9d95 -r b2c891299e83 fteeprom/filesearch.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fteeprom/filesearch.c Mon Sep 04 20:37:52 2023 +0000 @@ -0,0 +1,28 @@ +/* + * This module implements the function that searches for FTDI EEPROM config + * files in a dedicated installation directory. It is based on the version + * in fc-sim-tools that looks in the sim-scripts directory. + */ + +#include +#include +#include + +static char ftdi_install_dir[] = "/opt/freecalypso/ftdi"; + +FILE * +open_eeprom_config_file(req_filename) + char *req_filename; +{ + char pathbuf[256]; + FILE *f; + + if (!index(req_filename, '/') && strlen(req_filename) < 128) { + sprintf(pathbuf, "%s/%s", ftdi_install_dir, req_filename); + f = fopen(pathbuf, "r"); + if (f) + return f; + } + f = fopen(req_filename, "r"); + return f; +} diff -r d4151cef9d95 -r b2c891299e83 fteeprom/ftee-gen2232c.c --- a/fteeprom/ftee-gen2232c.c Mon Sep 04 06:38:29 2023 +0000 +++ b/fteeprom/ftee-gen2232c.c Mon Sep 04 20:37:52 2023 +0000 @@ -6,6 +6,8 @@ #include #include +extern FILE *open_eeprom_config_file(); + char *configfile, *serial; u_short vid = 0x0403, pid = 0x6010; @@ -66,7 +68,7 @@ int lineno; char *cp, *np; - inf = fopen(configfile, "r"); + inf = open_eeprom_config_file(configfile); if (!inf) { perror(configfile); exit(1); diff -r d4151cef9d95 -r b2c891299e83 fteeprom/ftee-gen2232h.c --- a/fteeprom/ftee-gen2232h.c Mon Sep 04 06:38:29 2023 +0000 +++ b/fteeprom/ftee-gen2232h.c Mon Sep 04 20:37:52 2023 +0000 @@ -6,6 +6,8 @@ #include #include +extern FILE *open_eeprom_config_file(); + char *configfile, *serial; u_short vid = 0x0403, pid = 0x6010; @@ -66,7 +68,7 @@ int lineno; char *cp, *np; - inf = fopen(configfile, "r"); + inf = open_eeprom_config_file(configfile); if (!inf) { perror(configfile); exit(1); diff -r d4151cef9d95 -r b2c891299e83 fteeprom/ftee-gen232r.c --- a/fteeprom/ftee-gen232r.c Mon Sep 04 06:38:29 2023 +0000 +++ b/fteeprom/ftee-gen232r.c Mon Sep 04 20:37:52 2023 +0000 @@ -5,6 +5,8 @@ #include #include +extern FILE *open_eeprom_config_file(); + u_short vid = 0x0403, pid = 0x6001; char *manuf, *product; u_char byte00 = 0x00, byte01 = 0x40; @@ -24,7 +26,7 @@ int lineno; char *cp, *np; - inf = fopen(filename, "r"); + inf = open_eeprom_config_file(filename); if (!inf) { perror(filename); exit(1);