All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Bader <stefan.bader@canonical.com>
To: linux-usb@vger.kernel.org, netdev@vger.kernel.org
Cc: petkan@users.sourceforge.net
Subject: [PATCH] Adding blacklist support to the pegasus driver
Date: Mon, 24 Mar 2008 12:10:14 -0400	[thread overview]
Message-ID: <47E7D266.8050500@canonical.com> (raw)

[-- 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


             reply	other threads:[~2008-03-24 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 16:10 Stefan Bader [this message]
     [not found] ` <47E7D266.8050500-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2008-03-24 16:47   ` [PATCH] Adding blacklist support to the pegasus driver 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47E7D266.8050500@canonical.com \
    --to=stefan.bader@canonical.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petkan@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.