Commit c25de336 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Error out if the device returns a negative number of buttons

Summary:
btnx[1] is reporting a negative number of buttons in my machine (-87) so
ignore it instead of crashing (once we have negative buttons things quite don't work),
ignoring is not wrong since after all btnx is not a joystick

[1] https://github.com/cdobrich/btnx

Reviewers: davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7900
parent 85d79c00
......@@ -184,6 +184,10 @@ JoyDevice::ErrorCode JoyDevice::open()
return JoyDevice::ERR_GET_CORR;
}
if (bt < 0) {
return JoyDevice::ERR_GET_BUTTONS;
}
descr = name;
joyFd = fd;
axes = ax;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment