Skip to content

Replace remaining raw ctypes calls to hid.dll with winBindings.hid definitions.#18902

Merged
SaschaCowley merged 11 commits into
masterfrom
winBindings.hid
Sep 15, 2025
Merged

Replace remaining raw ctypes calls to hid.dll with winBindings.hid definitions.#18902
SaschaCowley merged 11 commits into
masterfrom
winBindings.hid

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member
  • Ad remaining winBindings definitions for hid.dll
  • Replace raw ctypes calls to hid.dll with winBindings.hid
  • winBindings.hid: correct definition
  • HIDP_VALUE_CAPS was used in place of HIDP_BUTTON_CAPS as I assumed they were the same. They actulaly differ in some of their members, though they do end up being the same size. We now define correct HIDP_BUTTON_CAPS and use it where appropriate.
  • Update copyright years

Link to issue number:

None.

Summary of the issue:

A pa part of moving to 64 bit, all raw ctypes calls must have explicit definitions. Remaining calls to functions in hid.dll must be moved to winBindings.

Description of user facing changes:

None.

Description of developer facing changes:

Description of development approach:

  • Add winBindings defintions for all remaining required calls to hid.dll.
  • Replace all raw ctypes calls with these definitions.
  • Add a HIDP_BUTTON_CAPS structure and use this with GetButtonCaps etc, rather than HIDP_VALUE_CAPS which is incorrect.

Testing strategy:

General smoke testing with a standard HID braille display. auto detection, moving by line, routing etc.

Known issues with pull request:

None known.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Copilot AI review requested due to automatic review settings September 11, 2025 03:24
@michaelDCurran michaelDCurran requested a review from a team as a code owner September 11, 2025 03:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces raw ctypes calls to hid.dll with properly defined winBindings.hid functions to support the transition to 64-bit architecture. The changes add structured function definitions with proper type annotations and correct structure usage.

  • Add comprehensive winBindings definitions for remaining hid.dll functions
  • Replace all raw ctypes.windll.hid calls with winBindings.hid equivalents
  • Correct HIDP_BUTTON_CAPS structure definition and usage (previously incorrectly used HIDP_VALUE_CAPS)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
source/winBindings/hid.py Adds 10 new HID function definitions with proper type annotations and documentation
source/hwIo/hid.py Replaces raw ctypes calls with winBindings equivalents and fixes structure types
source/hidpi.py Adds correct HIDP_BUTTON_CAPS structure and improves type safety with from_param method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread source/hidpi.py
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
pre-commit-ci Bot and others added 2 commits September 11, 2025 03:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please also add to changes.md where necessary.

Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/winBindings/hid.py Outdated
Comment thread source/hidpi.py Outdated
michaelDCurran and others added 3 commits September 14, 2025 09:46
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
@SaschaCowley SaschaCowley merged commit 2f8a9df into master Sep 15, 2025
38 of 40 checks passed
@SaschaCowley SaschaCowley deleted the winBindings.hid branch September 15, 2025 06:35
@github-actions github-actions Bot added this to the 2026.1 milestone Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants