~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to include/grub/usb.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef GRUB_USB_H
20
20
#define GRUB_USB_H      1
21
21
 
 
22
#include <grub/err.h>
22
23
#include <grub/usbdesc.h>
23
24
#include <grub/usbtrans.h>
24
25
 
29
30
typedef enum
30
31
  {
31
32
    GRUB_USB_ERR_NONE,
 
33
    GRUB_USB_ERR_WAIT,
32
34
    GRUB_USB_ERR_INTERNAL,
33
35
    GRUB_USB_ERR_STALL,
34
36
    GRUB_USB_ERR_DATA,
35
37
    GRUB_USB_ERR_NAK,
36
38
    GRUB_USB_ERR_BABBLE,
37
39
    GRUB_USB_ERR_TIMEOUT,
38
 
    GRUB_USB_ERR_BITSTUFF
 
40
    GRUB_USB_ERR_BITSTUFF,
 
41
    GRUB_USB_ERR_UNRECOVERABLE
39
42
  } grub_usb_err_t;
40
43
 
41
44
typedef enum
87
90
grub_usb_root_hub (grub_usb_controller_t controller);
88
91
 
89
92
 
 
93
 
90
94
/* XXX: All handled by libusb for now.  */
91
95
struct grub_usb_controller_dev
92
96
{
95
99
 
96
100
  int (*iterate) (int (*hook) (grub_usb_controller_t dev));
97
101
 
98
 
  grub_usb_err_t (*transfer) (grub_usb_controller_t dev,
99
 
                              grub_usb_transfer_t transfer);
 
102
  grub_usb_err_t (*setup_transfer) (grub_usb_controller_t dev,
 
103
                                    grub_usb_transfer_t transfer);
 
104
 
 
105
  grub_usb_err_t (*check_transfer) (grub_usb_controller_t dev,
 
106
                                    grub_usb_transfer_t transfer,
 
107
                                    grub_size_t *actual);
 
108
 
 
109
  grub_usb_err_t (*cancel_transfer) (grub_usb_controller_t dev,
 
110
                                     grub_usb_transfer_t transfer);
100
111
 
101
112
  int (*hubports) (grub_usb_controller_t dev);
102
113
 
103
114
  grub_err_t (*portstatus) (grub_usb_controller_t dev, unsigned int port,
104
115
                            unsigned int enable);
105
116
 
106
 
  grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port);
 
117
  grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
107
118
 
 
119
  /* Per controller flag - port reset pending, don't do another reset */
 
120
  grub_uint64_t pending_reset;
 
121
  
108
122
  /* The next host controller.  */
109
123
  struct grub_usb_controller_dev *next;
110
124
};
124
138
  struct grub_usb_desc_if *descif;
125
139
 
126
140
  struct grub_usb_desc_endp *descendp;
 
141
 
 
142
  /* A driver is handling this interface. Do we need to support multiple drivers
 
143
     for single interface?
 
144
   */
 
145
  int attached;
 
146
 
 
147
  void (*detach_hook) (struct grub_usb_device *dev, int config, int interface);
 
148
 
 
149
  void *detach_data;
127
150
};
128
151
 
129
152
struct grub_usb_configuration
156
179
  int initialized;
157
180
 
158
181
  /* Data toggle values (used for bulk transfers only).  */
159
 
  int toggle[16];
 
182
  int toggle[256];
160
183
 
161
 
  /* Device-specific data.  */
 
184
  /* Used by libusb wrapper.  Schedulded for removal. */
162
185
  void *data;
 
186
 
 
187
  /* Hub information.  */
 
188
 
 
189
  /* Array of children for a hub.  */
 
190
  grub_usb_device_t *children;
 
191
 
 
192
  /* Number of hub ports.  */
 
193
  unsigned nports;
 
194
 
 
195
  grub_usb_transfer_t hub_transfer;
 
196
 
 
197
  grub_uint32_t statuschange;
 
198
 
 
199
  struct grub_usb_desc_endp *hub_endpoint;
163
200
};
164
201
 
165
202
 
166
203
 
 
204
typedef enum grub_usb_ep_type
 
205
  {
 
206
    GRUB_USB_EP_CONTROL,
 
207
    GRUB_USB_EP_ISOCHRONOUS,
 
208
    GRUB_USB_EP_BULK,
 
209
    GRUB_USB_EP_INTERRUPT
 
210
  } grub_usb_ep_type_t;
 
211
 
 
212
static inline enum grub_usb_ep_type
 
213
grub_usb_get_ep_type (struct grub_usb_desc_endp *ep)
 
214
{
 
215
  return ep->attrib & 3;
 
216
}
 
217
 
167
218
typedef enum
168
219
  {
169
220
    GRUB_USB_CLASS_NOTHERE,
184
235
 
185
236
typedef enum
186
237
  {
187
 
    GRUB_USBMS_SUBCLASS_BULK = 0x06
 
238
    GRUB_USBMS_SUBCLASS_BULK = 0x06,
 
239
        /* Experimental support for non-pure SCSI devices */
 
240
    GRUB_USBMS_SUBCLASS_RBC = 0x01,
 
241
    GRUB_USBMS_SUBCLASS_MMC2 = 0x02,
 
242
    GRUB_USBMS_SUBCLASS_UFI = 0x04,
 
243
    GRUB_USBMS_SUBCLASS_SFF8070 = 0x05
188
244
  } grub_usbms_subclass_t;
189
245
 
190
246
typedef enum
201
257
  return interf;
202
258
}
203
259
 
 
260
typedef int (*grub_usb_attach_hook_class) (grub_usb_device_t usbdev,
 
261
                                           int configno, int interfno);
 
262
 
 
263
struct grub_usb_attach_desc
 
264
{
 
265
  struct grub_usb_attach_desc *next;
 
266
  int class;
 
267
  grub_usb_attach_hook_class hook;
 
268
};
 
269
 
 
270
void grub_usb_register_attach_hook_class (struct grub_usb_attach_desc *desc);
 
271
void grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc);
 
272
 
 
273
void grub_usb_poll_devices (void);
 
274
 
 
275
void grub_usb_device_attach (grub_usb_device_t dev);
 
276
grub_usb_err_t
 
277
grub_usb_bulk_read_extended (grub_usb_device_t dev,
 
278
                             int endpoint, grub_size_t size, char *data,
 
279
                             int timeout, grub_size_t *actual);
 
280
grub_usb_transfer_t
 
281
grub_usb_bulk_read_background (grub_usb_device_t dev,
 
282
                              int endpoint, grub_size_t size, void *data);
 
283
grub_usb_err_t
 
284
grub_usb_check_transfer (grub_usb_transfer_t trans, grub_size_t *actual);
 
285
void
 
286
grub_usb_cancel_transfer (grub_usb_transfer_t trans);
 
287
 
204
288
#endif /* GRUB_USB_H */