Skip to content

Commit

Permalink
Remove fragile assert()
Browse files Browse the repository at this point in the history
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 <#5270>
  • Loading branch information
rom1v committed Sep 13, 2024
1 parent edf4511 commit 7246eee
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions app/src/receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7246eee

Please sign in to comment.