Common: improves reliability of FF_DEBUG

This commit is contained in:
Carter Li
2026-10-03 10:21:08 +08:00
committed by Carter Li
parent 7f458b03e8
commit b201fd2db9
5 changed files with 67 additions and 41 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
#define INITGUID
#include "battery.h"
#include "common/endian.h"
#include "common/debug.h"
#include "common/endian.h"
#include "common/mallocHelper.h"
#include "common/windows/nt.h"
#include "common/windows/unicode.h"
#include "common/windows/wmi.h"
+3 -6
View File
@@ -60,8 +60,7 @@
snprintf(path, sizeof(path), "/dev/i2c-%d", cache->devices[i]);
FF_AUTO_CLOSE_FD int fd = open(path, O_RDWR | O_CLOEXEC);
if (fd < 0) {
int error = errno;
FF_DEBUG("Brightness DDC/CI: cached bus %d is unavailable (errno=%d: %s)", cache->devices[i], error, strerror(error));
FF_DEBUG("Brightness DDC/CI: cached bus %d is unavailable (errno=%d: %s)", cache->devices[i], errno, strerror(errno));
valid = false;
break;
}
@@ -119,8 +118,7 @@
int ioctlResult = ioctl(fd, I2C_RDWR, &data);
if (ioctlResult != 1) {
int error = errno;
FF_DEBUG("Brightness DDC/CI: write request failed (fd=%d, result=%d, errno=%d: %s)", fd, ioctlResult, error, strerror(error));
FF_DEBUG("Brightness DDC/CI: write request failed (fd=%d, result=%d, errno=%d: %s)", fd, ioctlResult, errno, strerror(errno));
return false;
}
@@ -131,8 +129,7 @@
msg.buf = response;
ioctlResult = ioctl(fd, I2C_RDWR, &data);
if (ioctlResult != 1) {
int error = errno;
FF_DEBUG("Brightness DDC/CI: read response failed (fd=%d, result=%d, errno=%d: %s)", fd, ioctlResult, error, strerror(error));
FF_DEBUG("Brightness DDC/CI: read response failed (fd=%d, result=%d, errno=%d: %s)", fd, ioctlResult, errno, strerror(errno));
return false;
}