コード例 #1
0
ファイル: usb_subr.c プロジェクト: ryo/netbsd-src
usbd_status
usbd_reload_device_desc(struct usbd_device *dev)
{
	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
	usb_device_descriptor_t *udd = &dev->ud_ddesc;
	usbd_status err;

	/* Get the full device descriptor. */
	err = usbd_get_device_desc(dev, udd);
	if (err)
		return err;

	DPRINTFN(15, "bLength             %5u", udd->bLength, 0, 0, 0);
	DPRINTFN(15, "bDescriptorType     %5u", udd->bDescriptorType, 0, 0, 0);
	DPRINTFN(15, "bcdUSB              %2x.%02x", udd->bcdUSB[1],
	    udd->bcdUSB[0], 0, 0);
	DPRINTFN(15, "bDeviceClass        %5u", udd->bDeviceClass, 0, 0, 0);
	DPRINTFN(15, "bDeviceSubClass     %5u", udd->bDeviceSubClass, 0, 0, 0);
	DPRINTFN(15, "bDeviceProtocol     %5u", udd->bDeviceProtocol, 0, 0, 0);
	DPRINTFN(15, "bMaxPacketSize0     %5u", udd->bMaxPacketSize, 0, 0, 0);
	DPRINTFN(15, "idVendor           0x%04x", udd->idVendor, 0, 0, 0);
	DPRINTFN(15, "idProduct          0x%04x", udd->idProduct, 0, 0, 0);
	DPRINTFN(15, "bcdDevice           %2x.%02x", udd->bcdDevice[1],
	    udd->bcdDevice[0], 0, 0);
	DPRINTFN(15, "iManufacturer       %5u", udd->iManufacturer, 0, 0, 0);
	DPRINTFN(15, "iProduct            %5u", udd->iProduct, 0, 0, 0);
	DPRINTFN(15, "iSerial             %5u", udd->iSerialNumber, 0, 0, 0);
	DPRINTFN(15, "bNumConfigurations  %5u", udd->bNumConfigurations, 0, 0,
	    0);

	/* Figure out what's wrong with this device. */
	dev->ud_quirks = usbd_find_quirk(udd);

	return USBD_NORMAL_COMPLETION;
}
コード例 #2
0
usbd_status
usbd_reload_device_desc(usbd_device_handle dev)
{
	usbd_status err;
	int i;

	/* Get the full device descriptor. */
	for (i = 0; i < 3; ++i) {
		err = usbd_get_device_desc(dev, &dev->ddesc);
		if (!err)
			break;
 		usbd_delay_ms(dev, 200);
	}
	if (err)
		return (err);

	/* Figure out what's wrong with this device. */
	dev->quirks = usbd_find_quirk(&dev->ddesc);

	return (USBD_NORMAL_COMPLETION);
}