descriptor_table.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from descriptor_generator import *
  2. device.set("bcdUSB", USB_BCD_11)
  3. device.set("bMaxPacketSize0", 16)
  4. device.set("bcdDevice", 0x0100)
  5. device.set("iManufacturer", u"Michael Buesch")
  6. device.set("iProduct", u"CNC Remote Control")
  7. device.set("iSerialNumber", u"1")
  8. config0 = Configuration(device)
  9. config0.set("iConfiguration", u"Configuration 1")
  10. config0.set("bmAttributes", USB_CONFIG_ATT_ONE)
  11. config0.set("bMaxPower", 300 // 2)
  12. interface0 = Interface(config0)
  13. interface0.set("bAlternateSetting", 0)
  14. interface0.set("bInterfaceClass", USB_CLASS_VENDOR_SPEC)
  15. interface0.set("iInterface", u"Interface 1")
  16. ep1in = Endpoint(interface0)
  17. ep1in.set("bEndpointAddress", 1 | USB_ENDPOINT_IN)
  18. ep1in.set("bmAttributes", USB_ENDPOINT_XFER_INT)
  19. ep1in.set("wMaxPacketSize", 16)
  20. ep1in.set("bInterval", 20)
  21. ep2in = Endpoint(interface0)
  22. ep2in.set("bEndpointAddress", 2 | USB_ENDPOINT_IN)
  23. ep2in.set("bmAttributes", USB_ENDPOINT_XFER_BULK)
  24. ep2in.set("wMaxPacketSize", 64)
  25. ep2out = Endpoint(interface0)
  26. ep2out.set("bEndpointAddress", 2 | USB_ENDPOINT_OUT)
  27. ep2out.set("bmAttributes", USB_ENDPOINT_XFER_BULK)
  28. ep2out.set("wMaxPacketSize", 64)