aboutsummaryrefslogtreecommitdiffstats
path: root/include/grub/usbdesc.h
blob: 84b723a62dcb3c2c553ec7a9cf4bf73b3e311997 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2008  Free Software Foundation, Inc.
 *
 *  GRUB is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  GRUB is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef	GRUB_USBDESC_H
#define	GRUB_USBDESC_H	1

#include <grub/types.h>
#include <grub/symbol.h>

typedef enum {
  GRUB_USB_DESCRIPTOR_DEVICE = 1,
  GRUB_USB_DESCRIPTOR_CONFIG,
  GRUB_USB_DESCRIPTOR_STRING,
  GRUB_USB_DESCRIPTOR_INTERFACE,
  GRUB_USB_DESCRIPTOR_ENDPOINT,
  GRUB_USB_DESCRIPTOR_HUB = 0x29
} grub_usb_descriptor_t;

struct grub_usb_desc
{
  grub_uint8_t length;
  grub_uint8_t type;
} __attribute__ ((packed));

struct grub_usb_desc_device
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t usbrel;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t maxsize0;
  grub_uint16_t vendorid;
  grub_uint16_t prodid;
  grub_uint16_t devrel;
  grub_uint8_t strvendor;
  grub_uint8_t strprod;
  grub_uint8_t strserial;
  grub_uint8_t configcnt;
} __attribute__ ((packed));

struct grub_usb_desc_config
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t totallen;
  grub_uint8_t numif;
  grub_uint8_t config;
  grub_uint8_t strconfig;
  grub_uint8_t attrib;
  grub_uint8_t maxpower;
} __attribute__ ((packed));

#if 0
struct grub_usb_desc_if_association
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t firstif;
  grub_uint8_t ifcnt;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t function;
} __attribute__ ((packed));
#endif

struct grub_usb_desc_if
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t ifnum;
  grub_uint8_t altsetting;
  grub_uint8_t endpointcnt;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t strif;
} __attribute__ ((packed));

struct grub_usb_desc_endp
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t endp_addr;
  grub_uint8_t attrib;
  grub_uint16_t maxpacket;
  grub_uint8_t interval;
} __attribute__ ((packed));

struct grub_usb_desc_str
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t str[0];
} __attribute__ ((packed));

struct grub_usb_usb_hubdesc
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t portcnt;
  grub_uint16_t characteristics;
  grub_uint8_t pwdgood;
  grub_uint8_t current;
  /* Removable and power control bits follow.  */
} __attribute__ ((packed));

#endif /* GRUB_USBDESC_H */