Skip to content

Commit 647145b

Browse files
committed
fix: do not overload bluetooth with rumble
1 parent ba960a0 commit 647145b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/gamepad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <sys/epoll.h>
1010

1111
#define GAMEPAD_CONFIG_INTERVAL 5000 // milliseconds
12-
#define GAMEPAD_HAPTICS_INTERVAL 8 // milliseconds
12+
#define GAMEPAD_HAPTICS_INTERVAL 40 // milliseconds
1313

1414
int Gamepad_init(struct Gamepad* const gamepad, int epoll, int hidraw) {
1515
gamepad->hidraw = hidraw;

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int try_add_gamepad(
118118
// cause a noticeable delay when processing game controller input,
119119
// but it should occur somewhat rarely.
120120
for (size_t i = 0; i < 10; i++) {
121-
if (((hidraw_fd = open(path, O_RDWR)) != -1) || !retry) {
121+
if (((hidraw_fd = open(path, O_RDWR | O_NONBLOCK)) != -1) || !retry) {
122122
break;
123123
}
124124
sleep(1);

0 commit comments

Comments
 (0)