diff options
| author | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-07-23 23:58:25 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-07-23 23:58:25 -0700 |
| commit | 0cd3abcabdb580da7811d4952b25b2403fcc89b4 (patch) | |
| tree | 0000470d0a40a2413b0a617d4380c3f97a71b33e /drivers/usb/core | |
| parent | 97db62cc99a0d92650fbf23b7fbc034107eb01f3 (diff) | |
| parent | f5dbd9a03b95c184c7464ef6c9ef18b62b3217ee (diff) | |
Merge http://linuxusb.bkbits.net/linus-2.5
into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
Diffstat (limited to 'drivers/usb/core')
| -rw-r--r-- | drivers/usb/core/message.c | 12 | ||||
| -rw-r--r-- | drivers/usb/core/usb.c | 78 |
2 files changed, 49 insertions, 41 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index bd39ec76b063..b7955bc73ae0 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -436,17 +436,21 @@ int usb_clear_halt(struct usb_device *dev, int pipe) * Within any given configuration, each interface may have several * alternative settings. These are often used to control levels of * bandwidth consumption. For example, the default setting for a high - * speed interrupt endpoint may not send more than about 4KBytes per - * microframe, and isochronous endpoints may never be part of a an + * speed interrupt endpoint may not send more than 64 bytes per microframe, + * while interrupt transfers of up to 3KBytes per microframe are legal. + * Also, isochronous endpoints may never be part of an * interface's default setting. To access such bandwidth, alternate - * interface setting must be made current. + * interface settings must be made current. * * Note that in the Linux USB subsystem, bandwidth associated with - * an endpoint in a given alternate setting is not reserved until an + * an endpoint in a given alternate setting is not reserved until an URB * is submitted that needs that bandwidth. Some other operating systems * allocate bandwidth early, when a configuration is chosen. * * This call is synchronous, and may not be used in an interrupt context. + * Also, drivers must not change altsettings while urbs are scheduled for + * endpoints in that interface; all such urbs must first be completed + * (perhaps forced by unlinking). * * Returns zero on success, or else the status code returned by the * underlying usb_control_msg() call. diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 914abb2f3c3e..f1884e5ec9c2 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -947,8 +947,9 @@ static void usb_find_drivers(struct usb_device *dev) /* register this interface with driverfs */ interface->dev.parent = &dev->dev; interface->dev.bus = &usb_bus_type; - sprintf (&interface->dev.bus_id[0], "if%d", - interface->altsetting->bInterfaceNumber); + sprintf (&interface->dev.bus_id[0], "%s:%d", + dev->devpath, + interface->altsetting->bInterfaceNumber); if (!desc->iInterface || usb_string (dev, desc->iInterface, interface->dev.name, @@ -1288,56 +1289,59 @@ int usb_set_address(struct usb_device *dev) */ static void set_device_description (struct usb_device *dev) { - char *buf, *here, *end; + void *buf; int mfgr = dev->descriptor.iManufacturer; int prod = dev->descriptor.iProduct; + int vendor_id = dev->descriptor.idVendor; + int product_id = dev->descriptor.idProduct; + char *mfgr_str, *prod_str; - /* set default; keep it if there are no strings */ + /* set default; keep it if there are no strings, or kmalloc fails */ sprintf (dev->dev.name, "USB device %04x:%04x", - dev->descriptor.idVendor, - dev->descriptor.idProduct); - if (!mfgr && !prod) - return; + vendor_id, product_id); - if (!(buf = kmalloc(256, GFP_KERNEL))) + if (!(buf = kmalloc(256 * 2, GFP_KERNEL))) return; - here = dev->dev.name; - end = here + sizeof dev->dev.name - 2; - *end = 0; + + prod_str = (char *) buf; + mfgr_str = (char *) buf + 256; - /* much like pci ... describe as either: - * - both strings: 'product descr (vendor descr)' - * - product only: 'product descr (USB device vvvv:pppp)' - * - vendor only: 'USB device vvvv:pppp (vendor descr)' - * - neither string: 'USB device vvvv:pppp' - */ - if (prod && usb_string (dev, prod, buf, 256) > 0) { - strncpy (here, buf, end - here); + if (prod && usb_string (dev, prod, prod_str, 256) > 0) { #ifdef DEBUG - printk (KERN_INFO "Product: %s\n", buf); + printk (KERN_INFO "Product: %s\n", prod_str); #endif } else { - buf [0] = 0; - prod = -1; + prod_str = 0; } - here = strchr (here, 0); - if (mfgr && usb_string (dev, mfgr, buf, 256) > 0) { - *here++ = ' '; - *here++ = '('; - strncpy (here, buf, end - here - 1); - here = strchr (here, 0); - *here++ = ')'; + + if (mfgr && usb_string (dev, mfgr, mfgr_str, 256) > 0) { #ifdef DEBUG - printk (KERN_INFO "Manufacturer: %s\n", buf); + printk (KERN_INFO "Manufacturer: %s\n", mfgr_str); #endif } else { - if (prod != -1) - snprintf (here, end - here - 1, - " (USB device %04x:%04x)", - dev->descriptor.idVendor, - dev->descriptor.idProduct); - /* both strings unavailable, keep the default */ + mfgr_str = 0; } + + /* much like pci ... describe as either: + * - both strings: 'product descr (vendor descr)' + * - product only: 'product descr (USB device vvvv:pppp)' + * - vendor only: 'USB device vvvv:pppp (vendor descr)' + * - neither string: 'USB device vvvv:pppp' + */ + + if (prod_str && mfgr_str) { + snprintf(dev->dev.name, sizeof dev->dev.name, + "%s (%s)", prod_str, mfgr_str); + } else if (prod_str) { + snprintf(dev->dev.name, sizeof dev->dev.name, + "%s (USB device %04x:%04x)", + prod_str, vendor_id, product_id); + } else if (mfgr_str) { + snprintf(dev->dev.name, sizeof dev->dev.name, + "USB device %04x:%04x (%s)", + vendor_id, product_id, mfgr_str); + } + kfree(buf); } |
