1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
from descriptor_generator import *
device.set("bcdUSB", USB_BCD_11)
device.set("bMaxPacketSize0", 16)
device.set("idVendor", 0x6666)
device.set("idProduct", 0x3073)
device.set("bcdDevice", 0x0001)
device.set("iManufacturer", u"Michael Buesch")
device.set("iProduct", u"pcremote HID")
device.set("iSerialNumber", u"1")
config0 = Configuration(device)
config0.set("iConfiguration", u"Configuration 1")
config0.set("bmAttributes", USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER)
config0.set("bMaxPower", 50 / 2)
interface0 = Interface(config0)
interface0.set("bAlternateSetting", 0)
interface0.set("bInterfaceClass", USB_CLASS_HID)
interface0.set("bInterfaceSubClass", 1)#XXX
interface0.set("bInterfaceProtocol", 2)#XXX
interface0.set("iInterface", u"Interface 1")
hid = HIDDevice(interface0)
hid.set("bcdHID", 0x0111)
hid.set("bNumDescriptors", 1)
hid.set("bClassDescriptorType", HID_DT_REPORT)
ep1in = Endpoint(interface0)
ep1in.set("bEndpointAddress", 1 | USB_ENDPOINT_IN)
ep1in.set("bmAttributes", USB_ENDPOINT_XFER_BULK)
ep1in.set("wMaxPacketSize", 64)
ep1out = Endpoint(interface0)
ep1out.set("bEndpointAddress", 1 | USB_ENDPOINT_OUT)
ep1out.set("bmAttributes", USB_ENDPOINT_XFER_BULK)
ep1out.set("wMaxPacketSize", 64)
ep2in = Endpoint(interface0)
ep2in.set("bEndpointAddress", 2 | USB_ENDPOINT_IN)
ep2in.set("bmAttributes", USB_ENDPOINT_XFER_INT)
ep2in.set("wMaxPacketSize", 64)
ep2in.set("bInterval", 10)
|