Merge pull request #2000 from mqp/joystick-log-errno
Log errors while reading joystick input
This commit is contained in:
@@ -140,6 +140,15 @@ void InputHandler_Linux_Joystick::InputThread()
|
||||
|
||||
js_event event;
|
||||
int ret = read(fds[i], &event, sizeof(event));
|
||||
|
||||
if(ret == -1)
|
||||
{
|
||||
LOG->Warn("Error reading from joystick %i: %s; disabled", i, strerror(errno));
|
||||
close(fds[i]);
|
||||
fds[i] = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ret != sizeof(event))
|
||||
{
|
||||
LOG->Warn("Unexpected packet (size %i != %i) from joystick %i; disabled", ret, (int)sizeof(event), i);
|
||||
|
||||
Reference in New Issue
Block a user