summaryrefslogtreecommitdiffstats
path: root/usb/descriptors.h
blob: 8ff539e934b874eb704940bc2fe33631b3bce1fb (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef USB_DESCRIPTORS_H
#define USB_DESCRIPTORS_H

/* Device descriptor */
unsigned char ds_dev[] = {
	18, // Length
	1, // Descriptor type
	0x00, 0x02, // USB Release
	0xff, // Device class
	0x00, // Device sub class
	0x00, // Device protocol
	64, // Max packet size
	0xc0, 0x16, // VID
	0xdc, 0x05, // PID
	0x01, 0x00, // Device relase
	1, // Manufacturer string
	0, // Product string
	0, // Serial number string
	1, // Number of configurations
};

/* Configuration descriptor */
unsigned char ds_conf[] = {
	/* Configuration */
	9, // Length
	2, // Descriptor type
	0x22, 0x00, // Total length
	1, // Number of interfaces
	1, // Configuration value
	0, // Configuration string
	0xc0, // Attributes (1SR00000, S - Self powered, R - Remote wakeup)
	50, // Maximum current (multiples of 2mA)

	/* Interface */
	9, // Length
	4, // Descriptor type
	0, // Interface number
	0, // Alternate setting
	1, // Number of endpoints
	3, // Interface class
	1, // Interface sub class
	2, // Interface protocol
	0, // Interface string

	/* HID */
	9, // Length
	33, // Descriptor type
	0x11, 0x01, // HID Class spec version
	0, // Country code
	1, // Number of descriptors
	34, // Descriptor type
	0x34, 0x00, // Descriptor length

	/* Endpoint */
	7, // Length
	5, // Descriptor type
	0x81, // Endpoint address (D000NNNN, D - Direction (0 OUT, 1 IN), N - Endpoint No.)
	0x03, // Attributes (00UUSSTT, U - Usage type, S - Synch type, T - Transfer type)
	0x08, 0x00, // Max packet size
	64, // Interval (1ms Frames)
};

/* Language descriptor */
unsigned char ds_lang[] = {
	4, // Length
	3, // Descriptor type
	0x09, 0x04 // Language ID
};

/* String descriptor 1 */
unsigned char ds_str1[] = {
	22, // Length
	3, // Descriptor type
	0x74, 0x00, // t
	0x68, 0x00, // h
	0x65, 0x00, // e
	0x2d, 0x00, // -
	0x74, 0x00, // t
	0x6b, 0x00, // k
	0x2e, 0x00, // .
	0x63, 0x00, // c
	0x6f, 0x00, // o
	0x6d, 0x00, // m
};

#endif /* USB_DESCRIPTORS_H */