Skip to content

Adopt sys::expected for the hidraw ioctl chain - #26

Merged
jwinarske merged 1 commit into
mainfrom
jw/expected-ioctl
Jul 13, 2026
Merged

Adopt sys::expected for the hidraw ioctl chain#26
jwinarske merged 1 commit into
mainfrom
jw/expected-ioctl

Conversation

@jwinarske

@jwinarske jwinarske commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Adopt sys::expected for the hidraw ioctl chain

Extend the std::expected error-model adoption to ioctl. Add a sys::ioctl
wrapper returning std::expected<int, std::error_code> and convert the hidraw setup chain (HIDIOCGRAWINFO/NAME/PHYS/RDESCSIZE/RDESC) in all three controllers and the ps5 HIDIOCGFEATURE feature reads.

Each failed ioctl now logs the specific errno message (e.g. "HIDIOCGRAWINFO failed: No such device") instead of a bare tag, and the reused int res pattern becomes per-call scoped checks. sys_test gains an ioctl case (a terminal ioctl on a non-tty fd -> ENOTTY).

Extend the std::expected error-model adoption to ioctl. Add a sys::ioctl
wrapper returning std::expected<int, std::error_code> and convert the hidraw
setup chain (HIDIOCGRAWINFO/NAME/PHYS/RDESCSIZE/RDESC) in all three controllers
and the ps5 HIDIOCGFEATURE feature reads.

Each failed ioctl now logs the specific errno message (e.g. "HIDIOCGRAWINFO
failed: No such device") instead of a bare tag, and the reused `int res`
pattern becomes per-call scoped checks. sys_test gains an ioctl case (a
terminal ioctl on a non-tty fd -> ENOTTY).

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
@jwinarske
jwinarske merged commit e55d5e8 into main Jul 13, 2026
6 checks passed
@jwinarske
jwinarske deleted the jw/expected-ioctl branch July 13, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant