Repository navigation
Conversation
A G Pro Wireless in onboard mode lists 125-1000 Hz on 0x8060 but refuses a write of any of them with InvalidArgument, keeping the rate its profile sets. The write path expected such a device to acknowledge and keep its own, so the refusal surfaced as a raw HID++ feature error. When a write of a rate the device lists is refused with InvalidArgument and the device still reports another rate, answer ReportRateNotApplied, as for the acknowledged case. Other refusals keep the device's error.
Confidence Score: 1/5
[Medium impact] The change affects how report-rate writes are reported to callers. The refusal read must fit inside the write deadline, and the new tests must satisfy the repository's test requirements before merging. Findings
|
| ) { | ||
| return error; | ||
| } | ||
| match control.current(HidppOperation::WriteReportRate).await { |
There was a problem hiding this comment.
Blocking. If a wireless mouse returns InvalidArgument and then stops answering, refusal_of_listed_rate starts a five-second read inside the agent's five-second write deadline. The outer deadline cancels the read before _ => error can return the original refusal. The caller gets RequestTimedOut instead.
This violates the repository requirement that each nested read fit inside its caller's deadline. Give this read a smaller budget and preserve the refusal on expiry. Add a refused_write_with_silent_readback_preserves_refusal test through the agent deadline.
Rule Used: Severity: high. Every nested I/O step has its own timeout that fits inside the caller's deadline, and a test asserts the arithmetic. An advisory read the device may ignore (LED, hosts info) gets a budget of hundreds of milliseconds and reads as unkno... (source)
| let shared = mouse_channel(&mouse, behind_receiver()).await; | ||
|
|
||
| let error = set_report_rate_on(&shared, ReportRate::new(500)) | ||
| .await | ||
| .expect_err("the onboard profile keeps 1 kHz"); |
There was a problem hiding this comment.
New tests lack required deadlines
Blocking. Both new tests await channel setup and device writes without a test-owned timeout or an expiry message. This violates the repository requirement that every async test wait have both. Wrap each test's async work in a bounded wait that names what stalled.
The PR also omits the required counter-proof. State that reverting the refusal conversion makes a_listed_rate_the_device_refuses_is_not_applied fail. No counter-proof was run during this review.
Rule Used: Severity: medium. Every bug fix ships a regression test that fails without the fix, and the PR states the counter-proof (the reverted line or the killed mutant). A test that passes with the fix reverted is not a regression test: ask for inputs where ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
A G Pro Wireless (wpid 4079) in onboard mode lists 125/250/500/1000 Hz on
0x8060, but refuses a write of any of them withInvalidArgumentand keeps therate its onboard profile sets. The write path expected a device like this to
acknowledge the write and keep its own rate, so the refusal came out as a raw
HID++ error:
Now, when a write of a listed rate is refused with
InvalidArgumentand thedevice still reports a different rate, the answer is
ReportRateNotApplied,the same as the acknowledged case:
Any other refusal keeps the device's own error. The settings app already locks
the rate pills in onboard mode, so this mostly affects
openlogi api.Changes
set_report_rate_on_channelre-reads the rate after anInvalidArgumentrefusal and answersReportRateNotAppliedwhen the devicekept another rate.
ReportRateNotApplieddoc mentions the refused case. No wire change.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warnings(withRUSTFLAGS=-D warnings)cargo test --workspace: 4735 passed, 0 failed0x8060mouse refusing a listed rate withInvalidArgumentgivesReportRateNotApplied; aBusyrefusal keepsHidppFeature { kind: Busy }.Hardware, Windows 11: on a G Pro Wireless in onboard mode,
api report-rate --set 500now gives thereadback_mismatchanswer above and the mouse stays at1000 Hz. A PRO Gaming Keyboard (
0x8060, no onboard profile) still changesrate.