Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133519
b: refs/heads/master
c: 0ff7188
h: refs/heads/master
i:
  133517: 33e44b2
  133515: edbc8bc
  133511: 2f0e385
  133503: fcfbd48
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Mar 24, 2009
1 parent 7ac5c3a commit 8f1052d
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 109 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e6e244b6cb1f70e7109381626293cd40a8334ed3
refs/heads/master: 0ff71883b2d60136430458413c135d545c69b0c4
4 changes: 3 additions & 1 deletion trunk/drivers/usb/storage/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ config USB_STORAGE_USBAT
- Sandisk ImageMate SDDR-05b

config USB_STORAGE_SDDR09
bool "SanDisk SDDR-09 (and other SmartMedia, including DPCM) support"
tristate "SanDisk SDDR-09 (and other SmartMedia, including DPCM) support"
depends on USB_STORAGE
help
Say Y here to include additional code to support the Sandisk SDDR-09
SmartMedia reader in the USB Mass Storage driver.
Also works for the Microtech Zio! CompactFlash/SmartMedia reader.

If this driver is compiled as a module, it will be named ums-sddr09.

config USB_STORAGE_SDDR55
bool "SanDisk SDDR-55 SmartMedia support"
depends on USB_STORAGE
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/usb/storage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o

usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o
usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o
Expand All @@ -30,3 +29,7 @@ ifeq ($(CONFIG_USB_LIBUSUAL),)
else
obj-$(CONFIG_USB) += libusual.o usual-tables.o
endif

obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o

ums-sddr09-objs := sddr09.o
107 changes: 102 additions & 5 deletions trunk/drivers/usb/storage/sddr09.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/

#include <linux/errno.h>
#include <linux/module.h>
#include <linux/slab.h>

#include <scsi/scsi.h>
Expand All @@ -51,7 +52,50 @@
#include "transport.h"
#include "protocol.h"
#include "debug.h"
#include "sddr09.h"


static int usb_stor_sddr09_dpcm_init(struct us_data *us);
static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
static int usb_stor_sddr09_init(struct us_data *us);


/*
* The table of devices
*/
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
vendorName, productName, useProtocol, useTransport, \
initFunction, flags) \
{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
.driver_info = (flags)|(USB_US_TYPE_STOR<<24) }

struct usb_device_id sddr09_usb_ids[] = {
# include "unusual_sddr09.h"
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, sddr09_usb_ids);

#undef UNUSUAL_DEV

/*
* The flags table
*/
#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, \
}

static struct us_unusual_dev sddr09_unusual_dev_list[] = {
# include "unusual_sddr09.h"
{ } /* Terminating entry */
};

#undef UNUSUAL_DEV


#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
Expand Down Expand Up @@ -1406,7 +1450,7 @@ sddr09_common_init(struct us_data *us) {
* unusual devices list but called from here then LUN 0 of the combo reader
* is not recognized. But I do not know what precisely these calls do.
*/
int
static int
usb_stor_sddr09_dpcm_init(struct us_data *us) {
int result;
unsigned char *data = us->iobuf;
Expand Down Expand Up @@ -1456,7 +1500,7 @@ usb_stor_sddr09_dpcm_init(struct us_data *us) {
/*
* Transport for the Microtech DPCM-USB
*/
int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
static int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int ret;

Expand Down Expand Up @@ -1498,7 +1542,7 @@ int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
/*
* Transport for the Sandisk SDDR-09
*/
int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
{
static unsigned char sensekey = 0, sensecode = 0;
static unsigned char havefakesense = 0;
Expand Down Expand Up @@ -1697,7 +1741,60 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
/*
* Initialization routine for the sddr09 subdriver
*/
int
static int
usb_stor_sddr09_init(struct us_data *us) {
return sddr09_common_init(us);
}

static int sddr09_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct us_data *us;
int result;

result = usb_stor_probe1(&us, intf, id,
(id - sddr09_usb_ids) + sddr09_unusual_dev_list);
if (result)
return result;

if (us->protocol == US_PR_DPCM_USB) {
us->transport_name = "Control/Bulk-EUSB/SDDR09";
us->transport = dpcm_transport;
us->transport_reset = usb_stor_CB_reset;
us->max_lun = 1;
} else {
us->transport_name = "EUSB/SDDR09";
us->transport = sddr09_transport;
us->transport_reset = usb_stor_CB_reset;
us->max_lun = 0;
}

result = usb_stor_probe2(us);
return result;
}

static struct usb_driver sddr09_driver = {
.name = "ums-sddr09",
.probe = sddr09_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.resume = usb_stor_resume,
.reset_resume = usb_stor_reset_resume,
.pre_reset = usb_stor_pre_reset,
.post_reset = usb_stor_post_reset,
.id_table = sddr09_usb_ids,
.soft_unbind = 1,
};

static int __init sddr09_init(void)
{
return usb_register(&sddr09_driver);
}

static void __exit sddr09_exit(void)
{
usb_deregister(&sddr09_driver);
}

module_init(sddr09_init);
module_exit(sddr09_exit);
38 changes: 0 additions & 38 deletions trunk/drivers/usb/storage/sddr09.h

This file was deleted.

50 changes: 8 additions & 42 deletions trunk/drivers/usb/storage/unusual_devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
* as opposed to devices that do something strangely or wrongly.
*/

#if !defined(CONFIG_USB_STORAGE_SDDR09) && \
!defined(CONFIG_USB_STORAGE_SDDR09_MODULE)
#define NO_SDDR09
#endif

/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr>
*/
UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
Expand Down Expand Up @@ -246,12 +251,7 @@ UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_SINGLE_LUN ),

#ifdef CONFIG_USB_STORAGE_SDDR09
UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
"Microtech",
"CameraMate (DPCM_USB)",
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
#else
#ifdef NO_SDDR09
UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
"Microtech",
"CameraMate",
Expand Down Expand Up @@ -467,20 +467,7 @@ UNUSUAL_DEV( 0x04e6, 0x0002, 0x0100, 0x0100,
US_SC_DEVICE, US_PR_DEVICE, 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, usb_stor_sddr09_init,
0),

/* This entry is from Andries.Brouwer@cwi.nl */
UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
"SCM Microsystems",
"eUSB SmartMedia / CompactFlash Adapter",
US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
0),
#else
#ifdef NO_SDDR09
UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
"SCM Microsystems",
"eUSB CompactFlash Adapter",
Expand Down Expand Up @@ -935,14 +922,6 @@ UNUSUAL_DEV( 0x0644, 0x0000, 0x0100, 0x0100,
"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, usb_stor_sddr09_init,
0),
#endif

/* Reported by Darsen Lu <darsen@micro.ee.nthu.edu.tw> */
UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
"SigmaTel",
Expand Down Expand Up @@ -1057,14 +1036,6 @@ UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100,
US_SC_SCSI, US_PR_CB, NULL,
US_FL_SINGLE_LUN ),

#ifdef CONFIG_USB_STORAGE_SDDR09
UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999,
"Sandisk",
"ImageMate SDDR-09",
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
0),
#endif

#ifdef CONFIG_USB_STORAGE_FREECOM
UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
"Freecom",
Expand All @@ -1091,12 +1062,7 @@ UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100,
US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init,
US_FL_SCM_MULT_TARG ),

#ifdef CONFIG_USB_STORAGE_SDDR09
UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
"Microtech",
"CameraMate (DPCM_USB)",
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
#else
#ifdef NO_SDDR09
UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
"Microtech",
"CameraMate",
Expand Down
56 changes: 56 additions & 0 deletions trunk/drivers/usb/storage/unusual_sddr09.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* Unusual Devices File for SanDisk SDDR-09 SmartMedia reader
*
* 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.
*/

#if defined(CONFIG_USB_STORAGE_SDDR09) || \
defined(CONFIG_USB_STORAGE_SDDR09_MODULE)

UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
"Microtech",
"CameraMate (DPCM_USB)",
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),

UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999,
"Sandisk",
"ImageMate SDDR09",
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
0),

/* This entry is from Andries.Brouwer@cwi.nl */
UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
"SCM Microsystems",
"eUSB SmartMedia / CompactFlash Adapter",
US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
0),

UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100,
"Olympus",
"Camedia MAUSB-2",
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
0),

UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999,
"Sandisk",
"ImageMate SDDR-09",
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
0),

UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
"Microtech",
"CameraMate (DPCM_USB)",
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),

#endif /* defined(CONFIG_USB_STORAGE_SDDR09) || ... */
Loading

0 comments on commit 8f1052d

Please sign in to comment.