Remove fragile assert()

The sc_uhid_devices instance is initialized only when there is a UHID
keyboard.

The device message receiver assumed that it could not receive HID output
reports without a sc_uhid_devices instance (i.e. without a UHID
keyboard), but in practice, a UHID driver implementation on the device
may decide to send UHID output reports for mouse or for gamepads (and we
must just ignore them).

So remove the assert().

PR #5270 <https://github.com/Genymobile/scrcpy/pull/5270>
This commit is contained in:
Romain Vimont 2024-09-13 21:58:11 +02:00
parent bf2b679e70
commit 9f3d51106d
1 changed files with 0 additions and 5 deletions

View File

@ -121,11 +121,6 @@ process_msg(struct sc_receiver *receiver, struct sc_device_msg *msg) {
}
}
// This is a programming error to receive this message if there is
// no uhid_devices instance
assert(receiver->uhid_devices);
// Also check at runtime (do not trust the server)
if (!receiver->uhid_devices) {
LOGE("Received unexpected HID output message");
sc_device_msg_destroy(msg);