From 41cc77f7e39cf37ea80703bda40a48c0f95ce684 Mon Sep 17 00:00:00 2001 From: Nicolas Eng Date: Tue, 18 Feb 2025 13:48:58 +0100 Subject: [PATCH 1/2] _hat_info: close eeprom file fd before returning --- lib/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/util.c b/lib/util.c index c31e2eb..2cf7d91 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1056,6 +1056,8 @@ int _hat_info(uint8_t address, struct HatInfo* entry, char* pData, else { // no board info found + if (eeprom_fd != 1) + close(eeprom_fd); return RESULT_BAD_PARAMETER; } @@ -1077,7 +1079,10 @@ int _hat_info(uint8_t address, struct HatInfo* entry, char* pData, { *pSize = custom_size + 1; // add room for null } + if (eeprom_fd != -1) + close(eeprom_fd); } + return RESULT_SUCCESS; } From c33790c47cd8a29acf17e7b0a1d1dcb92bcbcff6 Mon Sep 17 00:00:00 2001 From: Nicolas Eng Date: Tue, 28 Oct 2025 18:52:11 +0100 Subject: [PATCH 2/2] Handle /sys/class/i2c-adapter deprecation --- tools/daqhats_read_eeproms | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/daqhats_read_eeproms b/tools/daqhats_read_eeproms index f8c90f5..085ac51 100755 --- a/tools/daqhats_read_eeproms +++ b/tools/daqhats_read_eeproms @@ -62,7 +62,11 @@ if [ "$rc" != 0 ]; then exit $rc fi +# /sys/class/i2c-adapter is deprecated since 2009 SYS=/sys/class/i2c-adapter/i2c-$BUS +if [ ! -d "$SYS" ]; then + SYS=/sys/bus/i2c/devices/i2c-$BUS +fi rm -f /etc/mcc/hats/*.bin