FreeCalypso > hg > fc-usbser-tools
diff fteeprom/filesearch.c @ 7:b2c891299e83
ftee-gen*: look for EEPROM config file in /opt/freecalypso/ftdi
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 04 Sep 2023 20:37:52 +0000 |
parents | |
children |
line wrap: on
line diff
--- /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 <stdio.h> +#include <string.h> +#include <strings.h> + +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; +}