2009-02-08 Marco Gerards <marco@gnu.org>
* Makefile.in (enable_grub_emu_usb): New variable.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/scsi.c'.
(grub_emu_SOURCES) [grub_emu_SOURCES]: Add `disk/usbms.c',
`util/usb.c', `bus/usb/usb.c' and `commands/usbtest.c'.
(grub_emu_LDFLAGS): Add `$(LIBUSB)'.
(pkglib_MODULES): Add `usb.mod', `uhci.mod', `ohci.mod',
`usbtest.mod' and `usbms.mod'.
(usb_mod_SOURCES, usb_mod_CFLAGS, usb_mod_LDFLAGS)
(usbtest_mod_SOURCES, usbtest_mod_CFLAGS, usbtest_mod_LDFLAGS)
(uhci_mod_SOURCES, uhci_mod_CFLAGS, uhci_mod_LDFLAGS,
(ohci_mod_SOURCES, ohci_mod_CFLAGS, ohci_mod_LDFLAGS)
(usbms_mod_SOURCES, usbms_mod_CFLAGS, usbms_mod_LDFLAGS): New
variables.
* disk/usbms.c: New file.
* include/grub/usb.h: Likewise.
* include/grub/usbtrans.h: Likewise.
* include/grub/usbdesc.h: Likewise.
* bus/usb/usbtrans.c: Likewise.
* bus/usb/ohci.c: Likewise.
* bus/usb/uhci.c: Likewise.
* bus/usb/usbhub.c: Likewise.
* bus/usb/usb.c: Likewise.
* commands/usbtest.c: Likewise.
* util/usb.c: Likewise.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_IO'.
* configure.ac: Test for libusb presence.
* util/grub-emu.c (main) [HAVE_LIBUSB_H]: Call `grub_libusb_init'.
2009-02-08 17:58:32 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2010-08-01 21:08:03 +00:00
|
|
|
struct grub_usb_desc
|
|
|
|
{
|
|
|
|
grub_uint8_t length;
|
|
|
|
grub_uint8_t type;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2009-02-08 Marco Gerards <marco@gnu.org>
* Makefile.in (enable_grub_emu_usb): New variable.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/scsi.c'.
(grub_emu_SOURCES) [grub_emu_SOURCES]: Add `disk/usbms.c',
`util/usb.c', `bus/usb/usb.c' and `commands/usbtest.c'.
(grub_emu_LDFLAGS): Add `$(LIBUSB)'.
(pkglib_MODULES): Add `usb.mod', `uhci.mod', `ohci.mod',
`usbtest.mod' and `usbms.mod'.
(usb_mod_SOURCES, usb_mod_CFLAGS, usb_mod_LDFLAGS)
(usbtest_mod_SOURCES, usbtest_mod_CFLAGS, usbtest_mod_LDFLAGS)
(uhci_mod_SOURCES, uhci_mod_CFLAGS, uhci_mod_LDFLAGS,
(ohci_mod_SOURCES, ohci_mod_CFLAGS, ohci_mod_LDFLAGS)
(usbms_mod_SOURCES, usbms_mod_CFLAGS, usbms_mod_LDFLAGS): New
variables.
* disk/usbms.c: New file.
* include/grub/usb.h: Likewise.
* include/grub/usbtrans.h: Likewise.
* include/grub/usbdesc.h: Likewise.
* bus/usb/usbtrans.c: Likewise.
* bus/usb/ohci.c: Likewise.
* bus/usb/uhci.c: Likewise.
* bus/usb/usbhub.c: Likewise.
* bus/usb/usb.c: Likewise.
* commands/usbtest.c: Likewise.
* util/usb.c: Likewise.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_IO'.
* configure.ac: Test for libusb presence.
* util/grub-emu.c (main) [HAVE_LIBUSB_H]: Call `grub_libusb_init'.
2009-02-08 17:58:32 +00:00
|
|
|
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;
|
2009-06-10 21:04:23 +00:00
|
|
|
grub_uint8_t configcnt;
|
2009-02-08 Marco Gerards <marco@gnu.org>
* Makefile.in (enable_grub_emu_usb): New variable.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/scsi.c'.
(grub_emu_SOURCES) [grub_emu_SOURCES]: Add `disk/usbms.c',
`util/usb.c', `bus/usb/usb.c' and `commands/usbtest.c'.
(grub_emu_LDFLAGS): Add `$(LIBUSB)'.
(pkglib_MODULES): Add `usb.mod', `uhci.mod', `ohci.mod',
`usbtest.mod' and `usbms.mod'.
(usb_mod_SOURCES, usb_mod_CFLAGS, usb_mod_LDFLAGS)
(usbtest_mod_SOURCES, usbtest_mod_CFLAGS, usbtest_mod_LDFLAGS)
(uhci_mod_SOURCES, uhci_mod_CFLAGS, uhci_mod_LDFLAGS,
(ohci_mod_SOURCES, ohci_mod_CFLAGS, ohci_mod_LDFLAGS)
(usbms_mod_SOURCES, usbms_mod_CFLAGS, usbms_mod_LDFLAGS): New
variables.
* disk/usbms.c: New file.
* include/grub/usb.h: Likewise.
* include/grub/usbtrans.h: Likewise.
* include/grub/usbdesc.h: Likewise.
* bus/usb/usbtrans.c: Likewise.
* bus/usb/ohci.c: Likewise.
* bus/usb/uhci.c: Likewise.
* bus/usb/usbhub.c: Likewise.
* bus/usb/usb.c: Likewise.
* commands/usbtest.c: Likewise.
* util/usb.c: Likewise.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_IO'.
* configure.ac: Test for libusb presence.
* util/grub-emu.c (main) [HAVE_LIBUSB_H]: Call `grub_libusb_init'.
2009-02-08 17:58:32 +00:00
|
|
|
} __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
|
2009-05-04 20:06:05 +00:00
|
|
|
struct grub_usb_desc_if_association
|
2009-02-08 Marco Gerards <marco@gnu.org>
* Makefile.in (enable_grub_emu_usb): New variable.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/scsi.c'.
(grub_emu_SOURCES) [grub_emu_SOURCES]: Add `disk/usbms.c',
`util/usb.c', `bus/usb/usb.c' and `commands/usbtest.c'.
(grub_emu_LDFLAGS): Add `$(LIBUSB)'.
(pkglib_MODULES): Add `usb.mod', `uhci.mod', `ohci.mod',
`usbtest.mod' and `usbms.mod'.
(usb_mod_SOURCES, usb_mod_CFLAGS, usb_mod_LDFLAGS)
(usbtest_mod_SOURCES, usbtest_mod_CFLAGS, usbtest_mod_LDFLAGS)
(uhci_mod_SOURCES, uhci_mod_CFLAGS, uhci_mod_LDFLAGS,
(ohci_mod_SOURCES, ohci_mod_CFLAGS, ohci_mod_LDFLAGS)
(usbms_mod_SOURCES, usbms_mod_CFLAGS, usbms_mod_LDFLAGS): New
variables.
* disk/usbms.c: New file.
* include/grub/usb.h: Likewise.
* include/grub/usbtrans.h: Likewise.
* include/grub/usbdesc.h: Likewise.
* bus/usb/usbtrans.c: Likewise.
* bus/usb/ohci.c: Likewise.
* bus/usb/uhci.c: Likewise.
* bus/usb/usbhub.c: Likewise.
* bus/usb/usb.c: Likewise.
* commands/usbtest.c: Likewise.
* util/usb.c: Likewise.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_IO'.
* configure.ac: Test for libusb presence.
* util/grub-emu.c (main) [HAVE_LIBUSB_H]: Call `grub_libusb_init'.
2009-02-08 17:58:32 +00:00
|
|
|
{
|
|
|
|
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 */
|