/[linux-patches]/genpatches-2.6/trunk/2.6.14/1011_2_usb-interface-modalias.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1011_2_usb-interface-modalias.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 208 - (show annotations) (download) (as text)
Fri Nov 11 11:24:33 2005 UTC (15 years ago) by dsd
File MIME type: text/x-diff
File size: 5407 byte(s)
Linux 2.6.14.2
1 From linux-usb-devel-admin@lists.sourceforge.net Fri Oct 28 20:19:30 2005
2 Date: Fri, 28 Oct 2005 20:09:17 -0700
3 From: Greg Kroah-Hartman <gregkh@suse.de>
4 Subject: USB: always export interface information for modalias
5
6 This fixes a problem with some cdc acm devices that were not getting
7 automatically loaded as the module alias was not being reported
8 properly.
9
10 This check was for back in the days when we only reported hotplug events
11 for the main usb device, not the interfaces. We should always give the
12 interface information for MODALIAS/modalias as it can be needed.
13
14 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15
16 ---
17 drivers/usb/core/sysfs.c | 33 +++++++++---------------
18 drivers/usb/core/usb.c | 63 +++++++++++++++++------------------------------
19 2 files changed, 36 insertions(+), 60 deletions(-)
20
21 --- linux-2.6.14.1.orig/drivers/usb/core/sysfs.c
22 +++ linux-2.6.14.1/drivers/usb/core/sysfs.c
23 @@ -292,30 +292,23 @@ static ssize_t show_modalias(struct devi
24 {
25 struct usb_interface *intf;
26 struct usb_device *udev;
27 - int len;
28 + struct usb_host_interface *alt;
29
30 intf = to_usb_interface(dev);
31 udev = interface_to_usbdev(intf);
32 + alt = intf->cur_altsetting;
33
34 - len = sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic",
35 - le16_to_cpu(udev->descriptor.idVendor),
36 - le16_to_cpu(udev->descriptor.idProduct),
37 - le16_to_cpu(udev->descriptor.bcdDevice),
38 - udev->descriptor.bDeviceClass,
39 - udev->descriptor.bDeviceSubClass,
40 - udev->descriptor.bDeviceProtocol);
41 - buf += len;
42 -
43 - if (udev->descriptor.bDeviceClass == 0) {
44 - struct usb_host_interface *alt = intf->cur_altsetting;
45 -
46 - return len + sprintf(buf, "%02Xisc%02Xip%02X\n",
47 - alt->desc.bInterfaceClass,
48 - alt->desc.bInterfaceSubClass,
49 - alt->desc.bInterfaceProtocol);
50 - } else {
51 - return len + sprintf(buf, "*isc*ip*\n");
52 - }
53 + return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02X"
54 + "ic%02Xisc%02Xip%02X\n",
55 + le16_to_cpu(udev->descriptor.idVendor),
56 + le16_to_cpu(udev->descriptor.idProduct),
57 + le16_to_cpu(udev->descriptor.bcdDevice),
58 + udev->descriptor.bDeviceClass,
59 + udev->descriptor.bDeviceSubClass,
60 + udev->descriptor.bDeviceProtocol,
61 + alt->desc.bInterfaceClass,
62 + alt->desc.bInterfaceSubClass,
63 + alt->desc.bInterfaceProtocol);
64 }
65 static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
66
67 --- linux-2.6.14.1.orig/drivers/usb/core/usb.c
68 +++ linux-2.6.14.1/drivers/usb/core/usb.c
69 @@ -557,6 +557,7 @@ static int usb_hotplug (struct device *d
70 {
71 struct usb_interface *intf;
72 struct usb_device *usb_dev;
73 + struct usb_host_interface *alt;
74 int i = 0;
75 int length = 0;
76
77 @@ -573,7 +574,8 @@ static int usb_hotplug (struct device *d
78
79 intf = to_usb_interface(dev);
80 usb_dev = interface_to_usbdev (intf);
81 -
82 + alt = intf->cur_altsetting;
83 +
84 if (usb_dev->devnum < 0) {
85 pr_debug ("usb %s: already deleted?\n", dev->bus_id);
86 return -ENODEV;
87 @@ -615,46 +617,27 @@ static int usb_hotplug (struct device *d
88 usb_dev->descriptor.bDeviceProtocol))
89 return -ENOMEM;
90
91 - if (usb_dev->descriptor.bDeviceClass == 0) {
92 - struct usb_host_interface *alt = intf->cur_altsetting;
93 + if (add_hotplug_env_var(envp, num_envp, &i,
94 + buffer, buffer_size, &length,
95 + "INTERFACE=%d/%d/%d",
96 + alt->desc.bInterfaceClass,
97 + alt->desc.bInterfaceSubClass,
98 + alt->desc.bInterfaceProtocol))
99 + return -ENOMEM;
100
101 - /* 2.4 only exposed interface zero. in 2.5, hotplug
102 - * agents are called for all interfaces, and can use
103 - * $DEVPATH/bInterfaceNumber if necessary.
104 - */
105 - if (add_hotplug_env_var(envp, num_envp, &i,
106 - buffer, buffer_size, &length,
107 - "INTERFACE=%d/%d/%d",
108 - alt->desc.bInterfaceClass,
109 - alt->desc.bInterfaceSubClass,
110 - alt->desc.bInterfaceProtocol))
111 - return -ENOMEM;
112 -
113 - if (add_hotplug_env_var(envp, num_envp, &i,
114 - buffer, buffer_size, &length,
115 - "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
116 - le16_to_cpu(usb_dev->descriptor.idVendor),
117 - le16_to_cpu(usb_dev->descriptor.idProduct),
118 - le16_to_cpu(usb_dev->descriptor.bcdDevice),
119 - usb_dev->descriptor.bDeviceClass,
120 - usb_dev->descriptor.bDeviceSubClass,
121 - usb_dev->descriptor.bDeviceProtocol,
122 - alt->desc.bInterfaceClass,
123 - alt->desc.bInterfaceSubClass,
124 - alt->desc.bInterfaceProtocol))
125 - return -ENOMEM;
126 - } else {
127 - if (add_hotplug_env_var(envp, num_envp, &i,
128 - buffer, buffer_size, &length,
129 - "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*",
130 - le16_to_cpu(usb_dev->descriptor.idVendor),
131 - le16_to_cpu(usb_dev->descriptor.idProduct),
132 - le16_to_cpu(usb_dev->descriptor.bcdDevice),
133 - usb_dev->descriptor.bDeviceClass,
134 - usb_dev->descriptor.bDeviceSubClass,
135 - usb_dev->descriptor.bDeviceProtocol))
136 - return -ENOMEM;
137 - }
138 + if (add_hotplug_env_var(envp, num_envp, &i,
139 + buffer, buffer_size, &length,
140 + "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
141 + le16_to_cpu(usb_dev->descriptor.idVendor),
142 + le16_to_cpu(usb_dev->descriptor.idProduct),
143 + le16_to_cpu(usb_dev->descriptor.bcdDevice),
144 + usb_dev->descriptor.bDeviceClass,
145 + usb_dev->descriptor.bDeviceSubClass,
146 + usb_dev->descriptor.bDeviceProtocol,
147 + alt->desc.bInterfaceClass,
148 + alt->desc.bInterfaceSubClass,
149 + alt->desc.bInterfaceProtocol))
150 + return -ENOMEM;
151
152 envp[i] = NULL;
153

  ViewVC Help
Powered by ViewVC 1.1.20