^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Driver for Lexar "Jumpshot" Compact Flash reader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * jumpshot driver v0.1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * First release
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Current development and maintenance by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * (c) 2000 Jimmie Mayfield (mayfield+usb@sackheads.org)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * which I used as a template for this driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Some bugfixes and scatter-gather code by Gregory P. Smith
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * (greg-usb@electricrain.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Fix for media change by Joerg Schneider (js@joergschneider.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Developed with the assistance of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * (C) 2002 Alan Stern <stern@rowland.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * This driver attempts to support the Lexar Jumpshot USB CompactFlash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * reader. Like many other USB CompactFlash readers, the Jumpshot contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * a USB-to-ATA chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * This driver supports reading and writing. If you're truly paranoid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * however, you can force the driver into a write-protected state by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * the WP enable bits in jumpshot_handle_mode_sense. See the comments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * in that routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include <scsi/scsi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include <scsi/scsi_cmnd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include "usb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include "transport.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include "protocol.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include "debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include "scsiglue.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define DRV_NAME "ums-jumpshot"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MODULE_IMPORT_NS(USB_STORAGE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * The table of devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) vendorName, productName, useProtocol, useTransport, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) initFunction, flags) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) .driver_info = (flags) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static struct usb_device_id jumpshot_usb_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) # include "unusual_jumpshot.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) { } /* Terminating entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) MODULE_DEVICE_TABLE(usb, jumpshot_usb_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #undef UNUSUAL_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * The flags table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) vendor_name, product_name, use_protocol, use_transport, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) init_function, Flags) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .vendorName = vendor_name, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .productName = product_name, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .useProtocol = use_protocol, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .useTransport = use_transport, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .initFunction = init_function, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) static struct us_unusual_dev jumpshot_unusual_dev_list[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) # include "unusual_jumpshot.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) { } /* Terminating entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #undef UNUSUAL_DEV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct jumpshot_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unsigned long sectors; /* total sector count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) unsigned long ssize; /* sector size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /* the following aren't used yet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) unsigned char sense_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) unsigned long sense_asc; /* additional sense code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) unsigned long sense_ascq; /* additional sense code qualifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline int jumpshot_bulk_read(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) unsigned char *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) if (len == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) return USB_STOR_XFER_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) usb_stor_dbg(us, "len = %d\n", len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) data, len, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline int jumpshot_bulk_write(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) unsigned char *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (len == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return USB_STOR_XFER_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) usb_stor_dbg(us, "len = %d\n", len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) data, len, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) static int jumpshot_get_status(struct us_data *us)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if (!us)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) // send the setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) rc = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 0, 0xA0, 0, 7, us->iobuf, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (rc != USB_STOR_XFER_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) if (us->iobuf[0] != 0x50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) usb_stor_dbg(us, "0x%2x\n", us->iobuf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static int jumpshot_read_data(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct jumpshot_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) u32 sector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) u32 sectors)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) unsigned char *command = us->iobuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) unsigned char *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) unsigned char thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) unsigned int totallen, alloclen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int len, result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) unsigned int sg_offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct scatterlist *sg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) // we're working in LBA mode. according to the ATA spec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) // we can support up to 28-bit addressing. I don't know if Jumpshot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) // supports beyond 24-bit addressing. It's kind of hard to test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) // since it requires > 8GB CF card.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) if (sector > 0x0FFFFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) totallen = sectors * info->ssize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) // Since we don't read more than 64 KB at a time, we have to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) // a bounce buffer and move the data a piece at a time between the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) // bounce buffer and the actual transfer buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) alloclen = min(totallen, 65536u);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) buffer = kmalloc(alloclen, GFP_NOIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (buffer == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) // loop, never allocate or transfer more than 64k at once
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) // (min(128k, 255*info->ssize) is the real limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) len = min(totallen, alloclen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) thistime = (len / info->ssize) & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) command[0] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) command[1] = thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) command[2] = sector & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) command[3] = (sector >> 8) & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) command[4] = (sector >> 16) & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) command[5] = 0xE0 | ((sector >> 24) & 0x0F);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) command[6] = 0x20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) // send the setup + command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 0, 0x20, 0, 1, command, 7);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (result != USB_STOR_XFER_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) // read the result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) result = jumpshot_bulk_read(us, buffer, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) if (result != USB_STOR_XFER_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) usb_stor_dbg(us, "%d bytes\n", len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) // Store the data in the transfer buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) usb_stor_access_xfer_buf(buffer, len, us->srb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) &sg, &sg_offset, TO_XFER_BUF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) sector += thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) totallen -= len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) } while (totallen > 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) kfree(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) leave:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) kfree(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) static int jumpshot_write_data(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct jumpshot_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) u32 sector,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) u32 sectors)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) unsigned char *command = us->iobuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) unsigned char *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) unsigned char thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) unsigned int totallen, alloclen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) int len, result, waitcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) unsigned int sg_offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) struct scatterlist *sg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) // we're working in LBA mode. according to the ATA spec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) // we can support up to 28-bit addressing. I don't know if Jumpshot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) // supports beyond 24-bit addressing. It's kind of hard to test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) // since it requires > 8GB CF card.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) if (sector > 0x0FFFFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) totallen = sectors * info->ssize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) // Since we don't write more than 64 KB at a time, we have to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) // a bounce buffer and move the data a piece at a time between the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) // bounce buffer and the actual transfer buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) alloclen = min(totallen, 65536u);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) buffer = kmalloc(alloclen, GFP_NOIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) if (buffer == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) // loop, never allocate or transfer more than 64k at once
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) // (min(128k, 255*info->ssize) is the real limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) len = min(totallen, alloclen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) thistime = (len / info->ssize) & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) // Get the data from the transfer buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) usb_stor_access_xfer_buf(buffer, len, us->srb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) &sg, &sg_offset, FROM_XFER_BUF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) command[0] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) command[1] = thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) command[2] = sector & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) command[3] = (sector >> 8) & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) command[4] = (sector >> 16) & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) command[5] = 0xE0 | ((sector >> 24) & 0x0F);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) command[6] = 0x30;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) // send the setup + command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 0, 0x20, 0, 1, command, 7);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) if (result != USB_STOR_XFER_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) // send the data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) result = jumpshot_bulk_write(us, buffer, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) if (result != USB_STOR_XFER_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) // read the result. apparently the bulk write can complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) // before the jumpshot drive is finished writing. so we loop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) // here until we get a good return code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) waitcount = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) result = jumpshot_get_status(us);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) if (result != USB_STOR_TRANSPORT_GOOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) // I have not experimented to find the smallest value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) msleep(50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) if (result != USB_STOR_TRANSPORT_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) usb_stor_dbg(us, "Gah! Waitcount = 10. Bad write!?\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) sector += thistime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) totallen -= len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) } while (totallen > 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) kfree(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) leave:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) kfree(buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) static int jumpshot_id_device(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) struct jumpshot_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) unsigned char *command = us->iobuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) unsigned char *reply;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) command[0] = 0xE0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) command[1] = 0xEC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) reply = kmalloc(512, GFP_NOIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) if (!reply)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) // send the setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) rc = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 0, 0x20, 0, 6, command, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) if (rc != USB_STOR_XFER_GOOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) usb_stor_dbg(us, "Gah! send_control for read_capacity failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) rc = USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) // read the reply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) rc = jumpshot_bulk_read(us, reply, 512);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) if (rc != USB_STOR_XFER_GOOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) rc = USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) goto leave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) info->sectors = ((u32)(reply[117]) << 24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) ((u32)(reply[116]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) ((u32)(reply[115]) << 8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) ((u32)(reply[114]) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) rc = USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) leave:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) kfree(reply);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) static int jumpshot_handle_mode_sense(struct us_data *us,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) struct scsi_cmnd * srb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) int sense_6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) static unsigned char rw_err_page[12] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 0x1, 0xA, 0x21, 1, 0, 0, 0, 0, 1, 0, 0, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) static unsigned char cache_page[12] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 0x8, 0xA, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) static unsigned char rbac_page[12] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 0x1B, 0xA, 0, 0x81, 0, 0, 0, 0, 0, 0, 0, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) static unsigned char timer_page[8] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 0x1C, 0x6, 0, 0, 0, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) unsigned char pc, page_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) unsigned int i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) struct jumpshot_info *info = (struct jumpshot_info *) (us->extra);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) unsigned char *ptr = us->iobuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) pc = srb->cmnd[2] >> 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) page_code = srb->cmnd[2] & 0x3F;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) switch (pc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) case 0x0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) usb_stor_dbg(us, "Current values\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) case 0x1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) usb_stor_dbg(us, "Changeable values\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) case 0x2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) usb_stor_dbg(us, "Default values\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) case 0x3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) usb_stor_dbg(us, "Saves values\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) memset(ptr, 0, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) if (sense_6) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) ptr[2] = 0x00; // WP enable: 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) i = 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) ptr[3] = 0x00; // WP enable: 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) i = 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) switch (page_code) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) case 0x0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) // vendor-specific mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) info->sense_key = 0x05;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) info->sense_asc = 0x24;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) info->sense_ascq = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) return USB_STOR_TRANSPORT_FAILED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) case 0x1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) i += sizeof(rw_err_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) case 0x8:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) memcpy(ptr + i, cache_page, sizeof(cache_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) i += sizeof(cache_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) case 0x1B:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) memcpy(ptr + i, rbac_page, sizeof(rbac_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) i += sizeof(rbac_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) case 0x1C:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) memcpy(ptr + i, timer_page, sizeof(timer_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) i += sizeof(timer_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) case 0x3F:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) memcpy(ptr + i, timer_page, sizeof(timer_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) i += sizeof(timer_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) memcpy(ptr + i, rbac_page, sizeof(rbac_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) i += sizeof(rbac_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) memcpy(ptr + i, cache_page, sizeof(cache_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) i += sizeof(cache_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) i += sizeof(rw_err_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) if (sense_6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) ptr[0] = i - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) ((__be16 *) ptr)[0] = cpu_to_be16(i - 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) usb_stor_set_xfer_buf(ptr, i, srb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) static void jumpshot_info_destructor(void *extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) // this routine is a placeholder...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) // currently, we don't allocate any extra blocks so we're okay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) // Transport for the Lexar 'Jumpshot'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) struct jumpshot_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) unsigned long block, blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) unsigned char *ptr = us->iobuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) static unsigned char inquiry_response[8] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) if (!us->extra) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) if (!us->extra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) us->extra_destructor = jumpshot_info_destructor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) info = (struct jumpshot_info *) (us->extra);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) if (srb->cmnd[0] == INQUIRY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) usb_stor_dbg(us, "INQUIRY - Returning bogus response\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) memcpy(ptr, inquiry_response, sizeof(inquiry_response));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) fill_inquiry_response(us, ptr, 36);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) if (srb->cmnd[0] == READ_CAPACITY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) info->ssize = 0x200; // hard coded 512 byte sectors as per ATA spec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) rc = jumpshot_get_status(us);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) if (rc != USB_STOR_TRANSPORT_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) rc = jumpshot_id_device(us, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) if (rc != USB_STOR_TRANSPORT_GOOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) info->sectors, info->ssize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) // build the reply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) usb_stor_set_xfer_buf(ptr, 8, srb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) if (srb->cmnd[0] == MODE_SELECT_10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) usb_stor_dbg(us, "Gah! MODE_SELECT_10\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) return USB_STOR_TRANSPORT_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) if (srb->cmnd[0] == READ_10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) return jumpshot_read_data(us, info, block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) if (srb->cmnd[0] == READ_12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) // I don't think we'll ever see a READ_12 but support it anyway...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) return jumpshot_read_data(us, info, block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) if (srb->cmnd[0] == WRITE_10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) return jumpshot_write_data(us, info, block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) if (srb->cmnd[0] == WRITE_12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) // I don't think we'll ever see a WRITE_12 but support it anyway...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) return jumpshot_write_data(us, info, block, blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) if (srb->cmnd[0] == TEST_UNIT_READY) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) usb_stor_dbg(us, "TEST_UNIT_READY\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) return jumpshot_get_status(us);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) if (srb->cmnd[0] == REQUEST_SENSE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) usb_stor_dbg(us, "REQUEST_SENSE\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) memset(ptr, 0, 18);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) ptr[0] = 0xF0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) ptr[2] = info->sense_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) ptr[7] = 11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) ptr[12] = info->sense_asc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) ptr[13] = info->sense_ascq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) usb_stor_set_xfer_buf(ptr, 18, srb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) if (srb->cmnd[0] == MODE_SENSE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) usb_stor_dbg(us, "MODE_SENSE_6 detected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) return jumpshot_handle_mode_sense(us, srb, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) if (srb->cmnd[0] == MODE_SENSE_10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) usb_stor_dbg(us, "MODE_SENSE_10 detected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) return jumpshot_handle_mode_sense(us, srb, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) * sure. whatever. not like we can stop the user from popping
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) * the media out of the device (no locking doors, etc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) return USB_STOR_TRANSPORT_GOOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) if (srb->cmnd[0] == START_STOP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) * this is used by sd.c'check_scsidisk_media_change to detect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) * media change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) usb_stor_dbg(us, "START_STOP\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * the first jumpshot_id_device after a media change returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) * an error (determined experimentally)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) rc = jumpshot_id_device(us, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) if (rc == USB_STOR_TRANSPORT_GOOD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) info->sense_key = NO_SENSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) srb->result = SUCCESS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) info->sense_key = UNIT_ATTENTION;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) srb->result = SAM_STAT_CHECK_CONDITION;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) srb->cmnd[0], srb->cmnd[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) info->sense_key = 0x05;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) info->sense_asc = 0x20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) info->sense_ascq = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) return USB_STOR_TRANSPORT_FAILED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) static struct scsi_host_template jumpshot_host_template;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) static int jumpshot_probe(struct usb_interface *intf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) const struct usb_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) struct us_data *us;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) result = usb_stor_probe1(&us, intf, id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) &jumpshot_host_template);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) us->transport_name = "Lexar Jumpshot Control/Bulk";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) us->transport = jumpshot_transport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) us->transport_reset = usb_stor_Bulk_reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) us->max_lun = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) result = usb_stor_probe2(us);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) static struct usb_driver jumpshot_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) .name = DRV_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) .probe = jumpshot_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) .disconnect = usb_stor_disconnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) .suspend = usb_stor_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) .resume = usb_stor_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) .reset_resume = usb_stor_reset_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) .pre_reset = usb_stor_pre_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) .post_reset = usb_stor_post_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) .id_table = jumpshot_usb_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) .soft_unbind = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) .no_dynamic_id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) module_usb_stor_driver(jumpshot_driver, jumpshot_host_template, DRV_NAME);