1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
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), \
38 .driver_info = (flags) }
39
40#define COMPLIANT_DEV UNUSUAL_DEV
41
42#define USUAL_DEV(useProto, useTrans) \
43{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) }
44
45
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
59struct usb_device_id usb_storage_usb_ids[] = {
60# include "unusual_devs.h"
61 { }
62};
63MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
64
65#undef UNUSUAL_DEV
66#undef COMPLIANT_DEV
67#undef USUAL_DEV
68#undef UNUSUAL_VENDOR_INTF
69
70
71
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[] = {
88# include "unusual_alauda.h"
89# include "unusual_cypress.h"
90# include "unusual_datafab.h"
91# include "unusual_ene_ub6250.h"
92# include "unusual_freecom.h"
93# include "unusual_isd200.h"
94# include "unusual_jumpshot.h"
95# include "unusual_karma.h"
96# include "unusual_onetouch.h"
97# include "unusual_realtek.h"
98# include "unusual_sddr09.h"
99# include "unusual_sddr55.h"
100# include "unusual_usbat.h"
101 { }
102};
103
104#undef UNUSUAL_DEV
105
106
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}
125