mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Turn the XB360 controller LED on at init
This commit is contained in:
parent
23c54f6813
commit
ee01a8b5a0
@ -70,7 +70,7 @@ public class Xbox360Controller extends AbstractXboxController {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean handleRead(ByteBuffer buffer) {
|
protected boolean handleRead(ByteBuffer buffer) {
|
||||||
// Skip first byte
|
// Skip first byte
|
||||||
buffer.position(buffer.position()+1);
|
buffer.position(buffer.position() + 1);
|
||||||
|
|
||||||
// DPAD
|
// DPAD
|
||||||
byte b = buffer.get();
|
byte b = buffer.get();
|
||||||
@ -117,9 +117,24 @@ public class Xbox360Controller extends AbstractXboxController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean sendLedCommand(byte command) {
|
||||||
|
byte[] commandBuffer = {0x01, 0x03, command};
|
||||||
|
|
||||||
|
int res = connection.bulkTransfer(outEndpt, commandBuffer, commandBuffer.length, 3000);
|
||||||
|
if (res != commandBuffer.length) {
|
||||||
|
LimeLog.warning("LED set transfer failed: "+res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doInit() {
|
protected boolean doInit() {
|
||||||
// Xbox 360 wired controller requires no initialization
|
// Turn the LED on corresponding to our device ID
|
||||||
|
sendLedCommand((byte)(2 + (getControllerId() % 4)));
|
||||||
|
|
||||||
|
// No need to fail init if the LED command fails
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user