dev/ [Xilinx CTB] Fix DAC driver file path in LTC2620 driver (#1641)
Build on RHEL9 docker image / build (push) Successful in 5m16s
Build on RHEL8 docker image / build (push) Successful in 5m31s
Build and Deploy on local RHEL9 / build (push) Successful in 2m13s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m41s
Build and Deploy on local RHEL8 / build (push) Successful in 5m10s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m6s

* [Xilinx CTB] fix DAC driver file path in LTC2620 driver

eb525e96b (#1631) silenced -Wformat-nonliteral by formatting the DAC
driver file name with "%s%d", but for the Xilinx CTB the names are
themselves printf formats (.../ao%d and .../ao%d_pd), which gave
.../ao%d0 instead of .../ao0 and made fopen fail on hardware.

Use the name as the format again on the XILINX_CHIPTESTBOARDD build,
with the warning suppressed only around that one snprintf. The
non-Xilinx "%s%d" path is unchanged.

* binaries in

---------

Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
Erik Fröjdhandmaliakal_d authored and GitHub committed 2026-10-28 11:32:03 +01:00
1 parent 70b039eb42
commit dc6f2cd058
8 files changed
+17 -9

No files matched your search

@@ -94,13 +94,21 @@ int LTC2620_D_SetDacValue(int dacnum, int val, char *dacname, char *mess) {
// fname to write to
char fname[MAX_STR_LENGTH];
memset(fname, 0, MAX_STR_LENGTH);
snprintf(fname, sizeof(fname), "%s%d", LTC2620_D_DriverFileName, dacnum);
#if defined(XILINX_CHIPTESTBOARDD)
// driver file names are printf formats with the dac number in the middle
// (CURRENT_BOARD_LINKS_FOLDER "/ao%d" and "/ao%d_pd"), so the format
// cannot be a string literal here
const char *fnameFormat = LTC2620_D_DriverFileName;
if (val == LTC2620_D_PWR_DOWN_VAL) {
snprintf(fname, sizeof(fname), "%s%d",
LTC2620_D_PowerDownDriverFileName, dacnum);
fnameFormat = LTC2620_D_PowerDownDriverFileName;
val = 1; //-100?:Invalid Argument
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(fname, sizeof(fname), fnameFormat, dacnum);
#pragma GCC diagnostic pop
#else
snprintf(fname, sizeof(fname), "%s%d", LTC2620_D_DriverFileName, dacnum);
#endif
LOG(logDEBUG1, ("fname %s\n", fname));
+6 -6
View File
@@ -3,11 +3,11 @@
/** API versions */
#define APILIB "0.0.0 0x250909"
#define APIRECEIVER "0.0.0 0x250822"
#define APICTB "0.0.0 0x261027"
#define APIGOTTHARD2 "0.0.0 0x261027"
#define APIMOENCH "0.0.0 0x261027"
#define APICTB "0.0.0 0x261028"
#define APIGOTTHARD2 "0.0.0 0x261028"
#define APIMOENCH "0.0.0 0x261028"
#define APIEIGER "0.0.0 0x261027"
#define APIXILINXCTB "0.0.0 0x261027"
#define APIJUNGFRAU "0.0.0 0x261027"
#define APIMYTHEN3 "0.0.0 0x261027"
#define APIXILINXCTB "0.0.0 0x261028"
#define APIJUNGFRAU "0.0.0 0x261028"
#define APIMYTHEN3 "0.0.0 0x261028"
#define APIMATTERHORN "0.0.0 0x260529"