/* usb.c -- libusb USB support for GRUB. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* 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/>.
*/
#include <config.h>
#include <usb.h>
GRUB_MOD_LICENSE ("GPLv3+");
{
.name = "libusb"
};
static grub_err_t
grub_libusb_devices (void)
{
int last = 0;
busses = usb_get_busses();
{
{
continue;
if (! dev)
return grub_errno;
/* Fill in all descriptors. */
if (err)
{
continue;
}
/* Register the device. */
}
}
return GRUB_USB_ERR_NONE;
}
void
grub_usb_poll_devices (void)
{
/* TODO: recheck grub_usb_devs */
}
int
{
int i;
for (i = 0; i < 128; i++)
{
if (grub_usb_devs[i])
{
if (hook (grub_usb_devs[i]))
return 1;
}
}
return 0;
}
{
return GRUB_USB_ERR_NONE;
}
{
{
return GRUB_USB_ERR_STALL;
}
return GRUB_USB_ERR_NONE;
}
{
{
return GRUB_USB_ERR_STALL;
}
{
return GRUB_USB_ERR_STALL;
}
usb_release_interface (devh, 0);
return GRUB_USB_ERR_NONE;
}
{
if (usb_claim_interface (devh, 0) < 0)
goto fail;
goto fail;
if (usb_release_interface (devh, 0) < 0)
goto fail;
return GRUB_USB_ERR_NONE;
fail:
return GRUB_USB_ERR_STALL;
}
{
usb_init();
if (grub_libusb_devices ())
return;
return;
}
{
return;
}