This patch creates an associate_dev(), which is the mirror to disassociate_dev(). It also adds some more printout when identifiying devices that qualify for US_*_DEVICE codes so we need less interaction with the reporting user.
Greg, please apply.
Matt
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.717 -> 1.718
# drivers/usb/storage/usb.c 1.76 -> 1.77
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/28 [EMAIL PROTECTED] 1.718
# Create a separate associate_dev, to match dissociate_dev().
#
# Add more information to the US_*_DEVICE detection printout, so we won't
# have to ask for additional information.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c Sat Jun 28 20:32:52 2003
+++ b/drivers/usb/storage/usb.c Sat Jun 28 20:32:52 2003
@@ -421,12 +421,28 @@
* Device probing and disconnecting
***********************************************************************/
+/* Associate our private data with the USB device */
+static void associate_dev(struct us_data *us, struct usb_interface *intf)
+{
+ US_DEBUGP("-- %s\n", __FUNCTION__);
+
+ /* Fill in the device-related fields */
+ us->pusb_dev = interface_to_usbdev(intf);
+ us->pusb_intf = intf;
+ us->ifnum = intf->altsetting->desc.bInterfaceNumber;
+
+ /* Store our private data in the interface and increment the
+ * device's reference count */
+ usb_set_intfdata(intf, us);
+ usb_get_dev(us->pusb_dev);
+}
+
/* Get the unusual_devs entries and the string descriptors */
static void get_device_info(struct us_data *us, int id_index)
{
struct usb_device *dev = us->pusb_dev;
- struct usb_host_interface *altsetting =
- &us->pusb_intf->altsetting[us->pusb_intf->act_altsetting];
+ struct usb_interface_descriptor *idesc =
+ &us->pusb_intf->altsetting[us->pusb_intf->act_altsetting].desc;
struct us_unusual_dev *unusual_dev = &us_unusual_dev_list[id_index];
struct usb_device_id *id = &storage_usb_ids[id_index];
@@ -438,10 +454,10 @@
/* Store the entries */
us->unusual_dev = unusual_dev;
us->subclass = (unusual_dev->useProtocol == US_SC_DEVICE) ?
- altsetting->desc.bInterfaceSubClass :
+ idesc->bInterfaceSubClass :
unusual_dev->useProtocol;
us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ?
- altsetting->desc.bInterfaceProtocol :
+ idesc->bInterfaceProtocol :
unusual_dev->useTransport;
us->flags = unusual_dev->flags;
@@ -455,20 +471,26 @@
"an unneeded SubClass entry",
"an unneeded Protocol entry",
"unneeded SubClass and Protocol entries"};
+ struct usb_device_descriptor *ddesc = &dev->descriptor;
int msg = -1;
if (unusual_dev->useProtocol != US_SC_DEVICE &&
- us->subclass == altsetting->desc.bInterfaceSubClass)
+ us->subclass == idesc->bInterfaceSubClass)
msg += 1;
if (unusual_dev->useTransport != US_PR_DEVICE &&
- us->protocol == altsetting->desc.bInterfaceProtocol)
+ us->protocol == idesc->bInterfaceProtocol)
msg += 2;
if (msg >= 0)
printk(KERN_NOTICE USB_STORAGE "This device "
- "(%04x,%04x) has %s in unusual_devs.h\n"
+ "(%04x,%04x,%04x S %02x P %02x)"
+ " has %s in unusual_devs.h\n"
" Please send a copy of this message to "
"<[EMAIL PROTECTED]>\n",
- id->idVendor, id->idProduct, msgs[msg]);
+ ddesc->idVendor, ddesc->idProduct,
+ ddesc->bcdDevice,
+ idesc->bInterfaceSubClass,
+ idesc->bInterfaceProtocol,
+ msgs[msg]);
}
/* Read the device's string descriptors */
@@ -857,15 +879,8 @@
init_MUTEX_LOCKED(&(us->sema));
init_completion(&(us->notify));
- /* Fill in the device-related fields */
- us->pusb_dev = interface_to_usbdev(intf);
- us->pusb_intf = intf;
- us->ifnum = intf->altsetting->desc.bInterfaceNumber;
-
- /* Store our private data in the interface and increment the
- * device's reference count */
- usb_set_intfdata(intf, us);
- usb_get_dev(us->pusb_dev);
+ /* Associate the us_data structure with the USB device */
+ associate_dev(us, intf);
/*
* Get the unusual_devs entries and the descriptors
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
What, are you one of those Microsoft-bashing Linux freaks?
-- Customer to Greg
User Friendly, 2/10/1999
pgp00000.pgp
Description: PGP signature
