mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Fix read() warnings
This commit is contained in:
@@ -47,10 +47,17 @@ void DetectSpectrixS40GControllers(std::vector<RGBController*>& 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 |
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user