aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/jumpshot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/jumpshot.c')
-rw-r--r--drivers/usb/storage/jumpshot.c103
1 files changed, 101 insertions, 2 deletions
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index df67f13c9e7..1c69420e3ac 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -46,6 +46,7 @@
46 */ 46 */
47 47
48#include <linux/errno.h> 48#include <linux/errno.h>
49#include <linux/module.h>
49#include <linux/slab.h> 50#include <linux/slab.h>
50 51
51#include <scsi/scsi.h> 52#include <scsi/scsi.h>
@@ -55,9 +56,61 @@
55#include "transport.h" 56#include "transport.h"
56#include "protocol.h" 57#include "protocol.h"
57#include "debug.h" 58#include "debug.h"
58#include "jumpshot.h"
59 59
60 60
61MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader");
62MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>");
63MODULE_LICENSE("GPL");
64
65/*
66 * The table of devices
67 */
68#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
69 vendorName, productName, useProtocol, useTransport, \
70 initFunction, flags) \
71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
72 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
73
74struct usb_device_id jumpshot_usb_ids[] = {
75# include "unusual_jumpshot.h"
76 { } /* Terminating entry */
77};
78MODULE_DEVICE_TABLE(usb, jumpshot_usb_ids);
79
80#undef UNUSUAL_DEV
81
82/*
83 * The flags table
84 */
85#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
86 vendor_name, product_name, use_protocol, use_transport, \
87 init_function, Flags) \
88{ \
89 .vendorName = vendor_name, \
90 .productName = product_name, \
91 .useProtocol = use_protocol, \
92 .useTransport = use_transport, \
93 .initFunction = init_function, \
94}
95
96static struct us_unusual_dev jumpshot_unusual_dev_list[] = {
97# include "unusual_jumpshot.h"
98 { } /* Terminating entry */
99};
100
101#undef UNUSUAL_DEV
102
103
104struct jumpshot_info {
105 unsigned long sectors; /* total sector count */
106 unsigned long ssize; /* sector size in bytes */
107
108 /* the following aren't used yet */
109 unsigned char sense_key;
110 unsigned long sense_asc; /* additional sense code */
111 unsigned long sense_ascq; /* additional sense code qualifier */
112};
113
61static inline int jumpshot_bulk_read(struct us_data *us, 114static inline int jumpshot_bulk_read(struct us_data *us,
62 unsigned char *data, 115 unsigned char *data,
63 unsigned int len) 116 unsigned int len)
@@ -429,7 +482,7 @@ static void jumpshot_info_destructor(void *extra)
429 482
430// Transport for the Lexar 'Jumpshot' 483// Transport for the Lexar 'Jumpshot'
431// 484//
432int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us) 485static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
433{ 486{
434 struct jumpshot_info *info; 487 struct jumpshot_info *info;
435 int rc; 488 int rc;
@@ -592,3 +645,49 @@ int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us)
592 info->sense_ascq = 0x00; 645 info->sense_ascq = 0x00;
593 return USB_STOR_TRANSPORT_FAILED; 646 return USB_STOR_TRANSPORT_FAILED;
594} 647}
648
649static int jumpshot_probe(struct usb_interface *intf,
650 const struct usb_device_id *id)
651{
652 struct us_data *us;
653 int result;
654
655 result = usb_stor_probe1(&us, intf, id,
656 (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list);
657 if (result)
658 return result;
659
660 us->transport_name = "Lexar Jumpshot Control/Bulk";
661 us->transport = jumpshot_transport;
662 us->transport_reset = usb_stor_Bulk_reset;
663 us->max_lun = 1;
664
665 result = usb_stor_probe2(us);
666 return result;
667}
668
669static struct usb_driver jumpshot_driver = {
670 .name = "ums-jumpshot",
671 .probe = jumpshot_probe,
672 .disconnect = usb_stor_disconnect,
673 .suspend = usb_stor_suspend,
674 .resume = usb_stor_resume,
675 .reset_resume = usb_stor_reset_resume,
676 .pre_reset = usb_stor_pre_reset,
677 .post_reset = usb_stor_post_reset,
678 .id_table = jumpshot_usb_ids,
679 .soft_unbind = 1,
680};
681
682static int __init jumpshot_init(void)
683{
684 return usb_register(&jumpshot_driver);
685}
686
687static void __exit jumpshot_exit(void)
688{
689 usb_deregister(&jumpshot_driver);
690}
691
692module_init(jumpshot_init);
693module_exit(jumpshot_exit);