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