jumpshot.c (7a9787e1eba95a166265e6a260cf30af04ef0a99) | jumpshot.c (a9fb6d05d59c9e118ad8c355adfdf88c970c61bc) |
---|---|
1/* Driver for Lexar "Jumpshot" Compact Flash reader 2 * 3 * jumpshot driver v0.1: 4 * 5 * First release 6 * 7 * Current development and maintenance by: 8 * (c) 2000 Jimmie Mayfield (mayfield+usb@sackheads.org) --- 32 unchanged lines hidden (view full) --- 41 * 42 * This driver supports reading and writing. If you're truly paranoid, 43 * however, you can force the driver into a write-protected state by setting 44 * the WP enable bits in jumpshot_handle_mode_sense. See the comments 45 * in that routine. 46 */ 47 48#include <linux/errno.h> | 1/* Driver for Lexar "Jumpshot" Compact Flash reader 2 * 3 * jumpshot driver v0.1: 4 * 5 * First release 6 * 7 * Current development and maintenance by: 8 * (c) 2000 Jimmie Mayfield (mayfield+usb@sackheads.org) --- 32 unchanged lines hidden (view full) --- 41 * 42 * This driver supports reading and writing. If you're truly paranoid, 43 * however, you can force the driver into a write-protected state by setting 44 * the WP enable bits in jumpshot_handle_mode_sense. See the comments 45 * in that routine. 46 */ 47 48#include <linux/errno.h> |
49#include <linux/module.h> |
|
49#include <linux/slab.h> 50 51#include <scsi/scsi.h> 52#include <scsi/scsi_cmnd.h> 53 54#include "usb.h" 55#include "transport.h" 56#include "protocol.h" 57#include "debug.h" | 50#include <linux/slab.h> 51 52#include <scsi/scsi.h> 53#include <scsi/scsi_cmnd.h> 54 55#include "usb.h" 56#include "transport.h" 57#include "protocol.h" 58#include "debug.h" |
58#include "jumpshot.h" | |
59 60 | 59 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 70struct usb_device_id jumpshot_usb_ids[] = { 71# include "unusual_jumpshot.h" 72 { } /* Terminating entry */ 73}; 74MODULE_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 92static struct us_unusual_dev jumpshot_unusual_dev_list[] = { 93# include "unusual_jumpshot.h" 94 { } /* Terminating entry */ 95}; 96 97#undef UNUSUAL_DEV 98 99 100struct 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 |
|
61static inline int jumpshot_bulk_read(struct us_data *us, 62 unsigned char *data, 63 unsigned int len) 64{ 65 if (len == 0) 66 return USB_STOR_XFER_GOOD; 67 68 US_DEBUGP("jumpshot_bulk_read: len = %d\n", len); --- 355 unchanged lines hidden (view full) --- 424 // this routine is a placeholder... 425 // currently, we don't allocate any extra blocks so we're okay 426} 427 428 429 430// Transport for the Lexar 'Jumpshot' 431// | 110static inline int jumpshot_bulk_read(struct us_data *us, 111 unsigned char *data, 112 unsigned int len) 113{ 114 if (len == 0) 115 return USB_STOR_XFER_GOOD; 116 117 US_DEBUGP("jumpshot_bulk_read: len = %d\n", len); --- 355 unchanged lines hidden (view full) --- 473 // this routine is a placeholder... 474 // currently, we don't allocate any extra blocks so we're okay 475} 476 477 478 479// Transport for the Lexar 'Jumpshot' 480// |
432int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us) | 481static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) |
433{ 434 struct jumpshot_info *info; 435 int rc; 436 unsigned long block, blocks; 437 unsigned char *ptr = us->iobuf; 438 static unsigned char inquiry_response[8] = { 439 0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00 440 }; --- 146 unchanged lines hidden (view full) --- 587 588 US_DEBUGP("jumpshot_transport: Gah! Unknown command: %d (0x%x)\n", 589 srb->cmnd[0], srb->cmnd[0]); 590 info->sense_key = 0x05; 591 info->sense_asc = 0x20; 592 info->sense_ascq = 0x00; 593 return USB_STOR_TRANSPORT_FAILED; 594} | 482{ 483 struct jumpshot_info *info; 484 int rc; 485 unsigned long block, blocks; 486 unsigned char *ptr = us->iobuf; 487 static unsigned char inquiry_response[8] = { 488 0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00 489 }; --- 146 unchanged lines hidden (view full) --- 636 637 US_DEBUGP("jumpshot_transport: Gah! Unknown command: %d (0x%x)\n", 638 srb->cmnd[0], srb->cmnd[0]); 639 info->sense_key = 0x05; 640 info->sense_asc = 0x20; 641 info->sense_ascq = 0x00; 642 return USB_STOR_TRANSPORT_FAILED; 643} |
644 645static 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 665static 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 678static int __init jumpshot_init(void) 679{ 680 return usb_register(&jumpshot_driver); 681} 682 683static void __exit jumpshot_exit(void) 684{ 685 usb_deregister(&jumpshot_driver); 686} 687 688module_init(jumpshot_init); 689module_exit(jumpshot_exit); |
|