diff options
Diffstat (limited to 'drivers/usb/storage/freecom.c')
-rw-r--r-- | drivers/usb/storage/freecom.c | 99 |
1 files changed, 94 insertions, 5 deletions
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 73ac7262239e..54cc94277acb 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * (http://www.freecom.de/) | 26 | * (http://www.freecom.de/) |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/module.h> | ||
29 | #include <scsi/scsi.h> | 30 | #include <scsi/scsi.h> |
30 | #include <scsi/scsi_cmnd.h> | 31 | #include <scsi/scsi_cmnd.h> |
31 | 32 | ||
@@ -33,7 +34,10 @@ | |||
33 | #include "transport.h" | 34 | #include "transport.h" |
34 | #include "protocol.h" | 35 | #include "protocol.h" |
35 | #include "debug.h" | 36 | #include "debug.h" |
36 | #include "freecom.h" | 37 | |
38 | MODULE_DESCRIPTION("Driver for Freecom USB/IDE adaptor"); | ||
39 | MODULE_AUTHOR("David Brown <usb-storage@davidb.org>"); | ||
40 | MODULE_LICENSE("GPL"); | ||
37 | 41 | ||
38 | #ifdef CONFIG_USB_STORAGE_DEBUG | 42 | #ifdef CONFIG_USB_STORAGE_DEBUG |
39 | static void pdump (void *, int); | 43 | static void pdump (void *, int); |
@@ -103,6 +107,47 @@ struct freecom_status { | |||
103 | #define FCM_PACKET_LENGTH 64 | 107 | #define FCM_PACKET_LENGTH 64 |
104 | #define FCM_STATUS_PACKET_LENGTH 4 | 108 | #define FCM_STATUS_PACKET_LENGTH 4 |
105 | 109 | ||
110 | static int init_freecom(struct us_data *us); | ||
111 | |||
112 | |||
113 | /* | ||
114 | * The table of devices | ||
115 | */ | ||
116 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
117 | vendorName, productName, useProtocol, useTransport, \ | ||
118 | initFunction, flags) \ | ||
119 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
120 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
121 | |||
122 | struct usb_device_id freecom_usb_ids[] = { | ||
123 | # include "unusual_freecom.h" | ||
124 | { } /* Terminating entry */ | ||
125 | }; | ||
126 | MODULE_DEVICE_TABLE(usb, freecom_usb_ids); | ||
127 | |||
128 | #undef UNUSUAL_DEV | ||
129 | |||
130 | /* | ||
131 | * The flags table | ||
132 | */ | ||
133 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
134 | vendor_name, product_name, use_protocol, use_transport, \ | ||
135 | init_function, Flags) \ | ||
136 | { \ | ||
137 | .vendorName = vendor_name, \ | ||
138 | .productName = product_name, \ | ||
139 | .useProtocol = use_protocol, \ | ||
140 | .useTransport = use_transport, \ | ||
141 | .initFunction = init_function, \ | ||
142 | } | ||
143 | |||
144 | static struct us_unusual_dev freecom_unusual_dev_list[] = { | ||
145 | # include "unusual_freecom.h" | ||
146 | { } /* Terminating entry */ | ||
147 | }; | ||
148 | |||
149 | #undef UNUSUAL_DEV | ||
150 | |||
106 | static int | 151 | static int |
107 | freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, | 152 | freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, |
108 | unsigned int ipipe, unsigned int opipe, int count) | 153 | unsigned int ipipe, unsigned int opipe, int count) |
@@ -173,7 +218,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us, | |||
173 | * Transport for the Freecom USB/IDE adaptor. | 218 | * Transport for the Freecom USB/IDE adaptor. |
174 | * | 219 | * |
175 | */ | 220 | */ |
176 | int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) | 221 | static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) |
177 | { | 222 | { |
178 | struct freecom_cb_wrap *fcb; | 223 | struct freecom_cb_wrap *fcb; |
179 | struct freecom_status *fst; | 224 | struct freecom_status *fst; |
@@ -377,8 +422,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
377 | return USB_STOR_TRANSPORT_GOOD; | 422 | return USB_STOR_TRANSPORT_GOOD; |
378 | } | 423 | } |
379 | 424 | ||
380 | int | 425 | static int init_freecom(struct us_data *us) |
381 | freecom_init (struct us_data *us) | ||
382 | { | 426 | { |
383 | int result; | 427 | int result; |
384 | char *buffer = us->iobuf; | 428 | char *buffer = us->iobuf; |
@@ -417,7 +461,7 @@ freecom_init (struct us_data *us) | |||
417 | return USB_STOR_TRANSPORT_GOOD; | 461 | return USB_STOR_TRANSPORT_GOOD; |
418 | } | 462 | } |
419 | 463 | ||
420 | int usb_stor_freecom_reset(struct us_data *us) | 464 | static int usb_stor_freecom_reset(struct us_data *us) |
421 | { | 465 | { |
422 | printk (KERN_CRIT "freecom reset called\n"); | 466 | printk (KERN_CRIT "freecom reset called\n"); |
423 | 467 | ||
@@ -479,3 +523,48 @@ static void pdump (void *ibuffer, int length) | |||
479 | } | 523 | } |
480 | #endif | 524 | #endif |
481 | 525 | ||
526 | static int freecom_probe(struct usb_interface *intf, | ||
527 | const struct usb_device_id *id) | ||
528 | { | ||
529 | struct us_data *us; | ||
530 | int result; | ||
531 | |||
532 | result = usb_stor_probe1(&us, intf, id, | ||
533 | (id - freecom_usb_ids) + freecom_unusual_dev_list); | ||
534 | if (result) | ||
535 | return result; | ||
536 | |||
537 | us->transport_name = "Freecom"; | ||
538 | us->transport = freecom_transport; | ||
539 | us->transport_reset = usb_stor_freecom_reset; | ||
540 | us->max_lun = 0; | ||
541 | |||
542 | result = usb_stor_probe2(us); | ||
543 | return result; | ||
544 | } | ||
545 | |||
546 | static struct usb_driver freecom_driver = { | ||
547 | .name = "ums-freecom", | ||
548 | .probe = freecom_probe, | ||
549 | .disconnect = usb_stor_disconnect, | ||
550 | .suspend = usb_stor_suspend, | ||
551 | .resume = usb_stor_resume, | ||
552 | .reset_resume = usb_stor_reset_resume, | ||
553 | .pre_reset = usb_stor_pre_reset, | ||
554 | .post_reset = usb_stor_post_reset, | ||
555 | .id_table = freecom_usb_ids, | ||
556 | .soft_unbind = 1, | ||
557 | }; | ||
558 | |||
559 | static int __init freecom_init(void) | ||
560 | { | ||
561 | return usb_register(&freecom_driver); | ||
562 | } | ||
563 | |||
564 | static void __exit freecom_exit(void) | ||
565 | { | ||
566 | usb_deregister(&freecom_driver); | ||
567 | } | ||
568 | |||
569 | module_init(freecom_init); | ||
570 | module_exit(freecom_exit); | ||