1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

USB Consolidate descriptor definitions

The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

	unsigned char	bRefresh
	unsigned char	bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h.  The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

-	if (iface->bInterfaceClass != USB_CLASS_HUB)
+	if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
This commit is contained in:
Tom Rix
2009-10-31 12:37:38 -05:00
committed by Remy Bohmer
parent bb3bcfa242
commit 8f8bd565f3
8 changed files with 61 additions and 110 deletions

View File

@@ -229,7 +229,7 @@ int usb_kbd_deregister(void)
static void usb_kbd_setled(struct usb_device *dev)
{
struct usb_interface_descriptor *iface;
struct usb_interface *iface;
iface = &dev->config.if_desc[0];
leds=0;
if(scroll_lock!=0)
@@ -242,7 +242,7 @@ static void usb_kbd_setled(struct usb_device *dev)
leds|=1;
usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
0x200, iface->bInterfaceNumber,(void *)&leds, 1, 0);
0x200, iface->desc.bInterfaceNumber, (void *)&leds, 1, 0);
}
@@ -348,17 +348,21 @@ static int usb_kbd_irq(struct usb_device *dev)
/* probes the USB device dev for keyboard type */
static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
{
struct usb_interface_descriptor *iface;
struct usb_interface *iface;
struct usb_endpoint_descriptor *ep;
int pipe,maxp;
if (dev->descriptor.bNumConfigurations != 1) return 0;
iface = &dev->config.if_desc[ifnum];
if (iface->bInterfaceClass != 3) return 0;
if (iface->bInterfaceSubClass != 1) return 0;
if (iface->bInterfaceProtocol != 1) return 0;
if (iface->bNumEndpoints != 1) return 0;
if (iface->desc.bInterfaceClass != 3)
return 0;
if (iface->desc.bInterfaceSubClass != 1)
return 0;
if (iface->desc.bInterfaceProtocol != 1)
return 0;
if (iface->desc.bNumEndpoints != 1)
return 0;
ep = &iface->ep_desc[0];
@@ -367,9 +371,9 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
USB_KBD_PRINTF("USB KBD found set protocol...\n");
/* ok, we found a USB Keyboard, install it */
/* usb_kbd_get_hid_desc(dev); */
usb_set_protocol(dev, iface->bInterfaceNumber, 0);
usb_set_protocol(dev, iface->desc.bInterfaceNumber, 0);
USB_KBD_PRINTF("USB KBD found set idle...\n");
usb_set_idle(dev, iface->bInterfaceNumber, REPEAT_RATE, 0);
usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0);
memset(&new[0], 0, 8);
memset(&old[0], 0, 8);
repeat_delay=0;