Skip to content

fix(hid): enable Win32_System_IO so WriteFile resolves - #466

Closed
Brumaire wants to merge 1 commit into
AprilNEA:masterfrom
Brumaire:fix/windows-build-writefile-feature
Closed

fix(hid): enable Win32_System_IO so WriteFile resolves#466
Brumaire wants to merge 1 commit into
AprilNEA:masterfrom
Brumaire:fix/windows-build-writefile-feature

Conversation

@Brumaire

Copy link
Copy Markdown

Summary

cargo build fails on Windows in openlogi-hid, so the workspace cannot be built from source on that platform:

error[E0432]: unresolved import `windows_sys::Win32::Storage::FileSystem::WriteFile`
  --> crates\openlogi-hid\src\windows_hid.rs:19:9

WriteFile's signature references System::IO::OVERLAPPED, so windows-sys gates it behind the Win32_System_IO feature:

#[cfg(feature = "Win32_System_IO")]
windows_link::link!("kernel32.dll" "system" fn WriteFile(...));

The features list already handles the identical situation for CreateFileW (gated behind Win32_Security because of PSECURITY_ATTRIBUTES, with a comment explaining why). This adds the equivalent entry for WriteFile.

Changes

  • openlogi-hid: add Win32_System_IO to the windows-sys features list, with a comment matching the existing Win32_Security note.

Testing

cargo build -p openlogi-agent            # fails before, succeeds after
cargo build --release -p openlogi-agent  # succeeds
cargo fmt --all -- --check               # clean
cargo clippy -p openlogi-core -p openlogi-hid -p openlogi-agent-core --all-targets -- -D warnings   # clean
cargo test -p openlogi-core -p openlogi-hid -p openlogi-agent-core                                  # 228 passed

Environment: Windows 11 (26200), Rust 1.96.0, windows-sys 0.61.2.

Runtime-tested on hardware: yes — the resulting agent runs and drives a Logitech Lift over Bluetooth.

`cargo build` fails on Windows in `openlogi-hid`:

    error[E0432]: unresolved import
      `windows_sys::Win32::Storage::FileSystem::WriteFile`
      --> crates\openlogi-hid\src\windows_hid.rs:19:9

`WriteFile`'s signature references `System::IO::OVERLAPPED`, so windows-sys
gates it behind the `Win32_System_IO` feature:

    #[cfg(feature = "Win32_System_IO")]
    windows_link::link!("kernel32.dll" "system" fn WriteFile(...));

The features list already handles the same situation for `CreateFileW`
(gated behind `Win32_Security` because of `PSECURITY_ATTRIBUTES`, with a
comment explaining why) — this adds the equivalent entry for `WriteFile`.

Verified: `cargo build -p openlogi-agent` succeeds after the change,
both in debug and release, on Windows 11 with Rust 1.96.
@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the Windows build of openlogi-hid.

  • Enables the valid windows-sys Win32_System_IO feature required to expose WriteFile.
  • Documents that WriteFile references the feature-gated OVERLAPPED type.

Confidence Score: 5/5

The PR appears safe to merge with no actionable issues identified.

The added feature is valid for the workspace-resolved windows-sys version and satisfies the existing WriteFile import without changing runtime behavior.

Important Files Changed

Filename Overview
crates/openlogi-hid/Cargo.toml Correctly enables the target-specific Windows API feature required by the existing native HID write fallback.

Reviews (1): Last reviewed commit: "fix(hid): enable Win32_System_IO so Writ..." | Re-trigger Greptile

@Stanley5249

Copy link
Copy Markdown

Duplicate of #458.

@Brumaire

Copy link
Copy Markdown
Author

You are right, #458 has the identical fix and got there two days earlier — I missed it. Closing this in favour of it.

@Brumaire

Copy link
Copy Markdown
Author

Duplicate of #458.

@Brumaire Brumaire closed this Jul 27, 2026
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.

2 participants