Skip to content

Commit 002fc4f

Browse files
CheerpipeCalcProgrammer1
authored andcommitted
Fix Logitech G815 keyboard freezing
Keyboard may freeze when running GHUB and OpenRGB at the same time. This fixes this. Commits squashed by Adam Honse <calcprogrammer1@gmail.com>
1 parent a008f14 commit 002fc4f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Controllers/LogitechController/LogitechG815Controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void LogitechG815Controller::SendCommit()
9090
| Send packet |
9191
\*-----------------------------------------------------*/
9292
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
93-
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
93+
hid_read_timeout(dev_pkt_0x11, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
9494
}
9595

9696
void LogitechG815Controller::InitializeDirect()
@@ -243,7 +243,7 @@ void LogitechG815Controller::SendDirectFrame
243243
| Send packet |
244244
\*-----------------------------------------------------*/
245245
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
246-
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
246+
hid_read_timeout(dev_pkt_0x11, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
247247
}
248248

249249
void LogitechG815Controller::SendMode

Controllers/LogitechController/LogitechG815Controller.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include <string>
1313
#include <hidapi/hidapi.h>
1414

15-
const size_t LOGITECH_G815_COMMIT_BYTE = 0x7F;
15+
#define LOGITECH_G815_COMMIT_BYTE 0x7F
16+
#define LOGITECH_READ_TIMEOUT 300 //Timeout in ms
1617

1718
#pragma once
1819

0 commit comments

Comments
 (0)