Skip to content

Commit

Permalink
Fix SP7 invalid data workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
quo committed Dec 4, 2024
1 parent 7dc28f5 commit bff49bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ipts/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Parser {
*
* @param[in] reader The chunk of data allocated to the HID frame.
*/
void parse_hid_frame(Reader &reader)
bool parse_hid_frame(Reader &reader)
{
const auto frame = reader.read<protocol::hid::Frame>();
Reader sub = reader.sub(frame.size - sizeof(frame));
Expand Down Expand Up @@ -119,14 +119,16 @@ class Parser {
* So let's just ignore these packets.
*/
if (reader.size() == 4)
return;
return false;

this->parse_report_frames(sub);
break;
default:
// TODO: Add handler for unknown data and wire up debug tools
break;
}

return true;
}

/*!
Expand All @@ -136,8 +138,7 @@ class Parser {
*/
void parse_hid_frames(Reader &reader)
{
while (reader.size() > 0)
this->parse_hid_frame(reader);
while (reader.size() > 0 && this->parse_hid_frame(reader));
}

/*!
Expand Down

0 comments on commit bff49bc

Please sign in to comment.