Skip to content

fix(hid): declare Win32_System_IO feature for windows-sys WriteFile - #458

Open
Stanley5249 wants to merge 1 commit into
AprilNEA:masterfrom
Stanley5249:fix/hid-windows-sys-io
Open

fix(hid): declare Win32_System_IO feature for windows-sys WriteFile#458
Stanley5249 wants to merge 1 commit into
AprilNEA:masterfrom
Stanley5249:fix/hid-windows-sys-io

Conversation

@Stanley5249

Copy link
Copy Markdown

Summary

openlogi-hid uses WriteFile (native HID report writes in windows_hid.rs) but does not enable the windows-sys feature that gates it. In windows-sys 0.61.2, WriteFile's signature references OVERLAPPED, so the function is only exported when Win32_System_IO is enabled.

Workspace builds still compile because another workspace dependency enables Win32_System_IO and cargo unifies features across the graph — which is why CI stays green. But any package-scoped build on Windows fails:

$ cargo check -p openlogi-hid
error[E0432]: unresolved import `windows_sys::Win32::Storage::FileSystem::WriteFile`

This declares the feature the crate actually uses instead of relying on feature unification.

Changes

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

Testing

On Windows 11 (windows-sys 0.61.2 from the committed Cargo.lock):

  • cargo check -p openlogi-hid — fails with E0432 before, passes after
  • cargo check --workspace — passes before and after (feature unification masks the bug in workspace builds)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace — all pass

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a missing windows-sys feature declaration in openlogi-hid, adding Win32_System_IO to the crate's feature list so that WriteFile is properly exported in package-scoped builds.

  • The root cause is that WriteFile's signature in windows-sys 0.61.2 references OVERLAPPED, which is only exported when Win32_System_IO is enabled; workspace builds worked by accident due to feature unification with another crate.
  • The one-line fix mirrors the existing comment pattern for Win32_Security and directly addresses the E0432 compile error on cargo check -p openlogi-hid.

Confidence Score: 5/5

Safe to merge — a targeted, correct addition of one missing feature flag that fixes a real package-scoped build failure on Windows without affecting workspace builds or any runtime behaviour.

The change adds a single windows-sys feature string that is verified to be required by the WriteFile usage in windows_hid.rs. It is confined to the Windows-only target dependency block, touches no logic, and the comment follows the established pattern in the file.

No files require special attention.

Important Files Changed

Filename Overview
crates/openlogi-hid/Cargo.toml Adds Win32_System_IO to the windows-sys feature list under the Windows-only target dependency, fixing a package-scoped build failure caused by a missing feature gate for WriteFile.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[cargo check -p openlogi-hid] --> B{Win32_System_IO\nfeature enabled?}
    B -- No\n(before this PR) --> C["E0432: unresolved import\nwindows_sys::Win32::Storage::FileSystem::WriteFile"]
    B -- Yes\n(after this PR) --> D[Compiles successfully]
    
    E[cargo check --workspace] --> F[Feature unification from\nanother workspace dep\nenables Win32_System_IO]
    F --> G[Compiles — masks the bug]
Loading

Reviews (1): Last reviewed commit: "fix(hid): declare Win32_System_IO featur..." | Re-trigger Greptile

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