Add usbd_reload_device_desc() to get the device descriptor again from a device.

Useful if e.g. downloading firmware updates the revision number.
This commit is contained in:
augustss 2000-01-16 23:11:43 +00:00
parent f96d767523
commit cc381bcb7c
3 changed files with 30 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: usb_subr.c,v 1.61 1999/12/18 22:51:58 augustss Exp $ */
/* $NetBSD: usb_subr.c,v 1.62 2000/01/16 23:11:43 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@ -998,8 +998,7 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
USETW(dev->def_ep_desc.wMaxPacketSize, dd->bMaxPacketSize);
/* Get the full device descriptor. */
err = usbd_get_device_desc(dev, dd);
err = usbd_reload_device_desc(dev);
if (err) {
DPRINTFN(-1, ("usbd_new_device: addr=%d, getting full desc "
"failed\n", addr));
@ -1007,9 +1006,6 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
return (err);
}
/* Figure out what's wrong with this device. */
dev->quirks = usbd_find_quirk(dd);
/* Set the address */
err = usbd_set_address(dev, addr);
DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr));
@ -1042,6 +1038,23 @@ usbd_new_device(parent, bus, depth, lowspeed, port, up)
return (USBD_NORMAL_COMPLETION);
}
usbd_status
usbd_reload_device_desc(dev)
usbd_device_handle dev;
{
usbd_status err;
/* Get the full device descriptor. */
err = usbd_get_device_desc(dev, &dev->ddesc);
if (err)
return (err);
/* Figure out what's wrong with this device. */
dev->quirks = usbd_find_quirk(&dev->ddesc);
return (USBD_NORMAL_COMPLETION);
}
void
usbd_remove_device(dev, up)
usbd_device_handle dev;

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdi.c,v 1.56 2000/01/16 13:34:51 augustss Exp $ */
/* $NetBSD: usbdi.c,v 1.57 2000/01/16 23:11:43 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@ -151,8 +151,8 @@ usbd_open_pipe(iface, address, flags, pipe)
usbd_status err;
int i;
DPRINTFN(3,("usbd_open_pipe: address=0x%x flags=0x%x\n", address,
flags));
DPRINTFN(3,("usbd_open_pipe: iface=%p address=0x%x flags=0x%x\n",
iface, address, flags));
for (i = 0; i < iface->idesc->bNumEndpoints; i++) {
ep = &iface->endpoints[i];

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdi.h,v 1.37 2000/01/16 13:12:05 augustss Exp $ */
/* $NetBSD: usbdi.h,v 1.38 2000/01/16 23:11:43 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@ -174,6 +174,13 @@ const char *usbd_errstr __P((usbd_status err));
void usbd_add_event __P((int, usbd_device_handle));
void usbd_devinfo __P((usbd_device_handle, int, char *));
struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle));
usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor
__P((usbd_interface_handle iface, u_int8_t address));
usbd_status usbd_reload_device_desc __P((usbd_device_handle));
/* NetBSD attachment information */
/* Attach data */
@ -233,11 +240,6 @@ struct usb_attach_arg {
#endif
void usbd_devinfo __P((usbd_device_handle, int, char *));
struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle));
usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor
__P((usbd_interface_handle iface, u_int8_t address));
#if defined(__FreeBSD__)
int usbd_driver_load __P((module_t mod, int what, void *arg));
#endif