Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: expand wdk-sys coverage to include hid-related headers #260

Merged
merged 26 commits into from
Jan 30, 2025

Conversation

wmmc88
Copy link
Collaborator

@wmmc88 wmmc88 commented Jan 11, 2025

This pull request introduces several significant changes to the wdk-sys and wdk-build crates. The main changes include adding headers related to Windows HID support via a new hid feature, and laying the groundwork for future features to be added to further expand API coverage. Bindgen input has moved from a static input header to a dynamically generated header passed to bindgen's header_contents method, allowing for the inputs to more easily be adaptable to different cargo features.

HID Support:

  • Introduced the ApiSubset enum and related methods in the Config struct to handle different subsets of APIs required for various driver types. [1] [2] [3] [4]
  • crates/wdk-sys/build.rs: Added the generate_hid function to generate bindings for HID-related headers and avoid duplicate definitions.
  • crates/wdk-sys/src/hid-input.h: Added a new header file for HID input with the necessary includes and comments for future improvements.
  • crates/wdk-sys/src/hid.rs: Added a new source file for HID bindings, including the necessary modules and imports.
  • crates/wdk-sys/src/lib.rs: Added a new module for HID support, ensuring it is included for all driver models.

Kernel Mode Definitions:

  • crates/wdk-build/src/lib.rs: Updated the Config implementation to include _KERNEL_MODE definition for both WDM and KMDF driver configurations.

Workflow Enhancements:

  • Updated various GitHub workflow files (.github/workflows/build.yaml, .github/workflows/codeql.yml, .github/workflows/docs.yaml, .github/workflows/lint.yaml, .github/workflows/test.yaml) to include the --all-features flag in Cargo commands to ensure all features are built and tested. [1] [2] [3] [4] [5]

Breaking Changes:

BREAKING CHANGE: wdk_default no longer takes in a list of c header files. Users are expected to specify headers or header_contents via their respective bindgen::Builder APIs

BREAKING CHANGE: Config::get_include_paths has been renamed to Config::include_paths

BREAKING CHANGE: Config::get_library_paths has been renamed to Config::library_paths

BREAKING CHANGE: Config::get_preprocessor_definitions_iter has been renamed to Config::preprocessor_definitions

@wmmc88 wmmc88 requested a review from Copilot January 11, 2025 00:00
@wmmc88 wmmc88 self-assigned this Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 28 changed files in this pull request and generated no comments.

Files not reviewed (14)
  • .vscode/settings.json: Language not supported
  • crates/wdk-sys/src/input.h: Language not supported
  • crates/wdk-sys/src/wdf.c: Language not supported
  • tests/umdf-driver-workspace/crates/driver_1/src/lib.rs: Evaluated as low risk
  • examples/sample-kmdf-driver/src/lib.rs: Evaluated as low risk
  • tests/umdf-driver-workspace/crates/driver_2/src/lib.rs: Evaluated as low risk
  • examples/sample-umdf-driver/src/lib.rs: Evaluated as low risk
  • tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs: Evaluated as low risk
  • crates/wdk-build/src/bindgen.rs: Evaluated as low risk
  • Cargo.toml: Evaluated as low risk
  • crates/wdk-sys/src/lib.rs: Evaluated as low risk
  • crates/wdk-sys/Cargo.toml: Evaluated as low risk
  • crates/wdk-build/Cargo.toml: Evaluated as low risk
  • examples/sample-wdm-driver/Cargo.toml: Evaluated as low risk
crates/wdk-build/src/lib.rs Outdated Show resolved Hide resolved
crates/wdk-build/src/lib.rs Outdated Show resolved Hide resolved
@wmmc88 wmmc88 marked this pull request as ready for review January 22, 2025 22:39
@wmmc88 wmmc88 requested a review from Copilot January 22, 2025 22:40
@wmmc88 wmmc88 requested a review from a team January 22, 2025 22:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 19 out of 34 changed files in this pull request and generated 1 comment.

Files not reviewed (15)
  • .vscode/settings.json: Language not supported
  • crates/wdk-sys/src/input.h: Language not supported
  • crates/wdk-sys/src/wdf.c: Language not supported
  • .github/workflows/code-formatting-check.yaml: Evaluated as low risk
  • .github/workflows/build.yaml: Evaluated as low risk
  • examples/sample-umdf-driver/Cargo.toml: Evaluated as low risk
  • examples/sample-kmdf-driver/Cargo.toml: Evaluated as low risk
  • examples/sample-kmdf-driver/src/lib.rs: Evaluated as low risk
  • .github/workflows/codeql.yml: Evaluated as low risk
  • Cargo.toml: Evaluated as low risk
  • crates/wdk-build/src/bindgen.rs: Evaluated as low risk
  • .github/workflows/docs.yaml: Evaluated as low risk
  • crates/wdk-sys/Cargo.toml: Evaluated as low risk
  • crates/wdk-sys/src/lib.rs: Evaluated as low risk
  • .github/workflows/test.yaml: Evaluated as low risk
Comments suppressed due to low confidence (3)

crates/wdk-sys/build.rs:316

  • Redundant use of cfg_if! macro. The cfg attribute is already used within the function.
cfg_if::cfg_if! {

crates/wdk-sys/build.rs:321

  • [nitpick] Inconsistent logging using the trace! macro. Ensure logging is consistent and only used when necessary.
trace!(header_contents = ?header_contents);

crates/wdk-sys/build.rs:336

  • [nitpick] Inconsistent logging using the trace! macro. Ensure logging is consistent and only used when necessary.
trace!(bindgen_builder = ?bindgen_builder);

crates/wdk-sys/build.rs Show resolved Hide resolved
Copy link
Contributor

@leon-xd leon-xd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main change is to add some relevant changes to CONTRIBUTING.md, everything else is some general questions. great work!

.github/workflows/lint.yaml Show resolved Hide resolved
.github/workflows/codeql.yml Show resolved Hide resolved
crates/wdk-build/src/lib.rs Outdated Show resolved Hide resolved
crates/wdk-sys/build.rs Show resolved Hide resolved
crates/wdk-sys/build.rs Show resolved Hide resolved
crates/wdk-sys/build.rs Outdated Show resolved Hide resolved
@wmmc88 wmmc88 requested a review from leon-xd January 23, 2025 02:42
leon-xd
leon-xd previously approved these changes Jan 24, 2025
ankurung
ankurung previously approved these changes Jan 29, 2025
crates/wdk-build/src/lib.rs Outdated Show resolved Hide resolved
@wmmc88 wmmc88 added this pull request to the merge queue Jan 30, 2025
Merged via the queue into microsoft:main with commit 4d4f997 Jan 30, 2025
62 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2025
@wmmc88 wmmc88 deleted the hid branch January 30, 2025 01:18
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.

3 participants