feat(hid_probe): VID と PID で任意のデバイスを読む - #25
Merged
Merged
Conversation
対応していないパッドを繋いでも一覧に出なかった。デバイスの選別を Sony の VID と 4 つの PID で決め打ちしていたため。対応できるかどうかはレポートを読まないと 決められないので、読む道具の側を先に広げる。 --list は並べるだけで開かない。開くと他のアプリと device を取り合う。 引数の解析は probe の外に置いた。probe は cfg(windows) の中にあり、中に書くと Windows 以外で test が走らない。 引数の誤りは終了コード 2 で終わる。1 は実行時の失敗に取ってあるので、指定の 誤りと読み分けられるようにする。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更内容
hid_probeに--listと--vidと--pidを足したなぜ
HORIPAD Turbo Plus を繋いでも一覧にすら出ない。デバイスの選別を Sony の VID と 4 つの PID で決め打ちしているため。
対応できるかどうかはレポートを読まないと決められない。PS4 のライセンス品なので DualShock 4 互換の形式で送る見込みは高いが、確かめていない。ジャイロもタッチパッドも無い機種なので、DS4 のレポートで IMU と timestamp が入る領域が何になっているかは特に分からない。そこが空なら
timelineの校正と wrap 処理は空回りする。読む道具を先に広げる。
判断したこと
--listは並べるだけで開かない。開くと他のアプリと device を取り合う。何が繋がっているかを見たいだけの段階で触る理由が無い。--vidと--pidは両方を必須にした。片方だけを受け付けると、同じ VID の別のデバイスを開いたときに何を読んだのか出力から決められない。--listと VID/PID の同時指定は断る。並べたのか開いたのかが出力から読めなくなる。引数の解析は
probeモジュールの外に置いた。probeはcfg(windows)の中にあり、中に書くと Windows 以外で test が走らない。引数の誤りは終了コード 2 で終わる。1 は実行時の失敗に取ってあるので、指定の誤りと読み分けられる。
引数の parser は依存に足さず自前で書いた。読む値が 3 つしか無い。
frametap.tomlで TOML の parser を入れなかったのと同じ判断になる。検証
cargo fmt --checkcargo clippy --all-targets -- -D warningscargo test(118 件)引数の解析に test が 9 件ある。
--list、--vidと--pidの組み合わせ--vidだけ、--pidだけ--listと VID/PID の併用test と実装を同時に書いたので、最初から全部通った。空振りしていないことを、実装を 2 通りに壊して確かめた。
--vidだけを通すようにするとone_of_the_two_is_refusedだけが落ち、0xを剥がすのをやめるとa_vid_and_a_pid_open_that_deviceだけが落ちた。デバイスを開く側は Windows でしか動かないので、実機で試すまで未検証になる。