Skip to content

Commit

Permalink
Exposing bus_type field from hid_device_info.
Browse files Browse the repository at this point in the history
  • Loading branch information
kangcliff authored and prusnak committed Oct 17, 2023
1 parent 749da69 commit eaf771d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chid.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ cdef extern from "hidapi.h":
ctypedef struct hid_device:
pass

cdef enum hid_bus_type:
HID_API_BUS_UNKNOWN = 0x00,
HID_API_BUS_USB = 0x01,
HID_API_BUS_BLUETOOTH = 0x02,
HID_API_BUS_I2C = 0x03,
HID_API_BUS_SPI = 0x04

cdef struct hid_device_info:
char *path
unsigned short vendor_id
Expand All @@ -16,6 +23,7 @@ cdef extern from "hidapi.h":
unsigned short usage
int interface_number
hid_device_info *next
hid_bus_type bus_type

hid_device_info* hid_enumerate(unsigned short, unsigned short) nogil
void hid_free_enumeration(hid_device_info*)
Expand Down
1 change: 1 addition & 0 deletions hid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def enumerate(int vendor_id=0, int product_id=0):
'usage_page': c.usage_page,
'usage': c.usage,
'interface_number': c.interface_number,
'bus_type': c.bus_type,
})
c = c.next
hid_free_enumeration(info)
Expand Down

0 comments on commit eaf771d

Please sign in to comment.