Only update the battery level if we're on Bluetooth
Fixes battery level dropping to empty with the Qanba Drone Arcade Stick. It looks like we might also be able to skip the check for all third party controllers, but I think this is the right thing to do for Sony controllers as well.main
parent
120a957d07
commit
93b7196763
|
@ -919,6 +919,7 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev,
|
|||
axis = ((int)packet->ucRightJoystickY * 257) - 32768;
|
||||
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
|
||||
if (ctx->device->is_bluetooth) {
|
||||
if (packet->ucBatteryLevel & 0x10) {
|
||||
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED);
|
||||
} else {
|
||||
|
@ -934,6 +935,7 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev,
|
|||
SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->report_touchpad) {
|
||||
touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
|
||||
|
|
Loading…
Reference in New Issue