diff options
Diffstat (limited to 'drivers/usb/net')
-rw-r--r-- | drivers/usb/net/pegasus.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index d8c7adabf201..156a2f1cb39a 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -57,12 +57,14 @@ static const char driver_name[] = "pegasus"; | |||
57 | 57 | ||
58 | static int loopback = 0; | 58 | static int loopback = 0; |
59 | static int mii_mode = 0; | 59 | static int mii_mode = 0; |
60 | static char *devid=NULL; | ||
60 | 61 | ||
61 | static struct usb_eth_dev usb_dev_id[] = { | 62 | static struct usb_eth_dev usb_dev_id[] = { |
62 | #define PEGASUS_DEV(pn, vid, pid, flags) \ | 63 | #define PEGASUS_DEV(pn, vid, pid, flags) \ |
63 | {.name = pn, .vendor = vid, .device = pid, .private = flags}, | 64 | {.name = pn, .vendor = vid, .device = pid, .private = flags}, |
64 | #include "pegasus.h" | 65 | #include "pegasus.h" |
65 | #undef PEGASUS_DEV | 66 | #undef PEGASUS_DEV |
67 | {NULL, 0, 0, 0}, | ||
66 | {NULL, 0, 0, 0} | 68 | {NULL, 0, 0, 0} |
67 | }; | 69 | }; |
68 | 70 | ||
@@ -71,6 +73,7 @@ static struct usb_device_id pegasus_ids[] = { | |||
71 | {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid}, | 73 | {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid}, |
72 | #include "pegasus.h" | 74 | #include "pegasus.h" |
73 | #undef PEGASUS_DEV | 75 | #undef PEGASUS_DEV |
76 | {}, | ||
74 | {} | 77 | {} |
75 | }; | 78 | }; |
76 | 79 | ||
@@ -79,8 +82,10 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
79 | MODULE_LICENSE("GPL"); | 82 | MODULE_LICENSE("GPL"); |
80 | module_param(loopback, bool, 0); | 83 | module_param(loopback, bool, 0); |
81 | module_param(mii_mode, bool, 0); | 84 | module_param(mii_mode, bool, 0); |
85 | module_param(devid, charp, 0); | ||
82 | MODULE_PARM_DESC(loopback, "Enable MAC loopback mode (bit 0)"); | 86 | MODULE_PARM_DESC(loopback, "Enable MAC loopback mode (bit 0)"); |
83 | MODULE_PARM_DESC(mii_mode, "Enable HomePNA mode (bit 0),default=MII mode = 0"); | 87 | MODULE_PARM_DESC(mii_mode, "Enable HomePNA mode (bit 0),default=MII mode = 0"); |
88 | MODULE_PARM_DESC(devid, "The format is: 'DEV_name:VendorID:DeviceID:Flags'"); | ||
84 | 89 | ||
85 | /* use ethtool to change the level for any given device */ | 90 | /* use ethtool to change the level for any given device */ |
86 | static int msg_level = -1; | 91 | static int msg_level = -1; |
@@ -1410,9 +1415,42 @@ static struct usb_driver pegasus_driver = { | |||
1410 | .resume = pegasus_resume, | 1415 | .resume = pegasus_resume, |
1411 | }; | 1416 | }; |
1412 | 1417 | ||
1418 | static void parse_id(char *id) | ||
1419 | { | ||
1420 | unsigned int vendor_id=0, device_id=0, flags=0, i=0; | ||
1421 | char *token, *name=NULL; | ||
1422 | |||
1423 | if ((token = strsep(&id, ":")) != NULL) | ||
1424 | name = token; | ||
1425 | /* name now points to a null terminated string*/ | ||
1426 | if ((token = strsep(&id, ":")) != NULL) | ||
1427 | vendor_id = simple_strtoul(token, NULL, 16); | ||
1428 | if ((token = strsep(&id, ":")) != NULL) | ||
1429 | device_id = simple_strtoul(token, NULL, 16); | ||
1430 | flags = simple_strtoul(id, NULL, 16); | ||
1431 | pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n", | ||
1432 | driver_name, name, vendor_id, device_id, flags); | ||
1433 | |||
1434 | if (vendor_id > 0x10000 || vendor_id == 0) | ||
1435 | return; | ||
1436 | if (device_id > 0x10000 || device_id == 0) | ||
1437 | return; | ||
1438 | |||
1439 | for (i=0; usb_dev_id[i].name; i++); | ||
1440 | usb_dev_id[i].name = name; | ||
1441 | usb_dev_id[i].vendor = vendor_id; | ||
1442 | usb_dev_id[i].device = device_id; | ||
1443 | usb_dev_id[i].private = flags; | ||
1444 | pegasus_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | ||
1445 | pegasus_ids[i].idVendor = vendor_id; | ||
1446 | pegasus_ids[i].idProduct = device_id; | ||
1447 | } | ||
1448 | |||
1413 | static int __init pegasus_init(void) | 1449 | static int __init pegasus_init(void) |
1414 | { | 1450 | { |
1415 | pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION); | 1451 | pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION); |
1452 | if (devid) | ||
1453 | parse_id(devid); | ||
1416 | pegasus_workqueue = create_singlethread_workqueue("pegasus"); | 1454 | pegasus_workqueue = create_singlethread_workqueue("pegasus"); |
1417 | if (!pegasus_workqueue) | 1455 | if (!pegasus_workqueue) |
1418 | return -ENOMEM; | 1456 | return -ENOMEM; |