diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/rio500.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/Config.in | 1 | ||||
-rw-r--r-- | drivers/usb/serial/usbserial.c | 23 | ||||
-rw-r--r-- | drivers/usb/serial/visor.c | 7 | ||||
-rw-r--r-- | drivers/usb/storage/debug.h | 2 | ||||
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 2 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_devs.h | 232 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 425 | ||||
-rw-r--r-- | drivers/usb/storage/usb.h | 9 |
9 files changed, 416 insertions, 288 deletions
diff --git a/drivers/usb/rio500.c b/drivers/usb/rio500.c index 6d7b9043d..29b926056 100644 --- a/drivers/usb/rio500.c +++ b/drivers/usb/rio500.c @@ -247,6 +247,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd, return 0; err_out: + up(&(rio->lock)); return retval; } @@ -389,7 +390,7 @@ read_rio(struct file *file, char *buffer, size_t count, loff_t * ppos) result, partial, this_read); return -EIO; } else { - unlock_kernel(); + up(&(rio->lock)); return (0); } diff --git a/drivers/usb/serial/Config.in b/drivers/usb/serial/Config.in index 6d949bc0b..0032f6e15 100644 --- a/drivers/usb/serial/Config.in +++ b/drivers/usb/serial/Config.in @@ -22,6 +22,7 @@ if [ "$CONFIG_USB_SERIAL" != "n" ]; then bool ' USB Keyspan USA-19 Firmware' CONFIG_USB_SERIAL_KEYSPAN_USA19 bool ' USB Keyspan USA-18X Firmware' CONFIG_USB_SERIAL_KEYSPAN_USA18X bool ' USB Keyspan USA-19W Firmware' CONFIG_USB_SERIAL_KEYSPAN_USA19W + bool ' USB Keyspan USA-49W Firmware' CONFIG_USB_SERIAL_KEYSPAN_USA49W fi dep_tristate ' USB MCT Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_MCT_U232 $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL dep_tristate ' USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_OMNINET $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL diff --git a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c index 1a07a03d5..3a3451e49 100644 --- a/drivers/usb/serial/usbserial.c +++ b/drivers/usb/serial/usbserial.c @@ -14,8 +14,14 @@ * based on a driver by Brad Keryan) * * See Documentation/usb/usb-serial.txt for more information on using this driver - * - * (12/29/2000) gkh + * + * (12/12/2000) gkh + * Removed MOD_INC and MOD_DEC from poll and disconnect functions, and + * moved them to the serial_open and serial_close functions. + * Also fixed bug with there not being a MOD_DEC for the generic driver + * (thanks to Gary Brubaker for finding this.) + * + * (11/29/2000) gkh * Small NULL pointer initialization cleanup which saves a bit of disk image * * (11/01/2000) Adam J. Richter @@ -471,6 +477,8 @@ static int serial_open (struct tty_struct *tty, struct file * filp) return -ENODEV; } + MOD_INC_USE_COUNT; + /* set up our port structure making the tty driver remember our port object, and us it */ portNumber = MINOR(tty->device) - serial->minor; port = &serial->port[portNumber]; @@ -508,6 +516,8 @@ static void serial_close(struct tty_struct *tty, struct file * filp) } else { generic_close(port, filp); } + + MOD_DEC_USE_COUNT; } @@ -721,12 +731,13 @@ static int generic_open (struct usb_serial_port *port, struct file *filp) if (port_paranoia_check (port, __FUNCTION__)) return -ENODEV; + MOD_INC_USE_COUNT; + dbg(__FUNCTION__ " - port %d", port->number); spin_lock_irqsave (&port->port_lock, flags); ++port->open_count; - MOD_INC_USE_COUNT; if (!port->active) { port->active = 1; @@ -776,6 +787,7 @@ static void generic_close (struct usb_serial_port *port, struct file * filp) } spin_unlock_irqrestore (&port->port_lock, flags); + MOD_DEC_USE_COUNT; } @@ -1069,7 +1081,6 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, } /* found all that we need */ - MOD_INC_USE_COUNT; info("%s converter detected", type->name); #ifdef CONFIG_USB_SERIAL_GENERIC @@ -1077,7 +1088,6 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, num_ports = num_bulk_out; if (num_ports == 0) { err("Generic device with no bulk out, not allowed."); - MOD_DEC_USE_COUNT; return NULL; } } else @@ -1087,7 +1097,6 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, serial = get_free_serial (num_ports, &minor); if (serial == NULL) { err("No more free serial devices"); - MOD_DEC_USE_COUNT; return NULL; } @@ -1233,7 +1242,6 @@ probe_error: /* free up any memory that we allocated */ kfree (serial); - MOD_DEC_USE_COUNT; return NULL; } @@ -1300,7 +1308,6 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr) info("device disconnected"); } - MOD_DEC_USE_COUNT; } diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index e363916b9..d8a60a2a7 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -10,6 +10,10 @@ * (at your option) any later version. * * See Documentation/usb/usb-serial.txt for more information on using this driver + * + * (12/12/2000) gkh + * Moved MOD_DEC to end of visor_close to be nicer, as the final write + * message can sleep. * * (11/12/2000) gkh * Fixed bug with data being dropped on the floor by forcing tty->low_latency @@ -214,7 +218,6 @@ static void visor_close (struct usb_serial_port *port, struct file * filp) spin_lock_irqsave (&port->port_lock, flags); --port->open_count; - MOD_DEC_USE_COUNT; if (port->open_count <= 0) { transfer_buffer = kmalloc (0x12, GFP_KERNEL); @@ -237,6 +240,8 @@ static void visor_close (struct usb_serial_port *port, struct file * filp) /* Uncomment the following line if you want to see some statistics in your syslog */ /* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */ + + MOD_DEC_USE_COUNT; } diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h index 5123f85f8..c5477dcaf 100644 --- a/drivers/usb/storage/debug.h +++ b/drivers/usb/storage/debug.h @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Debugging Functions Header File * - * $Id: debug.h,v 1.5 2000/09/04 02:12:47 groovyjava Exp $ + * $Id: debug.h,v 1.6 2001/01/12 23:51:04 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 241f7d5f6..5c50b578c 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -248,7 +248,7 @@ static int bus_reset( Scsi_Cmnd *srb ) for (i = 0; i < us->pusb_dev->actconfig->bNumInterfaces; i++) { struct usb_interface *intf = &us->pusb_dev->actconfig->interface[i]; - const struct usb_device_id *id; + struct usb_device_id *id; /* if this is an unclaimed interface, skip it */ if (!intf->driver) { diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h new file mode 100644 index 000000000..d29307433 --- /dev/null +++ b/drivers/usb/storage/unusual_devs.h @@ -0,0 +1,232 @@ +/* Driver for USB Mass Storage compliant devices + * Ununsual Devices File + * + * $Id: unusual_devs.h,v 1.1 2000/12/05 05:38:31 mdharm Exp $ + * + * Current development and maintenance by: + * (c) 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * + * Initial work by: + * (c) 2000 Adam J. Richter (adam@yggdrasil.com), Yggdrasil Computing, Inc. + * + * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more + * information about this driver. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* IMPORTANT NOTE: This file must be included in another file which does + * the following thing for it to work: + * The macro UNUSUAL_DEV() must be defined before this file is included + */ +#include <linux/config.h> + +/* If you edit this file, please try to keep it sorted first by VendorID, + * then by ProductID. + */ + +UNUSUAL_DEV( 0x03ee, 0x0000, 0x0000, 0x0245, + "Mitsumi", + "CD-R/RW Drive", + US_SC_8020, US_PR_CBI, NULL, 0), + +UNUSUAL_DEV( 0x03f0, 0x0107, 0x0200, 0x0200, + "HP", + "CD-Writer+", + US_SC_8070, US_PR_CB, NULL, 0), + +#ifdef CONFIG_USB_STORAGE_HP8200e +UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001, + "HP", + "CD-Writer+ 8200e", + US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), +#endif + +UNUSUAL_DEV( 0x04e6, 0x0001, 0x0200, 0x0200, + "Matshita", + "LS-120", + US_SC_8020, US_PR_CB, NULL, 0), + +UNUSUAL_DEV( 0x04e6, 0x0002, 0x0100, 0x0100, + "Shuttle", + "eUSCSI Bridge", + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + +#ifdef CONFIG_USB_STORAGE_SDDR09 +UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999, + "Sandisk", + "ImageMate SDDR09", + US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP ), +#endif + +#ifdef CONFIG_USB_STORAGE_DPCM +UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, + "Microtech", + "CameraMate (DPCM_USB)", + US_SC_SCSI, US_PR_DPCM_USB, NULL, + US_FL_START_STOP ), +#endif + +UNUSUAL_DEV( 0x04e6, 0x0006, 0x0100, 0x0200, + "Shuttle", + "eUSB MMC Adapter", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN), + +UNUSUAL_DEV( 0x04e6, 0x0007, 0x0100, 0x0200, + "Sony", + "Hifd", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN), + +UNUSUAL_DEV( 0x04e6, 0x0009, 0x0200, 0x0200, + "Shuttle", + "eUSB ATA/ATAPI Adapter", + US_SC_8020, US_PR_CB, NULL, 0), + +UNUSUAL_DEV( 0x04e6, 0x000a, 0x0200, 0x0200, + "Shuttle", + "eUSB CompactFlash Adapter", + US_SC_8020, US_PR_CB, NULL, 0), + +UNUSUAL_DEV( 0x04e6, 0x000B, 0x0100, 0x0100, + "Shuttle", + "eUSCSI Bridge", + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + +UNUSUAL_DEV( 0x04e6, 0x000C, 0x0100, 0x0100, + "Shuttle", + "eUSCSI Bridge", + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + +UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x0200, + "Shuttle", + "CD-RW Device", + US_SC_8020, US_PR_CB, NULL, 0), + +UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0210, + "Sony", + "DSC-S30/S70/505V/F505", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ), + +UNUSUAL_DEV( 0x054c, 0x002d, 0x0100, 0x0100, + "Sony", + "Memorystick MSAC-US1", + US_SC_UFI, US_PR_CB, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP ), + +UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, + "Y-E Data", + "Flashbuster-U", + US_SC_UFI, US_PR_CB, NULL, + US_FL_SINGLE_LUN), + +UNUSUAL_DEV( 0x057b, 0x0000, 0x0300, 0x9999, + "Y-E Data", + "Flashbuster-U", + US_SC_UFI, US_PR_CBI, NULL, + US_FL_SINGLE_LUN), + +UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200, + "LaCie", + "USB Hard Disk", + US_SC_RBC, US_PR_CB, NULL, 0 ), + +UNUSUAL_DEV( 0x05ab, 0x0031, 0x0100, 0x0100, + "In-System", + "USB/IDE Bridge (ATAPI ONLY!)", + US_SC_8070, US_PR_BULK, NULL, 0 ), + +UNUSUAL_DEV( 0x0644, 0x0000, 0x0100, 0x0100, + "TEAC", + "Floppy Drive", + US_SC_UFI, US_PR_CB, NULL, 0 ), + +#ifdef CONFIG_USB_STORAGE_SDDR09 +UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100, + "Olympus", + "Camedia MAUSB-2", + US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP ), +#endif + +UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100, + "Hagiwara", + "FlashGate SmartMedia", + US_SC_SCSI, US_PR_BULK, NULL, 0 ), + +UNUSUAL_DEV( 0x0693, 0x0005, 0x0100, 0x0100, + "Hagiwara", + "Flashgate", + US_SC_SCSI, US_PR_BULK, NULL, 0 ), + +UNUSUAL_DEV( 0x0781, 0x0001, 0x0200, 0x0200, + "Sandisk", + "ImageMate SDDR-05a", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP), + +UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100, + "Sandisk", + "ImageMate SDDR-12", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN ), + +#ifdef CONFIG_USB_STORAGE_SDDR09 +UNUSUAL_DEV( 0x0781, 0x0200, 0x0100, 0x0100, + "Sandisk", + "ImageMate SDDR-09", + US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP ), +#endif + +UNUSUAL_DEV( 0x0781, 0x0002, 0x0009, 0x0009, + "Sandisk", + "ImageMate SDDR-31", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_IGNORE_SER), + +UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0100, + "Microtech", + "USB-SCSI-DB25", + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + +#ifdef CONFIG_USB_STORAGE_FREECOM +UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999, + "Freecom", + "USB-IDE", + US_SC_QIC, US_PR_FREECOM, freecom_init, 0), +#endif + +UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100, + "Microtech", + "USB-SCSI-HD50", + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + +#ifdef CONFIG_USB_STORAGE_DPCM +UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100, + "Microtech", + "CameraMate (DPCM_USB)", + US_SC_SCSI, US_PR_DPCM_USB, NULL, + US_FL_START_STOP ), +#endif + diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 6c254c701..1e0f40f50 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: usb.c,v 1.57 2000/11/21 02:56:41 mdharm Exp $ + * $Id: usb.c,v 1.61 2001/01/13 00:10:59 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -11,6 +11,9 @@ * Initial work by: * (c) 1999 Michael Gee (michael@linuxspecific.com) * + * usb_device_id support by Adam J. Richter (adam@yggdrasil.com): + * (c) 2000 Yggdrasil Computing, Inc. + * * This driver is based on the 'USB Mass Storage Class' document. This * describes in detail the protocol used to communicate with such * devices. Clearly, the designers had SCSI and ATAPI commands in @@ -95,11 +98,133 @@ struct semaphore us_list_semaphore; static void * storage_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id); + static void storage_disconnect(struct usb_device *dev, void *ptr); + +/* The entries in this table, except for final ones here + * (USB_MASS_STORAGE_CLASS and the empty entry), correspond, + * line for line with the entries of us_unsuaul_dev_list[]. + * For now, we duplicate idVendor and idProduct in us_unsual_dev_list, + * just to avoid alignment bugs. + */ + +#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ + vendorName, productName,useProtocol, useTransport, \ + initFunction, flags) \ +{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax) } + +static struct usb_device_id storage_usb_ids [] = { + +# include "unusual_devs.h" +#undef UNUSUAL_DEV + /* Control/Bulk transport for all SubClass values */ + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_RBC, US_PR_CB) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8020, US_PR_CB) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_QIC, US_PR_CB) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_UFI, US_PR_CB) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8070, US_PR_CB) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_CB) }, + + /* Control/Bulk/Interrupt transport for all SubClass values */ + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_RBC, US_PR_CBI) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8020, US_PR_CBI) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_QIC, US_PR_CBI) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_UFI, US_PR_CBI) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8070, US_PR_CBI) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_CBI) }, + + /* Bulk-only transport for all SubClass values */ + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_RBC, US_PR_BULK) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8020, US_PR_BULK) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_QIC, US_PR_BULK) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_UFI, US_PR_BULK) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8070, US_PR_BULK) }, + { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, + + /* Terminating entry */ + { } +}; + +MODULE_DEVICE_TABLE (usb, storage_usb_ids); + +/* This is the list of devices we recognize, along with their flag data */ + +/* The vendor name should be kept at eight characters or less, and + * the product name should be kept at 16 characters or less. If a device + * has the US_FL_DUMMY_INQUIRY flag, then the vendor and product names + * normally generated by a device thorugh the INQUIRY response will be + * taken from this list, and this is the reason for the above size + * restriction. However, if the flag is not present, then you + * are free to use as many characters as you like. + */ + +#undef UNUSUAL_DEV +#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ + vendor_name, product_name, use_protocol, use_transport, \ + init_function, Flags) \ +{ \ + vendorName: vendor_name, \ + productName: product_name, \ + useProtocol: use_protocol, \ + useTransport: use_transport, \ + initFunction : init_function, \ + flags: Flags, \ +} + +static struct us_unusual_dev us_unusual_dev_list[] = { +# include "unusual_devs.h" +# undef UNUSUAL_DEV + /* Control/Bulk transport for all SubClass values */ + { useProtocol: US_SC_RBC, + useTransport: US_PR_CB}, + { useProtocol: US_SC_8020, + useTransport: US_PR_CB}, + { useProtocol: US_SC_QIC, + useTransport: US_PR_CB}, + { useProtocol: US_SC_UFI, + useTransport: US_PR_CB}, + { useProtocol: US_SC_8070, + useTransport: US_PR_CB}, + { useProtocol: US_SC_SCSI, + useTransport: US_PR_CB}, + + /* Control/Bulk/Interrupt transport for all SubClass values */ + { useProtocol: US_SC_RBC, + useTransport: US_PR_CBI}, + { useProtocol: US_SC_8020, + useTransport: US_PR_CBI}, + { useProtocol: US_SC_QIC, + useTransport: US_PR_CBI}, + { useProtocol: US_SC_UFI, + useTransport: US_PR_CBI}, + { useProtocol: US_SC_8070, + useTransport: US_PR_CBI}, + { useProtocol: US_SC_SCSI, + useTransport: US_PR_CBI}, + + /* Bulk-only transport for all SubClass values */ + { useProtocol: US_SC_RBC, + useTransport: US_PR_BULK}, + { useProtocol: US_SC_8020, + useTransport: US_PR_BULK}, + { useProtocol: US_SC_QIC, + useTransport: US_PR_BULK}, + { useProtocol: US_SC_UFI, + useTransport: US_PR_BULK}, + { useProtocol: US_SC_8070, + useTransport: US_PR_BULK}, + { useProtocol: US_SC_SCSI, + useTransport: US_PR_BULK}, + + /* Terminating entry */ + { 0 } +}; + struct usb_driver usb_storage_driver = { name: "usb-storage", probe: storage_probe, disconnect: storage_disconnect, + id_table: storage_usb_ids, }; /* @@ -325,246 +450,6 @@ static int usb_stor_control_thread(void * __us) return 0; } -/* This is the list of devices we recognize, along with their flag data */ - -/* The vendor name should be kept at eight characters or less, and - * the product name should be kept at 16 characters or less. If a device - * has the US_FL_DUMMY_INQUIRY flag, then the vendor and product names - * normally generated by a device thorugh the INQUIRY response will be - * taken from this list, and this is the reason for the above size - * restriction. However, if the flag is not present, then you - * are free to use as many characters as you like. - */ -static struct us_unusual_dev us_unusual_dev_list[] = { - - { 0x03ee, 0x0000, 0x0000, 0x0245, - "Mitsumi", - "CD-R/RW Drive", - US_SC_8020, US_PR_CBI, NULL, 0}, - - { 0x03f0, 0x0107, 0x0200, 0x0200, - "HP", - "CD-Writer+", - US_SC_8070, US_PR_CB, NULL, 0}, - -#ifdef CONFIG_USB_STORAGE_HP8200e - { 0x03f0, 0x0207, 0x0001, 0x0001, - "HP", - "CD-Writer+ 8200e", - US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0}, -#endif - - { 0x04e6, 0x0001, 0x0200, 0x0200, - "Matshita", - "LS-120", - US_SC_8020, US_PR_CB, NULL, 0}, - - { 0x04e6, 0x0002, 0x0100, 0x0100, - "Shuttle", - "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, - US_FL_SCM_MULT_TARG }, - -#ifdef CONFIG_USB_STORAGE_SDDR09 - { 0x04e6, 0x0003, 0x0000, 0x9999, - "Sandisk", - "ImageMate SDDR09", - US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP }, -#endif - -#ifdef CONFIG_USB_STORAGE_DPCM - { 0x0436, 0x0005, 0x0100, 0x0100, - "Microtech", - "CameraMate (DPCM_USB)", - US_SC_SCSI, US_PR_DPCM_USB, NULL, - US_FL_START_STOP }, -#endif - - { 0x04e6, 0x0006, 0x0100, 0x0200, - "Shuttle", - "eUSB MMC Adapter", - US_SC_SCSI, US_PR_CB, NULL, - US_FL_SINGLE_LUN}, - - { 0x04e6, 0x0007, 0x0100, 0x0200, - "Sony", - "Hifd", - US_SC_SCSI, US_PR_CB, NULL, - US_FL_SINGLE_LUN}, - - { 0x04e6, 0x0009, 0x0200, 0x0200, - "Shuttle", - "eUSB ATA/ATAPI Adapter", - US_SC_8020, US_PR_CB, NULL, 0}, - - { 0x04e6, 0x000a, 0x0200, 0x0200, - "Shuttle", - "eUSB CompactFlash Adapter", - US_SC_8020, US_PR_CB, NULL, 0}, - - { 0x04e6, 0x000B, 0x0100, 0x0100, - "Shuttle", - "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, - US_FL_SCM_MULT_TARG }, - - { 0x04e6, 0x000C, 0x0100, 0x0100, - "Shuttle", - "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, - US_FL_SCM_MULT_TARG }, - - { 0x04e6, 0x0101, 0x0200, 0x0200, - "Shuttle", - "CD-RW Device", - US_SC_8020, US_PR_CB, NULL, 0}, - - { 0x054c, 0x0010, 0x0106, 0x0210, - "Sony", - "DSC-S30/S70/505V/F505", - US_SC_SCSI, US_PR_CB, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE }, - - { 0x054c, 0x002d, 0x0100, 0x0100, - "Sony", - "Memorystick MSAC-US1", - US_SC_UFI, US_PR_CB, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP }, - - { 0x057b, 0x0000, 0x0000, 0x0299, - "Y-E Data", - "Flashbuster-U", - US_SC_UFI, US_PR_CB, NULL, - US_FL_SINGLE_LUN}, - - { 0x057b, 0x0000, 0x0300, 0x9999, - "Y-E Data", - "Flashbuster-U", - US_SC_UFI, US_PR_CBI, NULL, - US_FL_SINGLE_LUN}, - - { 0x059f, 0xa601, 0x0200, 0x0200, - "LaCie", - "USB Hard Disk", - US_SC_RBC, US_PR_CB, NULL, 0 }, - - { 0x05ab, 0x0031, 0x0100, 0x0100, - "In-System", - "USB/IDE Bridge (ATAPI ONLY!)", - US_SC_8070, US_PR_BULK, NULL, 0 }, - - { 0x0644, 0x0000, 0x0100, 0x0100, - "TEAC", - "Floppy Drive", - US_SC_UFI, US_PR_CB, NULL, 0 }, - -#ifdef CONFIG_USB_STORAGE_SDDR09 - { 0x066b, 0x0105, 0x0100, 0x0100, - "Olympus", - "Camedia MAUSB-2", - US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP }, -#endif - - { 0x0693, 0x0002, 0x0100, 0x0100, - "Hagiwara", - "FlashGate SmartMedia", - US_SC_SCSI, US_PR_BULK, NULL, 0 }, - - { 0x0693, 0x0005, 0x0100, 0x0100, - "Hagiwara", - "Flashgate", - US_SC_SCSI, US_PR_BULK, NULL, 0 }, - - { 0x0781, 0x0001, 0x0200, 0x0200, - "Sandisk", - "ImageMate SDDR-05a", - US_SC_SCSI, US_PR_CB, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP}, - - { 0x0781, 0x0100, 0x0100, 0x0100, - "Sandisk", - "ImageMate SDDR-12", - US_SC_SCSI, US_PR_CB, NULL, - US_FL_SINGLE_LUN }, - -#ifdef CONFIG_USB_STORAGE_SDDR09 - { 0x0781, 0x0200, 0x0100, 0x0208, - "Sandisk", - "ImageMate SDDR-09", - US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, - US_FL_SINGLE_LUN | US_FL_START_STOP }, -#endif - - { 0x0781, 0x0002, 0x0009, 0x0009, - "Sandisk", - "ImageMate SDDR-31", - US_SC_SCSI, US_PR_BULK, NULL, - US_FL_IGNORE_SER}, - - { 0x07af, 0x0004, 0x0100, 0x0100, - "Microtech", - "USB-SCSI-DB25", - US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, - US_FL_SCM_MULT_TARG }, - -#ifdef CONFIG_USB_STORAGE_FREECOM - { 0x07ab, 0xfc01, 0x0000, 0x9999, - "Freecom", - "USB-IDE", - US_SC_QIC, US_PR_FREECOM, freecom_init, 0}, -#endif - - { 0x07af, 0x0005, 0x0100, 0x0100, - "Microtech", - "USB-SCSI-HD50", - US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, - US_FL_SCM_MULT_TARG }, - -#ifdef CONFIG_USB_STORAGE_DPCM - { 0x07af, 0x0006, 0x0100, 0x0100, - "Microtech", - "CameraMate (DPCM_USB)", - US_SC_SCSI, US_PR_DPCM_USB, NULL, - US_FL_START_STOP }, -#endif - { 0 } -}; - -/* Search our ususual device list, based on vendor/product combinations - * to see if we can support this device. Returns a pointer to a structure - * defining how we should support this device, or NULL if it's not in the - * list - */ -static struct us_unusual_dev* us_find_dev(u16 idVendor, u16 idProduct, - u16 bcdDevice) -{ - struct us_unusual_dev* ptr; - - US_DEBUGP("Searching unusual device list for (0x%x, 0x%x, 0x%x)...\n", - idVendor, idProduct, bcdDevice); - - ptr = us_unusual_dev_list; - while ((ptr->idVendor != 0x0000) && - !((ptr->idVendor == idVendor) && - (ptr->idProduct == idProduct) && - (ptr->bcdDeviceMin <= bcdDevice) && - (ptr->bcdDeviceMax >= bcdDevice))) - ptr++; - - /* if the search ended because we hit the end record, we failed */ - if (ptr->idVendor == 0x0000) { - US_DEBUGP("-- did not find a matching device\n"); - return NULL; - } - - /* otherwise, we found one! */ - US_DEBUGP("-- found matching device: %s %s\n", ptr->vendorName, - ptr->productName); - return ptr; -} - /* Set up the IRQ pipe and handler * Note that this function assumes that all the data in the us_data * strucuture is current. This includes the ep_int field, which gives us @@ -620,6 +505,7 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id) { int i; + const int id_index = id - storage_usb_ids; char mf[USB_STOR_STRING_LEN]; /* manufacturer */ char prod[USB_STOR_STRING_LEN]; /* product */ char serial[USB_STOR_STRING_LEN]; /* serial number */ @@ -640,47 +526,48 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum, u8 subclass = 0; u8 protocol = 0; - /* the altsettting 0 on the interface we're probing */ - struct usb_interface_descriptor *altsetting = - &(dev->actconfig->interface[ifnum].altsetting[0]); + /* the altsettting on the interface we're probing that matched our + * usb_match_id table + */ + struct usb_interface *intf = dev->actconfig->interface; + struct usb_interface_descriptor *altsetting = + intf[ifnum].altsetting + intf[ifnum].act_altsetting; + US_DEBUGP("act_altsettting is %d\n", intf[ifnum].act_altsetting); /* clear the temporary strings */ memset(mf, 0, sizeof(mf)); memset(prod, 0, sizeof(prod)); memset(serial, 0, sizeof(serial)); - /* search for this device in our unusual device list */ - unusual_dev = us_find_dev(dev->descriptor.idVendor, - dev->descriptor.idProduct, - dev->descriptor.bcdDevice); - /* * Can we support this device, either because we know about it * from our unusual device list, or because it advertises that it's * compliant to the specification? + * + * id_index is calculated in the declaration to be the index number + * of the match from the usb_device_id table, so we can find the + * corresponding entry in the private table. */ - if (!unusual_dev && - !(dev->descriptor.bDeviceClass == 0 && - altsetting->bInterfaceClass == USB_CLASS_MASS_STORAGE && - altsetting->bInterfaceSubClass >= US_SC_MIN && - altsetting->bInterfaceSubClass <= US_SC_MAX)) { - /* if it's not a mass storage, we go no further */ + US_DEBUGP("id_index calculated to be: %d\n", id_index); + US_DEBUGP("Array length appears to be: %d\n", sizeof(us_unusual_dev_list) / sizeof(us_unusual_dev_list[0])); + if (id_index < + sizeof(us_unusual_dev_list) / sizeof(us_unusual_dev_list[0])) { + unusual_dev = &us_unusual_dev_list[id_index]; + if (unusual_dev->vendorName) + US_DEBUGP("Vendor: %s\n", unusual_dev->vendorName); + if (unusual_dev->productName) + US_DEBUGP("Product: %s\n", unusual_dev->productName); + } else + /* no, we can't support it */ return NULL; - } /* At this point, we know we've got a live one */ US_DEBUGP("USB Mass Storage device detected\n"); /* Determine subclass and protocol, or copy from the interface */ - if (unusual_dev) { - subclass = unusual_dev->useProtocol; - protocol = unusual_dev->useTransport; - flags = unusual_dev->flags; - } else { - subclass = altsetting->bInterfaceSubClass; - protocol = altsetting->bInterfaceProtocol; - flags = 0; - } + subclass = unusual_dev->useProtocol; + protocol = unusual_dev->useTransport; + flags = unusual_dev->flags; /* * Find the endpoints we need @@ -728,7 +615,7 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum, /* Do some basic sanity checks, and bail if we find a problem */ if (!ep_in || !ep_out || (protocol == US_PR_CBI && !ep_int)) { - US_DEBUGP("Sanity check failed. Rejecting device.\n"); + US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n"); return NULL; } @@ -861,7 +748,7 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum, strncpy(ss->product, prod, USB_STOR_STRING_LEN); strncpy(ss->serial, serial, USB_STOR_STRING_LEN); if (strlen(ss->vendor) == 0) { - if (unusual_dev) + if (unusual_dev->vendorName) strncpy(ss->vendor, unusual_dev->vendorName, USB_STOR_STRING_LEN); else @@ -869,7 +756,7 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum, USB_STOR_STRING_LEN); } if (strlen(ss->product) == 0) { - if (unusual_dev) + if (unusual_dev->productName) strncpy(ss->product, unusual_dev->productName, USB_STOR_STRING_LEN); else @@ -1118,6 +1005,8 @@ static void storage_disconnect(struct usb_device *dev, void *ptr) int __init usb_stor_init(void) { + printk(KERN_INFO "Initializing USB Mass Storage driver...\n"); + /* initialize internal global data elements */ us_list = NULL; init_MUTEX(&us_list_semaphore); diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index e0dac568d..9c8076c8d 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Main Header File * - * $Id: usb.h,v 1.11 2000/11/13 22:38:55 mdharm Exp $ + * $Id: usb.h,v 1.12 2000/12/05 03:33:49 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -84,13 +84,6 @@ struct us_data; */ struct us_unusual_dev { - /* we search the list based on these parameters */ - __u16 idVendor; - __u16 idProduct; - __u16 bcdDeviceMin; - __u16 bcdDeviceMax; - - /* the list specifies these parameters */ const char* vendorName; const char* productName; __u8 useProtocol; |