blob: 499669bcf7002a54b0457dfbe18222bf5809a106 [file] [log] [blame]
Felipe Balbif0183a32016-04-18 13:09:11 +03001/*
2 * Driver for USB Mass Storage devices
Alan Sterne6e244b2009-02-12 14:47:44 -05003 * Usual Tables File for usb-storage and libusual
4 *
5 * Copyright (C) 2009 Alan Stern (stern@rowland.harvard.edu)
6 *
7 * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more
8 * information about this driver.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2, or (at your option) any
13 * later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#include <linux/kernel.h>
26#include <linux/module.h>
27#include <linux/usb.h>
28#include <linux/usb_usual.h>
29
30
31/*
32 * The table of devices
33 */
34#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
35 vendorName, productName, useProtocol, useTransport, \
36 initFunction, flags) \
37{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
Alan Sterne6e244b2009-02-12 14:47:44 -050038 .driver_info = (flags) }
39
Sebastian Andrzej Siewiorf61870e2012-08-28 22:37:13 +020040#define COMPLIANT_DEV UNUSUAL_DEV
41
42#define USUAL_DEV(useProto, useTrans) \
43{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) }
Alan Sterne6e244b2009-02-12 14:47:44 -050044
fangxiaozhi07c7be32013-02-04 15:14:46 +080045/* Define the device is matched with Vendor ID and interface descriptors */
46#define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \
47 vendorName, productName, useProtocol, useTransport, \
48 initFunction, flags) \
49{ \
50 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
51 | USB_DEVICE_ID_MATCH_VENDOR, \
52 .idVendor = (id_vendor), \
53 .bInterfaceClass = (cl), \
54 .bInterfaceSubClass = (sc), \
55 .bInterfaceProtocol = (pr), \
56 .driver_info = (flags) \
57}
58
Alan Sterne6e244b2009-02-12 14:47:44 -050059struct usb_device_id usb_storage_usb_ids[] = {
60# include "unusual_devs.h"
61 { } /* Terminating entry */
62};
Alan Sterne6e244b2009-02-12 14:47:44 -050063MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
64
65#undef UNUSUAL_DEV
66#undef COMPLIANT_DEV
67#undef USUAL_DEV
fangxiaozhi07c7be32013-02-04 15:14:46 +080068#undef UNUSUAL_VENDOR_INTF
Alan Sterne6e244b2009-02-12 14:47:44 -050069
Alan Sterne6e244b2009-02-12 14:47:44 -050070/*
71 * The table of devices to ignore
72 */
73struct ignore_entry {
74 u16 vid, pid, bcdmin, bcdmax;
75};
76
77#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
78 vendorName, productName, useProtocol, useTransport, \
79 initFunction, flags) \
80{ \
81 .vid = id_vendor, \
82 .pid = id_product, \
83 .bcdmin = bcdDeviceMin, \
84 .bcdmax = bcdDeviceMax, \
85}
86
87static struct ignore_entry ignore_ids[] = {
Alan Sterna74bba32009-02-12 14:48:22 -050088# include "unusual_alauda.h"
Alan Sternfcdb5142009-02-12 14:48:04 -050089# include "unusual_cypress.h"
Alan Stern2cbbf352009-02-12 14:48:15 -050090# include "unusual_datafab.h"
huajun li41e568d2011-03-04 10:56:18 +080091# include "unusual_ene_ub6250.h"
Alan Stern0d629392009-02-12 14:48:11 -050092# include "unusual_freecom.h"
Alan Stern32d54932009-02-12 14:47:54 -050093# include "unusual_isd200.h"
Alan Sterna9fb6d02009-02-12 14:48:19 -050094# include "unusual_jumpshot.h"
Alan Sternc1033782009-02-12 14:48:26 -050095# include "unusual_karma.h"
Alan Stern9cfb95e2009-02-12 14:48:33 -050096# include "unusual_onetouch.h"
wwang50a6cb92011-01-14 16:53:34 +080097# include "unusual_realtek.h"
Alan Stern0ff71882009-02-12 14:47:49 -050098# include "unusual_sddr09.h"
Alan Stern70fcc002009-02-12 14:47:59 -050099# include "unusual_sddr55.h"
Alan Stern26d68182009-02-12 14:48:08 -0500100# include "unusual_usbat.h"
Alan Sterne6e244b2009-02-12 14:47:44 -0500101 { } /* Terminating entry */
102};
103
104#undef UNUSUAL_DEV
105
Alan Sterne6e244b2009-02-12 14:47:44 -0500106/* Return an error if a device is in the ignore_ids list */
107int usb_usual_ignore_device(struct usb_interface *intf)
108{
109 struct usb_device *udev;
110 unsigned vid, pid, bcd;
111 struct ignore_entry *p;
112
113 udev = interface_to_usbdev(intf);
114 vid = le16_to_cpu(udev->descriptor.idVendor);
115 pid = le16_to_cpu(udev->descriptor.idProduct);
116 bcd = le16_to_cpu(udev->descriptor.bcdDevice);
117
118 for (p = ignore_ids; p->vid; ++p) {
119 if (p->vid == vid && p->pid == pid &&
120 p->bcdmin <= bcd && p->bcdmax >= bcd)
121 return -ENXIO;
122 }
123 return 0;
124}