Adding blacklist support to the pegasus driver
Subsystems (4)
PATCH 1/1 Adding blacklist support to the pegasus driver
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
Quoted 1 line
From
840b9f950175a27173a2e65a10332eb74c4654fcMon Sep 17 00:00:00 2001
From: Stefan Bader <[email protected]>
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.
--- drivers/net/usb/pegasus.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/net/usb/pegasus.c +24 -0
@@ -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" );
Signature · 1 line
1.5.4.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
Am Montag 24 März 2008 schrieb Stefan Bader:
Quoted 3 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Petko Manolov
maintainerQuoted 7 lines · Oliver Neukum
Am Montag 24 März 2008 schrieb Stefan Bader:
Quoted 3 lines
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
Am Dienstag, 25. März 2008 21:05:31 schrieb Petko Manolov:
Quoted 7 lines · Oliver Neukum
Quoted 6 lines
Am Montag 24 März 2008 schrieb Stefan Bader:
Quoted 3 lines
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.
Quoted 5 lines
Quoted 2 lines
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
A message that is not in the archive (sent off-list or not yet received): 200803252135.29249.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org
Quoted 11 lines · Oliver Neukum
Am Dienstag, 25. März 2008 21:05:31 schrieb Petko Manolov:
Quoted 10 lines · Oliver Neukum
Quoted 8 lines
Am Montag 24 März 2008 schrieb Stefan Bader:
Quoted 3 lines
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.
Quoted 6 lines
Quoted 2 lines
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