MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / usb / storage / dpcm.c
blob12c15f19a4f3326bdfd3620a6d949776dc33ce40
1 /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader
3 * $Id: dpcm.c,v 1.4 2001/06/11 02:54:25 mdharm Exp $
5 * DPCM driver v0.1:
7 * First release
9 * Current development and maintenance by:
10 * (c) 2000 Brian Webb (webbb@earthlink.net)
12 * This device contains both a CompactFlash card reader, which
13 * uses the Control/Bulk w/o Interrupt protocol and
14 * a SmartMedia card reader that uses the same protocol
15 * as the SDDR09.
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2, or (at your option) any
20 * later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * General Public License for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 #include <linux/config.h>
33 #include <scsi/scsi.h>
34 #include <scsi/scsi_cmnd.h>
35 #include <scsi/scsi_device.h>
37 #include "transport.h"
38 #include "protocol.h"
39 #include "usb.h"
40 #include "debug.h"
41 #include "dpcm.h"
42 #include "sddr09.h"
45 * Transport for the Microtech DPCM-USB
48 int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
50 int ret;
52 if(srb == NULL)
53 return USB_STOR_TRANSPORT_ERROR;
55 US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun);
57 switch(srb->device->lun) {
58 case 0:
61 * LUN 0 corresponds to the CompactFlash card reader.
63 ret = usb_stor_CB_transport(srb, us);
64 break;
66 #ifdef CONFIG_USB_STORAGE_SDDR09
67 case 1:
70 * LUN 1 corresponds to the SmartMedia card reader.
74 * Set the LUN to 0 (just in case).
76 srb->device->lun = 0; us->srb->device->lun = 0;
77 ret = sddr09_transport(srb, us);
78 srb->device->lun = 1; us->srb->device->lun = 1;
79 break;
81 #endif
83 default:
84 US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->device->lun);
85 ret = USB_STOR_TRANSPORT_ERROR;
86 break;
88 return ret;