* [PATCH] Adding blacklist support to the pegasus driver
@ 2008-03-24 16:10 Stefan Bader
[not found] ` <47E7D266.8050500-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Bader @ 2008-03-24 16:10 UTC (permalink / raw)
To: linux-usb, netdev; +Cc: petkan
[-- Attachment #1: Type: text/plain, Size: 783 bytes --]
I have been working on a problem which arose from the fact that (at
least one vendor) some vendors use the same vendor and model number for
different pieces of hardware.
In this case the Belkin bluetooth dongle uses the same numbers as the
network adapter which causes machines to lock up as soon as the
bluetooth dongle gets inserted.
As far as I found there had been discussions about adding some sort of
blacklisting support to the pegasus module before but I have not found
any code doing so.
This is what the attached patch does. There is possibly much room for
improvement but at least it seems to work. Would it be possible to
include something like this in the mainline driver?
Please keep me cc'ed on replies, since I am not subscribed to the
mailing lists. Thanks.
Stefan
[-- Attachment #2: 0001-Add-blacklisting-support-to-pegasus-u.patch --]
[-- Type: text/x-diff, Size: 1784 bytes --]
>From 840b9f950175a27173a2e65a10332eb74c4654fc Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Mon, 24 Mar 2008 11:49:40 -0400
Subject: [PATCH] Add blacklisting support to pegasus usb driver.
Belkin uses the same vendor id for both the ethernet and the bluetooth
device, but the pegasus driver only checks for the vendor id to decide
whether to drive a device or not. This locks up computers that are using
the bluetooth dongle.
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
drivers/net/usb/pegasus.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index d1ed68a..198f518 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1289,6 +1289,24 @@ static void check_carrier(struct work_struct *work)
}
}
+static int pegasus_blacklisted(struct usb_device *udev)
+{
+ struct usb_device_descriptor *udd = &udev->descriptor;
+
+ /* Special quirk to keep the driver from handling the Belkin Bluetooth
+ * dongle which happens to have the same ID as the network dongle.
+ */
+ if (udd->idVendor == VENDOR_BELKIN && udd->idProduct == 0x0121) {
+ if (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) {
+ if (udd->bDeviceProtocol == 1) {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
static int pegasus_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -1300,6 +1318,12 @@ static int pegasus_probe(struct usb_interface *intf,
DECLARE_MAC_BUF(mac);
usb_get_dev(dev);
+
+ if (pegasus_blacklisted(dev)) {
+ res = -ENODEV;
+ goto out;
+ }
+
net = alloc_etherdev(sizeof(struct pegasus));
if (!net) {
dev_err(&intf->dev, "can't allocate %s\n", "device");
--
1.5.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Adding blacklist support to the pegasus driver
[not found] ` <47E7D266.8050500-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2008-03-24 16:47 ` Oliver Neukum
2008-03-25 20:05 ` Petko Manolov
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2008-03-24 16:47 UTC (permalink / raw)
To: Stefan Bader
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
petkan-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
Am Montag 24 März 2008 schrieb Stefan Bader:
> I have been working on a problem which arose from the fact that (at
> least one vendor) some vendors use the same vendor and model number for
> different pieces of hardware.
That issue can be solved with using the correct macros for probing that
include a device class check.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Adding blacklist support to the pegasus driver
2008-03-24 16:47 ` Oliver Neukum
@ 2008-03-25 20:05 ` Petko Manolov
2008-03-25 20:35 ` Oliver Neukum
0 siblings, 1 reply; 5+ messages in thread
From: Petko Manolov @ 2008-03-25 20:05 UTC (permalink / raw)
To: Oliver Neukum; +Cc: Stefan Bader, linux-usb, netdev, petkan
[-- Attachment #1: Type: TEXT/PLAIN, Size: 513 bytes --]
On Mon, 24 Mar 2008, Oliver Neukum wrote:
> Am Montag 24 März 2008 schrieb Stefan Bader:
>> I have been working on a problem which arose from the fact that (at
>> least one vendor) some vendors use the same vendor and model number for
>> different pieces of hardware.
>
> That issue can be solved with using the correct macros for probing that
> include a device class check.
Can you show a driver that is already doing that. I am sorry to be so
lazy, but i can't help it... :-)
later,
Petko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Adding blacklist support to the pegasus driver
2008-03-25 20:05 ` Petko Manolov
@ 2008-03-25 20:35 ` Oliver Neukum
[not found] ` <200803252135.29249.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2008-03-25 20:35 UTC (permalink / raw)
To: Petko Manolov; +Cc: Stefan Bader, linux-usb, netdev, petkan
Am Dienstag, 25. März 2008 21:05:31 schrieb Petko Manolov:
> On Mon, 24 Mar 2008, Oliver Neukum wrote:
>
> > Am Montag 24 März 2008 schrieb Stefan Bader:
> >> I have been working on a problem which arose from the fact that (at
> >> least one vendor) some vendors use the same vendor and model number for
> >> different pieces of hardware.
> >
> > That issue can be solved with using the correct macros for probing that
> > include a device class check.
>
> Can you show a driver that is already doing that. I am sorry to be so
> lazy, but i can't help it... :-)
http://fixunix.com/kernel/256881-add-infamous-huawei-e220-option-c-3.html
Just ask and you shall be answered.
HTH
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Adding blacklist support to the pegasus driver
[not found] ` <200803252135.29249.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
@ 2008-03-25 20:44 ` Petko Manolov
0 siblings, 0 replies; 5+ messages in thread
From: Petko Manolov @ 2008-03-25 20:44 UTC (permalink / raw)
To: Oliver Neukum
Cc: Stefan Bader, linux-usb-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
petkan-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: TEXT/PLAIN, Size: 896 bytes --]
On Tue, 25 Mar 2008, Oliver Neukum wrote:
> Am Dienstag, 25. März 2008 21:05:31 schrieb Petko Manolov:
>> On Mon, 24 Mar 2008, Oliver Neukum wrote:
>>
>>> Am Montag 24 März 2008 schrieb Stefan Bader:
>>>> I have been working on a problem which arose from the fact that (at
>>>> least one vendor) some vendors use the same vendor and model number for
>>>> different pieces of hardware.
>>>
>>> That issue can be solved with using the correct macros for probing that
>>> include a device class check.
>>
>> Can you show a driver that is already doing that. I am sorry to be so
>> lazy, but i can't help it... :-)
>
> http://fixunix.com/kernel/256881-add-infamous-huawei-e220-option-c-3.html
>
> Just ask and you shall be answered.
Ah, now i see. :-)
This (if works) seems simpler and more elegant. I'll play with it in the
morning. Thanks for the link.
Petko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-25 20:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-24 16:10 [PATCH] Adding blacklist support to the pegasus driver Stefan Bader
[not found] ` <47E7D266.8050500-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2008-03-24 16:47 ` Oliver Neukum
2008-03-25 20:05 ` Petko Manolov
2008-03-25 20:35 ` Oliver Neukum
[not found] ` <200803252135.29249.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-03-25 20:44 ` Petko Manolov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.