Fix crash in XB1 controller driver on Fire HD 6 after controller removal

This commit is contained in:
Cameron Gutman 2016-01-07 22:52:17 -06:00
parent f409a3583c
commit cc71ce6180

View File

@ -129,6 +129,12 @@ public class XboxOneController {
// Read the next input state packet
long lastMillis = MediaCodecHelper.getMonotonicMillis();
res = connection.bulkTransfer(inEndpt, buffer, buffer.length, 3000);
// If we get a zero length response, treat it as an error
if (res == 0) {
res = -1;
}
if (res == -1 && MediaCodecHelper.getMonotonicMillis() - lastMillis < 1000) {
LimeLog.warning("Detected device I/O error");
XboxOneController.this.stop();