diff --git a/Controllers/ENESMBusController/XPGSpectrixS40GDetect.cpp b/Controllers/ENESMBusController/XPGSpectrixS40GDetect.cpp index d85285fe..b77a463b 100644 --- a/Controllers/ENESMBusController/XPGSpectrixS40GDetect.cpp +++ b/Controllers/ENESMBusController/XPGSpectrixS40GDetect.cpp @@ -47,10 +47,17 @@ void DetectSpectrixS40GControllers(std::vector& rgb_controllers) } memset(nvme_dev_buf, 0, 1024); - read(nvme_model_fd, nvme_dev_buf, 1024); - close(nvme_model_fd); - LOG_DEBUG("[XPG Spectrix S40G] Probing %d, model: %s", nvme_idx, nvme_dev_buf); + if(read(nvme_model_fd, nvme_dev_buf, 1024) < 0) + { + LOG_WARNING("[XPG Spectrix S40G] Probing %d, failed to read NVMe model", nvme_idx); + } + else + { + LOG_DEBUG("[XPG Spectrix S40G] Probing %d, model: %s", nvme_idx, nvme_dev_buf); + } + + close(nvme_model_fd); /*-------------------------------------------------*\ | Check if this NVMe device is a SPECTRIX S40G | diff --git a/i2c_smbus/i2c_smbus_linux.cpp b/i2c_smbus/i2c_smbus_linux.cpp index dd90be57..f4a28400 100644 --- a/i2c_smbus/i2c_smbus_linux.cpp +++ b/i2c_smbus/i2c_smbus_linux.cpp @@ -6,6 +6,8 @@ | Adam Honse (CalcProgrammer1) 2/14/2019 | \*-----------------------------------------*/ +#include "LogManager.h" + #include "i2c_smbus.h" #include "i2c_smbus_linux.h" @@ -114,7 +116,12 @@ bool i2c_smbus_linux_detect() if(test_fd) { memset(device_string, 0x00, sizeof(device_string)); - read(test_fd, device_string, sizeof(device_string)); + + if(read(test_fd, device_string, sizeof(device_string)) < 0) + { + LOG_WARNING("[i2c_smbus_linux] Failed to read i2c device name"); + } + device_string[strlen(device_string) - 1] = 0x00; close(test_fd); @@ -154,7 +161,12 @@ bool i2c_smbus_linux_detect() if (test_fd >= 0) { memset(buff, 0x00, sizeof(buff)); - read(test_fd, buff, sizeof(buff)); + + if(read(test_fd, buff, sizeof(buff)) < 0) + { + LOG_WARNING("[i2c_smbus_linux] Failed to read i2c device PCI vendor ID"); + } + buff[strlen(buff) - 1] = 0x00; pci_vendor = strtoul(buff, NULL, 16); close(test_fd); @@ -166,7 +178,12 @@ bool i2c_smbus_linux_detect() if (test_fd >= 0) { memset(buff, 0x00, sizeof(buff)); - read(test_fd, buff, sizeof(buff)); + + if(read(test_fd, buff, sizeof(buff)) < 0) + { + LOG_WARNING("[i2c_smbus_linux] Failed to read i2c device PCI device ID"); + } + buff[strlen(buff) - 1] = 0x00; pci_device = strtoul(buff, NULL, 16); close(test_fd); @@ -178,7 +195,12 @@ bool i2c_smbus_linux_detect() if (test_fd >= 0) { memset(buff, 0x00, sizeof(buff)); - read(test_fd, buff, sizeof(buff)); + + if(read(test_fd, buff, sizeof(buff)) < 0) + { + LOG_WARNING("[i2c_smbus_linux] Failed to read i2c device PCI subvendor ID"); + } + buff[strlen(buff) - 1] = 0x00; pci_subsystem_vendor = strtoul(buff, NULL, 16); close(test_fd); @@ -190,7 +212,12 @@ bool i2c_smbus_linux_detect() if (test_fd >= 0) { memset(buff, 0x00, sizeof(buff)); - read(test_fd, buff, sizeof(buff)); + + if(read(test_fd, buff, sizeof(buff)) < 0) + { + LOG_WARNING("[i2c_smbus_linux] Failed to read i2c device PCI subdevice ID"); + } + buff[strlen(buff) - 1] = 0x00; pci_subsystem_device = strtoul(buff, NULL, 16); close(test_fd);