NZSmartie / PyHIDParser

A HID descriptor parser written in Python 3
MIT License
23 stars 5 forks source link

Need Descriptor object for application use #3

Closed NZSmartie closed 8 years ago

NZSmartie commented 8 years ago

A Descriptor (class name may change) ideally will be returned when a application requests a parsed HID descriptor. With that object, the application could, for example, read out mouse x,y values without manually decoding the bytes from their offsets

device = hidparser.parse(descriptor)

# After reading from hid endpoint
device.deserialise(received_data)
print("mouse pointer: {}".format(device.mouse.pointer)
# mouse pointer: (10, 54)

alternatively, using the DescriptorBuilder an application may create a Descriptor object or generate byte array to configure hardware with

NZSmartie commented 8 years ago

I've created Device class that will hopefully end up being used by applications. The class supports iterating and accessing it's members via Usages

NZSmartie commented 8 years ago

The Device class provides access to reports (inputs, outputs and features) through instance named after their collection usages, i.e. Generic Desktop -> Mouse -> Pointer becomes device.mouse.pointer