mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Gamepad / Keyboard / Mouse (FreeBSD): break detection earlier
This commit is contained in:
@@ -20,8 +20,12 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */)
|
||||
{
|
||||
snprintf(path, ARRAY_SIZE(path), "/dev/uhid%d", i);
|
||||
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) continue;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
break; // No more devices
|
||||
continue; // Device not found
|
||||
}
|
||||
report_desc_t repDesc = hid_get_report_desc(fd);
|
||||
if (!repDesc) continue;
|
||||
|
||||
|
||||
@@ -47,7 +47,12 @@ static const char* detectByUsbhid(FFlist* devices)
|
||||
{
|
||||
snprintf(path, ARRAY_SIZE(path), "/dev/uhid%d", i);
|
||||
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) continue;
|
||||
if (fd < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
break; // No more devices
|
||||
continue; // Device not found
|
||||
}
|
||||
|
||||
report_desc_t repDesc = hid_get_report_desc(fd);
|
||||
if (!repDesc) continue;
|
||||
|
||||
@@ -20,8 +20,12 @@ const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
|
||||
{
|
||||
snprintf(path, ARRAY_SIZE(path), "/dev/uhid%d", i);
|
||||
FF_AUTO_CLOSE_FD int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) continue;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
break; // No more devices
|
||||
continue; // Device not found
|
||||
}
|
||||
report_desc_t repDesc = hid_get_report_desc(fd);
|
||||
if (!repDesc) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user