Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 1 | /* Driver for USB Mass Storage devices |
| 2 | * Usual Tables File for usb-storage and libusual |
| 3 | * |
| 4 | * Copyright (C) 2009 Alan Stern (stern@rowland.harvard.edu) |
| 5 | * |
| 6 | * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more |
| 7 | * information about this driver. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public License as published by the |
| 11 | * Free Software Foundation; either version 2, or (at your option) any |
| 12 | * later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ |
| 23 | |
| 24 | #include <linux/kernel.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/usb.h> |
| 27 | #include <linux/usb_usual.h> |
| 28 | |
| 29 | |
| 30 | /* |
| 31 | * The table of devices |
| 32 | */ |
| 33 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ |
| 34 | vendorName, productName, useProtocol, useTransport, \ |
| 35 | initFunction, flags) \ |
| 36 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 37 | .driver_info = (flags) } |
| 38 | |
Sebastian Andrzej Siewior | f61870e | 2012-08-28 22:37:13 +0200 | [diff] [blame] | 39 | #define COMPLIANT_DEV UNUSUAL_DEV |
| 40 | |
| 41 | #define USUAL_DEV(useProto, useTrans) \ |
| 42 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 43 | |
fangxiaozhi | 07c7be3 | 2013-02-04 15:14:46 +0800 | [diff] [blame] | 44 | /* Define the device is matched with Vendor ID and interface descriptors */ |
| 45 | #define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \ |
| 46 | vendorName, productName, useProtocol, useTransport, \ |
| 47 | initFunction, flags) \ |
| 48 | { \ |
| 49 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ |
| 50 | | USB_DEVICE_ID_MATCH_VENDOR, \ |
| 51 | .idVendor = (id_vendor), \ |
| 52 | .bInterfaceClass = (cl), \ |
| 53 | .bInterfaceSubClass = (sc), \ |
| 54 | .bInterfaceProtocol = (pr), \ |
| 55 | .driver_info = (flags) \ |
| 56 | } |
| 57 | |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 58 | struct usb_device_id usb_storage_usb_ids[] = { |
| 59 | # include "unusual_devs.h" |
| 60 | { } /* Terminating entry */ |
| 61 | }; |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 62 | MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids); |
| 63 | |
| 64 | #undef UNUSUAL_DEV |
| 65 | #undef COMPLIANT_DEV |
| 66 | #undef USUAL_DEV |
fangxiaozhi | 07c7be3 | 2013-02-04 15:14:46 +0800 | [diff] [blame] | 67 | #undef UNUSUAL_VENDOR_INTF |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 68 | |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 69 | /* |
| 70 | * The table of devices to ignore |
| 71 | */ |
| 72 | struct ignore_entry { |
| 73 | u16 vid, pid, bcdmin, bcdmax; |
| 74 | }; |
| 75 | |
| 76 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ |
| 77 | vendorName, productName, useProtocol, useTransport, \ |
| 78 | initFunction, flags) \ |
| 79 | { \ |
| 80 | .vid = id_vendor, \ |
| 81 | .pid = id_product, \ |
| 82 | .bcdmin = bcdDeviceMin, \ |
| 83 | .bcdmax = bcdDeviceMax, \ |
| 84 | } |
| 85 | |
| 86 | static struct ignore_entry ignore_ids[] = { |
Alan Stern | a74bba3 | 2009-02-12 14:48:22 -0500 | [diff] [blame] | 87 | # include "unusual_alauda.h" |
Alan Stern | fcdb514 | 2009-02-12 14:48:04 -0500 | [diff] [blame] | 88 | # include "unusual_cypress.h" |
Alan Stern | 2cbbf35 | 2009-02-12 14:48:15 -0500 | [diff] [blame] | 89 | # include "unusual_datafab.h" |
huajun li | 41e568d | 2011-03-04 10:56:18 +0800 | [diff] [blame] | 90 | # include "unusual_ene_ub6250.h" |
Alan Stern | 0d62939 | 2009-02-12 14:48:11 -0500 | [diff] [blame] | 91 | # include "unusual_freecom.h" |
Alan Stern | 32d5493 | 2009-02-12 14:47:54 -0500 | [diff] [blame] | 92 | # include "unusual_isd200.h" |
Alan Stern | a9fb6d0 | 2009-02-12 14:48:19 -0500 | [diff] [blame] | 93 | # include "unusual_jumpshot.h" |
Alan Stern | c103378 | 2009-02-12 14:48:26 -0500 | [diff] [blame] | 94 | # include "unusual_karma.h" |
Alan Stern | 9cfb95e | 2009-02-12 14:48:33 -0500 | [diff] [blame] | 95 | # include "unusual_onetouch.h" |
wwang | 50a6cb9 | 2011-01-14 16:53:34 +0800 | [diff] [blame] | 96 | # include "unusual_realtek.h" |
Alan Stern | 0ff7188 | 2009-02-12 14:47:49 -0500 | [diff] [blame] | 97 | # include "unusual_sddr09.h" |
Alan Stern | 70fcc00 | 2009-02-12 14:47:59 -0500 | [diff] [blame] | 98 | # include "unusual_sddr55.h" |
Alan Stern | 26d6818 | 2009-02-12 14:48:08 -0500 | [diff] [blame] | 99 | # include "unusual_usbat.h" |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 100 | { } /* Terminating entry */ |
| 101 | }; |
| 102 | |
| 103 | #undef UNUSUAL_DEV |
| 104 | |
Alan Stern | e6e244b | 2009-02-12 14:47:44 -0500 | [diff] [blame] | 105 | /* Return an error if a device is in the ignore_ids list */ |
| 106 | int usb_usual_ignore_device(struct usb_interface *intf) |
| 107 | { |
| 108 | struct usb_device *udev; |
| 109 | unsigned vid, pid, bcd; |
| 110 | struct ignore_entry *p; |
| 111 | |
| 112 | udev = interface_to_usbdev(intf); |
| 113 | vid = le16_to_cpu(udev->descriptor.idVendor); |
| 114 | pid = le16_to_cpu(udev->descriptor.idProduct); |
| 115 | bcd = le16_to_cpu(udev->descriptor.bcdDevice); |
| 116 | |
| 117 | for (p = ignore_ids; p->vid; ++p) { |
| 118 | if (p->vid == vid && p->pid == pid && |
| 119 | p->bcdmin <= bcd && p->bcdmax >= bcd) |
| 120 | return -ENXIO; |
| 121 | } |
| 122 | return 0; |
| 123 | } |