blob: a9b5f2e29189006bacf49f363b00507429db8196 [file] [log] [blame]
Alan Sterne6e244b2009-02-12 14:47:44 -05001/* 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), \
37 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
38
39#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
40 vendorName, productName, useProtocol, useTransport, \
41 initFunction, flags) \
42{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
43 .driver_info = (flags) }
44
45#define USUAL_DEV(useProto, useTrans, useType) \
46{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
47 .driver_info = ((useType)<<24) }
48
fangxiaozhifae3bb52013-02-04 15:14:46 +080049/* Define the device is matched with Vendor ID and interface descriptors */
50#define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \
51 vendorName, productName, useProtocol, useTransport, \
52 initFunction, flags) \
53{ \
54 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
55 | USB_DEVICE_ID_MATCH_VENDOR, \
56 .idVendor = (id_vendor), \
57 .bInterfaceClass = (cl), \
58 .bInterfaceSubClass = (sc), \
59 .bInterfaceProtocol = (pr), \
60 .driver_info = (flags) \
61}
62
Alan Sterne6e244b2009-02-12 14:47:44 -050063struct usb_device_id usb_storage_usb_ids[] = {
64# include "unusual_devs.h"
65 { } /* Terminating entry */
66};
67EXPORT_SYMBOL_GPL(usb_storage_usb_ids);
68
69MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
70
71#undef UNUSUAL_DEV
72#undef COMPLIANT_DEV
73#undef USUAL_DEV
fangxiaozhifae3bb52013-02-04 15:14:46 +080074#undef UNUSUAL_VENDOR_INTF
Alan Sterne6e244b2009-02-12 14:47:44 -050075
76
77/*
78 * The table of devices to ignore
79 */
80struct ignore_entry {
81 u16 vid, pid, bcdmin, bcdmax;
82};
83
84#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
85 vendorName, productName, useProtocol, useTransport, \
86 initFunction, flags) \
87{ \
88 .vid = id_vendor, \
89 .pid = id_product, \
90 .bcdmin = bcdDeviceMin, \
91 .bcdmax = bcdDeviceMax, \
92}
93
94static struct ignore_entry ignore_ids[] = {
Alan Sterna74bba32009-02-12 14:48:22 -050095# include "unusual_alauda.h"
Alan Sternfcdb5142009-02-12 14:48:04 -050096# include "unusual_cypress.h"
Alan Stern2cbbf352009-02-12 14:48:15 -050097# include "unusual_datafab.h"
huajun li41e568d2011-03-04 10:56:18 +080098# include "unusual_ene_ub6250.h"
Alan Stern0d629392009-02-12 14:48:11 -050099# include "unusual_freecom.h"
Alan Stern32d54932009-02-12 14:47:54 -0500100# include "unusual_isd200.h"
Alan Sterna9fb6d02009-02-12 14:48:19 -0500101# include "unusual_jumpshot.h"
Alan Sternc1033782009-02-12 14:48:26 -0500102# include "unusual_karma.h"
Alan Stern9cfb95e2009-02-12 14:48:33 -0500103# include "unusual_onetouch.h"
wwang50a6cb92011-01-14 16:53:34 +0800104# include "unusual_realtek.h"
Alan Stern0ff71882009-02-12 14:47:49 -0500105# include "unusual_sddr09.h"
Alan Stern70fcc002009-02-12 14:47:59 -0500106# include "unusual_sddr55.h"
Alan Stern26d68182009-02-12 14:48:08 -0500107# include "unusual_usbat.h"
Alan Sterne6e244b2009-02-12 14:47:44 -0500108 { } /* Terminating entry */
109};
110
111#undef UNUSUAL_DEV
112
113
114/* Return an error if a device is in the ignore_ids list */
115int usb_usual_ignore_device(struct usb_interface *intf)
116{
117 struct usb_device *udev;
118 unsigned vid, pid, bcd;
119 struct ignore_entry *p;
120
121 udev = interface_to_usbdev(intf);
122 vid = le16_to_cpu(udev->descriptor.idVendor);
123 pid = le16_to_cpu(udev->descriptor.idProduct);
124 bcd = le16_to_cpu(udev->descriptor.bcdDevice);
125
126 for (p = ignore_ids; p->vid; ++p) {
127 if (p->vid == vid && p->pid == pid &&
128 p->bcdmin <= bcd && p->bcdmax >= bcd)
129 return -ENXIO;
130 }
131 return 0;
132}
133EXPORT_SYMBOL_GPL(usb_usual_ignore_device);