Repository navigation
Conversation
Add RapooOfficeProtocol for the Rapoo MT760 and MT760 Mini wireless mice over the 2.4GHz USB receiver (24AE:1870). - Talk on vendor collection FF00:000E with 32-byte reports and an active query frame (BA A5 AA 00...) - Add HidD_GetInputReport fallback in NativeHid and HidTransport for Windows input report queries - Add unit tests for request framing and battery parsing - Register MT760 in HardwareTests and Linux udev rules - Update README and AGENTS.md documentation
PyFlat-JR
left a comment
There was a problem hiding this comment.
Thanks for this, and for testing it on real hardware! The protocol class and tests look good. A few things before it can go in:
- The
HidD_GetInputReportfallback inHidSharpReportStream.Readapplies to every input/output HID protocol on Windows (Logitech, Corsair, VT3 PRO, AULA, Sony, MCHOSE). On every 250 ms read timeout it would fetch an input report byrequest[0], which can hand back a stale cached report and opens a second handle per exchange. IfNativeHid.Openfails, the cachedLazyexception also leavesReadand fails the exchange. Could you make this an opt-in that onlyRapooOfficeProtocoluses? - Could you post raw hex captures of the replies, and say which path each came from (normal read vs
HidD_GetInputReport)? HidSharp always puts the report ID at byte 0, so01 01 42reads as report ID0x01plus state and level, andBA 01 …as report0xBAwith a leading0x01. I'd like the parser to match what the mouse actually sends. It would also show whether the fallback is needed at all. - MT760 Mini: did you read its battery on a real Mini? If not, please drop that entry for now. We only list models read on the device, and it shares the PID anyway.
- Small things:
ReadBudgetmatches the default and can go. In README, please use "Dongle" for the connection and keep the note for limitations only (or leave it empty). Please also wrap the AGENTS.md lines like the rest of that file.
- Make HidD_GetInputReport fallback opt-in via HidProtocol.FallbackToGetInputReport - Use safe NativeHid.TryOpen to avoid uncaught exceptions during handle creation - Simplify RapooOfficeProtocol parser to single report layout [01, state, level] - Drop unverified MT760 Mini entry and redundant ReadBudget override - Update README table and re-wrap AGENTS.md to match repo conventions
|
Thanks for the review! I have addressed all your mentioned points, AI did this so it might have messed something up so let me know if there's anything else that I could do to help. 1. Opt-in
|
PyFlat-JR
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround and the captures, that clears up the reply layout. Removing the Mini, the ReadBudget override and the README note all look good.
- Please make this its own
HidReportKindinstead of a flag. Your capture shows that the normal read never answers on this mouse and onlyHidD_GetInputReportdoes, so this isn't really a fallback but the only way to read it. A third kind next toFeatureandInputOutput(write the output report, then fetch the input report withHidD_GetInputReport) fits how the transport already picks the exchange style. It also lets you dropFallbackToGetInputReport, the extraExchangeReportsAsyncoverloads onIHidTransport/HidSharpTransport, thereportIdparameter onIReportStream.Read, and the 250 ms wait on a read that never succeeds. It also avoids theCancellationToken-before-optional-bool parameter order. - Linux and macOS: the only path that works is
HidD_GetInputReport, which is Windows-only, so as it stands the mouse can't be read on Linux or macOS at all, even though the README lists it and the PR adds a udev rule. Please either implement the input-report fetch there too (HIDIOCGINPUTon hidraw,IOHIDDeviceGetReportwith an input report type on macOS), or drop the udev rule and note in the README that it's read on Windows only. - Small things:
NativeHid.TryOpenduplicates the whole body ofOpen. It can just betry { return Open(devicePath); } catch (Win32Exception) { return null; }.- A few new lines in
HidTransport.csand the new hardware test are well over the width of the surrounding code. Please wrap them to match.
…ndows Address maintainer review feedback on PR PyFlat#36: - Add HidReportKind.GetInputReport and dispatch directly in HidChannel.ExchangeAsync. - Remove FallbackToGetInputReport flag and redundant method overloads from HidTransport and HidFamily. - Keep IReportStream.Read(timeout) minimal without extra reportId or timeout parameters. - Implement ExchangeGetInputReportsAsync on HidSharpTransport with attempt retry and settle delay. - Drop Rapoo MT760 udev rules from packaging and docs; note in README.md that it is read on Windows only. - Add SupportedOnLinux property to HidProtocol (default true, false on RapooOfficeProtocol) to keep LinuxSourceTests strict for Linux-supported devices without unverified udev rules. - Simplify NativeHid.TryOpen with clean Win32Exception handling. - Re-wrap lines to maintain ~100-character code conventions.
|
I have updated the branch to address all the points:
|
PyFlat-JR
left a comment
There was a problem hiding this comment.
Thanks, the new HidReportKind.GetInputReport reads much cleaner, and the protocol class looks good now.
- Please keep Linux/macOS instead of scoping to Windows. Since the input-report fetch is now implemented for hidraw (
HIDIOCGINPUT) and macOS (IOHIDDeviceGetReport), the mouse should be readable there too. Untested on those platforms is fine, most of the other devices are the same. So please restore the udev rule inpackaging/linux/70-device-battery-info.rulesanddocs/linux-setup.md, dropSupportedOnLinuxfromHidProtocoland the filter inLinuxUdevRuleTests, and leave the README note empty again. - Smaller things:
IHidTransport.ExchangeGetInputReportAsynchas a default body that throwsNotSupportedException, unlike the other members. Please make it a regular interface member and implement it in the test fakes.LinuxHidraw.TryOpen,LinuxHidraw.TryGetInputReportandMacReportStream.GetInputReportcatch everyExceptionand return null/false, so a failure only shows up as "not answered within N ms". Please catch only the specific exceptions those calls throw (IOException,UnauthorizedAccessException,Win32Exception, ...) or log the error before returning, so it's visible what went wrong.
What does this PR do?
Adds
RapooOfficeProtocolsupporting the Rapoo MT760 and MT760 Mini wireless office mice over the 2.4GHz USB receiver (24AE:1870).FF00:000E(32-byte reports) with an active query frame (BA A5 AA 00...) answered by input report01 <state> <level>...(orBA 01 <state> <level>...).HidD_GetInputReportfallback inNativeHidandHidTransportfor Windows input report queries when stream reads time out.HardwareTestsand adds the Linux udev rule in70-device-battery-info.rulesanddocs/linux-setup.md.README.mdsupported devices table and documents the protocol inAGENTS.md.Checklist
dotnet buildanddotnet testpass locally (0 warnings, 383 tests).below). If you could not, say so explicitly rather than presenting it as tested.
Device/hardware tested against (if applicable)
24AE, PID1870)AI assistance
Assisted by Google Antigravity to structure the protocol into the plugin architecture, tests, and udev rules. Tested and verified on real hardware.