1 // SPDX-License-Identifier: GPL-2.0+
3 * Driver for USB Mass Storage devices
4 * Usual Tables File for usb-storage and libusual
8 * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more
9 * information about this driver.
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/usb.h>
15 #include <linux/usb_usual.h>
19 * The table of devices
21 #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
22 vendorName, productName, useProtocol, useTransport, \
23 initFunction, flags) \
24 { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
25 .driver_info = (flags) }
27 #define COMPLIANT_DEV UNUSUAL_DEV
29 #define USUAL_DEV(useProto, useTrans) \
30 { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) }
32 /* Define the device is matched with Vendor ID and interface descriptors */
33 #define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \
34 vendorName, productName, useProtocol, useTransport, \
35 initFunction, flags) \
37 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
38 | USB_DEVICE_ID_MATCH_VENDOR, \
39 .idVendor = (id_vendor), \
40 .bInterfaceClass = (cl), \
41 .bInterfaceSubClass = (sc), \
42 .bInterfaceProtocol = (pr), \
43 .driver_info = (flags) \
46 struct usb_device_id usb_storage_usb_ids[] = {
47 # include "unusual_devs.h"
48 { } /* Terminating entry */
50 MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
55 #undef UNUSUAL_VENDOR_INTF
58 * The table of devices to ignore
61 u16 vid, pid, bcdmin, bcdmax;
64 #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
65 vendorName, productName, useProtocol, useTransport, \
66 initFunction, flags) \
70 .bcdmin = bcdDeviceMin, \
71 .bcdmax = bcdDeviceMax, \
74 static struct ignore_entry ignore_ids[] = {
75 # include "unusual_alauda.h"
76 # include "unusual_cypress.h"
77 # include "unusual_datafab.h"
78 # include "unusual_ene_ub6250.h"
79 # include "unusual_freecom.h"
80 # include "unusual_isd200.h"
81 # include "unusual_jumpshot.h"
82 # include "unusual_karma.h"
83 # include "unusual_onetouch.h"
84 # include "unusual_realtek.h"
85 # include "unusual_sddr09.h"
86 # include "unusual_sddr55.h"
87 # include "unusual_usbat.h"
88 { } /* Terminating entry */
93 /* Return an error if a device is in the ignore_ids list */
94 int usb_usual_ignore_device(struct usb_interface *intf)
96 struct usb_device *udev;
97 unsigned vid, pid, bcd;
98 struct ignore_entry *p;
100 udev = interface_to_usbdev(intf);
101 vid = le16_to_cpu(udev->descriptor.idVendor);
102 pid = le16_to_cpu(udev->descriptor.idProduct);
103 bcd = le16_to_cpu(udev->descriptor.bcdDevice);
105 for (p = ignore_ids; p->vid; ++p) {
106 if (p->vid == vid && p->pid == pid &&
107 p->bcdmin <= bcd && p->bcdmax >= bcd)