Skip to main content

a realization of report descriptor parser and codec context.

Project description

Python USB HID Report Descriptor

A realization of report descriptor parser and codec context.

parser example

from py_hidreport.items import *
from py_hidreport.usages import *
from py_hidreport.pages import *
from py_hidreport.parser import ReportDescParser
bin = b'\x05\x01\x09\x06\xA1\x01\x05\x07\x19\xE0\x29\xE7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xC0'
code:str = ReportDescParser.parse(bin)
prnt(code)

codec example

from py_hidreport.items import *
from py_hidreport.usages import *
from py_hidreport.pages import *
from py_hidreport.ctx import ReportDescStdContext

ReportDescContext.Set(ReportDescStdContext())

code = '''UsagePage(GenericDesktop)
    Usage(GenericDesktopPage.Mouse)
    Collection(Application)
    Usage(GenericDesktopPage.Pointer)
    Collection (Physical)
    UsagePage (Button) 
    UsageMinimum (1)
    UsageMaximum (3)
    LogicalMinimum (0)
    LogicalMaximum (1)
    ReportCount (3)
    ReportSize (1)
    Input (Data, Variable, Absolute)
    ReportCount (1)
    ReportSize (5)
    Input (Constant)
    UsagePage (GenericDesktop)
    Usage (GenericDesktopPage.X)
    Usage (GenericDesktopPage.Y)
    LogicalMinimum (-127)
    LogicalMaximum (127)
    ReportSize (8)
    ReportCount (2)
    Input(Data, Variable, Relative)
    EndCollection()
    EndCollection()
    '''
code = code.replace('\n','+')
code = code.replace(' ','')
code = code[:-1]
exec(code)
print(ReportDescContext.Data())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_hidreport-1.0.0a0-py38-none-any.whl (63.1 kB view details)

Uploaded Python 3.8

File details

Details for the file py_hidreport-1.0.0a0-py38-none-any.whl.

File metadata

  • Download URL: py_hidreport-1.0.0a0-py38-none-any.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: Python 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for py_hidreport-1.0.0a0-py38-none-any.whl
Algorithm Hash digest
SHA256 d19c35fd641591b7579ae67c762b83b43ba7011ed57b687e340e59ddd4653a2e
MD5 acf8b6d66a184a687909189f281bf5ab
BLAKE2b-256 6b139cc9cfb887d301dce2699ec32bf353a4f0a4512b2945d86f8f6107d700fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page