Repository navigation
Move Windows API bindings out of hwPortUtils #18571
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
0e6c36f
Move top level obviously Windows API bindings from hwPortUtils
SaschaCowley d0421aa
Tidy and make more conformant to rest of winBindings
SaschaCowley 4a3b580
Move advapi32 and setupapi functions out of hwPortUtils
SaschaCowley 7330373
Moved bthprops bindings out of hwPortUtils
SaschaCowley 59554a1
Move hid.dll bindings into winBindings
SaschaCowley e1f0c85
Fix typo in winBindings.setupapi
SaschaCowley 0e2d55e
Docs for bthprops
SaschaCowley fd02d88
Docs for cfgmgr32
SaschaCowley 270b2d6
Docs for hid
SaschaCowley f4acfd5
Fix docs for setupapi
SaschaCowley d2895a6
Fix up docs for advapi32
SaschaCowley 16a858b
Fix up changes
SaschaCowley 45c2f62
Fix incorrect types
SaschaCowley 89977a6
Pre-commit auto-fix
pre-commit-ci[bot] 5199593
Start adding backward compat layer
SaschaCowley 705e03a
Merge branch 'hwPortUtilsWinBindings' of https://github.com/nvaccess/…
SaschaCowley 89fbc76
Add shim for bthprops
SaschaCowley 4469701
Shim for cfgmgr32
SaschaCowley 50cf1ee
hid
SaschaCowley d646911
Shim for setupapi
SaschaCowley 07c29bb
Fix SetupDiEnumDeviceInfo
SaschaCowley 1c9db49
Move MAX_DEVICE_ID_LEN and CR_SUCCESS to winBindings.cfgmgr32
SaschaCowley d2accbd
Move setupapi constants out of hwPortUtils
SaschaCowley b3c5fcc
Move system error codes out of hwPortUtils
SaschaCowley e4cbef6
Move last stragglers to setupapi
SaschaCowley 2577068
Make getattr more maintainable
SaschaCowley 69267c0
Tidy
SaschaCowley dfd66e1
Fix up changes
SaschaCowley 417e915
Apply suggestions from code review
SaschaCowley 869a53a
Add copyright header and docstring to winBindings.hid
SaschaCowley c63572d
Fix order of imports in hwPortUtils
SaschaCowley df9ba74
Merge branch 'master' into hwPortUtilsWinBindings
SaschaCowley a149bdb
Merge branch 'master' into hwPortUtilsWinBindings
SaschaCowley 39e22b4
Shaddow imports from winBindings.advapi32
SaschaCowley d5998c3
Shaddow imports from winBindings.bthprops
SaschaCowley 0fcef5b
Shaddow imports from winBindings.hid
SaschaCowley 4d6e810
Shaddow imports from winBindings.setupapi
SaschaCowley d69f508
Sort moved symbols
SaschaCowley cb948bb
WIP deprecation handler
SaschaCowley ce9a635
Mostly working migration to reuseable handler
SaschaCowley 2eeeeb3
Moved symbol support
SaschaCowley 2aa3999
Handle literals or values from the same module
SaschaCowley 8329343
Add documentation and tidy
SaschaCowley a5df850
Move to using new system
SaschaCowley 35aa879
mend
SaschaCowley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move hid.dll bindings into winBindings
- Loading branch information
commit 59554a18a06cb2a313336f28f3a096930b8b8c95
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| from ctypes import POINTER, Structure, c_void_p, sizeof, windll | ||
|
SaschaCowley marked this conversation as resolved.
|
||
| from ctypes.wintypes import BOOLEAN, HANDLE, ULONG, USHORT | ||
|
|
||
| from comtypes import GUID | ||
| from hidpi import HIDP_CAPS, NTSTATUS | ||
|
|
||
| dll = windll.hid | ||
|
|
||
|
|
||
| class HIDD_ATTRIBUTES(Structure): | ||
| _fields_ = ( | ||
| ("Size", ULONG), | ||
| ("VendorID", USHORT), | ||
| ("ProductID", USHORT), | ||
| ("VersionNumber", USHORT), | ||
| ) | ||
|
|
||
| def __init__(self, **kwargs): | ||
| super().__init__(Size=sizeof(HIDD_ATTRIBUTES), **kwargs) | ||
|
|
||
|
|
||
| PHID_ATTRIBUTES = POINTER(HIDD_ATTRIBUTES) | ||
|
|
||
| HidD_GetAttributes = dll.HidD_GetAttributes | ||
| HidD_GetAttributes.argtypes = (HANDLE, PHID_ATTRIBUTES) | ||
| HidD_GetAttributes.restype = BOOLEAN | ||
|
|
||
| HidD_GetManufacturerString = dll.HidD_GetManufacturerString | ||
| HidD_GetManufacturerString.argtypes = (HANDLE, c_void_p, ULONG) | ||
| HidD_GetManufacturerString.restype = BOOLEAN | ||
|
|
||
| HidD_GetProductString = dll.HidD_GetProductString | ||
| HidD_GetProductString.argtypes = (HANDLE, c_void_p, ULONG) | ||
| HidD_GetProductString.restype = BOOLEAN | ||
|
|
||
| PHIDP_PREPARSED_DATA = c_void_p | ||
|
|
||
| HidD_GetPreparsedData = dll.HidD_GetPreparsedData | ||
| HidD_GetPreparsedData.argtypes = (HANDLE, PHIDP_PREPARSED_DATA) | ||
| HidD_GetPreparsedData.restype = BOOLEAN | ||
|
|
||
| PHIDP_CAPS = POINTER(HIDP_CAPS) | ||
|
|
||
| HidP_GetCaps = dll.HidP_GetCaps | ||
| HidP_GetCaps.argtypes = (PHIDP_PREPARSED_DATA, PHIDP_CAPS) | ||
| HidP_GetCaps.restype = NTSTATUS | ||
|
|
||
| HidD_FreePreparsedData = dll.HidD_FreePreparsedData | ||
| HidD_FreePreparsedData.argtypes = (PHIDP_PREPARSED_DATA,) | ||
| HidD_FreePreparsedData.restype = BOOLEAN | ||
|
|
||
| LPGUID = POINTER(GUID) | ||
|
|
||
| HidD_GetHidGuid = dll.HidD_GetHidGuid | ||
| HidD_GetHidGuid.argtypes = (LPGUID,) | ||
| HidD_GetHidGuid.restype = None | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.