Author: phoudoin Date: 2010-06-14 23:43:29 +0200 (Mon, 14 Jun 2010) New Revision: 37135 Changeset: http://dev.haiku-os.org/changeset/37135/haiku Ticket: http://dev.haiku-os.org/ticket/5209 Modified: haiku/trunk/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp haiku/trunk/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp Log: Register for only supported devices, which reduce a bit overhead when unrelated USB device is plugged-in. Applied patch for #5209 by oruizdorantes for usb_asix, do the same for usb_davicom. Will eventually rework it in order to remove duplicated IDs list. The usb_serial driver also needs the same optimization, but gathering the IDs list will take more time than refactor the code and since usb_serial is not yet included in haiku image neither ready (no tty module), there is less user experience immediate gain... Modified: haiku/trunk/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp 2010-06-14 21:33:11 UTC (rev 37134) +++ haiku/trunk/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp 2010-06-14 21:43:29 UTC (rev 37135) @@ -40,7 +40,39 @@ ~DriverSmartLock() { mutex_unlock(&gDriverLock); } }; +usb_support_descriptor gSupportedDevices[] = { + // AX88172 + { 0, 0, 0, 0x0b95, 0x1720}, // "ASIX 88172 10/100" + { 0, 0, 0, 0x07b8, 0x420a}, // "ABOCOM UF200" + { 0, 0, 0, 0x1189, 0x0893}, // "Acer C&M EP-1427X-2" + { 0, 0, 0, 0x0557, 0x2009}, // "ATEN UC-210T" + { 0, 0, 0, 0x08dd, 0x90ff}, // "Billionton USB2AR" + { 0, 0, 0, 0x07aa, 0x0017}, // "Corega USB2TX" + { 0, 0, 0, 0x2001, 0x1A00}, // "D-Link DUB-E100" + { 0, 0, 0, 0x1631, 0x6200}, // "GoodWay USB2Ethernet" + { 0, 0, 0, 0x04f1, 0x3008}, // "JVC MP-PRX1" + { 0, 0, 0, 0x077b, 0x2226}, // "LinkSys USB 2.0" + { 0, 0, 0, 0x0411, 0x003d}, // "Melco LUA-U2-KTX" + { 0, 0, 0, 0x0846, 0x1040}, // "NetGear USB 2.0 Ethernet" + { 0, 0, 0, 0x086e, 0x1920}, // "System TALKS SGC-X2UL" + { 0, 0, 0, 0x6189, 0x182d}, // "Sitecom LN-029" + // AX88772 + { 0, 0, 0, 0x0b95, 0x7720}, // "ASIX 88772 10/100" + { 0, 0, 0, 0x13b1, 0x0018}, // "Linksys USB200M rev.2" + { 0, 0, 0, 0x07d1, 0x3c05}, // alternate D-Link DUB-E100 rev. B1 + { 0, 0, 0, 0x2001, 0x3c05}, // "D-Link DUB-E100 rev.B1" + { 0, 0, 0, 0x1557, 0x7720}, // "OQO 01+ Ethernet" + { 0, 0, 0, 0x05ac, 0x1402}, // "Apple A1277" + // AX88178 + { 0, 0, 0, 0x0b95, 0x1780}, // "ASIX 88178 10/100/1000" + { 0, 0, 0, 0x050d, 0x5055}, // "Belkin F5D5055" + { 0, 0, 0, 0x04bb, 0x0930}, // "I/O Data ETG-US2" + { 0, 0, 0, 0x1737, 0x0039}, // "LinkSys 1000" + { 0, 0, 0, 0x14ea, 0xab11}, // "Planex GU-1000T" + { 0, 0, 0, 0x0df6, 0x061c} // "Sitecom LN-028" +}; + ASIXDevice * create_asix_device(usb_device device) { @@ -203,7 +235,8 @@ &usb_asix_device_removed }; - gUSBModule->register_driver(DRIVER_NAME, 0, 0, NULL); + gUSBModule->register_driver(DRIVER_NAME, gSupportedDevices, + sizeof(gSupportedDevices)/sizeof(usb_support_descriptor), NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp 2010-06-14 21:33:11 UTC (rev 37134) +++ haiku/trunk/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp 2010-06-14 21:43:29 UTC (rev 37135) @@ -34,6 +34,17 @@ char *gDeviceNames[MAX_DEVICES + 1]; usb_module_info *gUSBModule = NULL; +usb_support_descriptor gSupportedDevices[] = { + { 0, 0, 0, 0x0fe6, 0x8101}, // "Sunrising JP108" + { 0, 0, 0, 0x07aa, 0x9601}, // "Corega FEther USB-TXC" + { 0, 0, 0, 0x0a46, 0x9601}, // "Davicom USB-100" + { 0, 0, 0, 0x0a46, 0x6688}, // "ZT6688 USB NIC" + { 0, 0, 0, 0x0a46, 0x0268}, // "ShanTou ST268 USB NIC" + { 0, 0, 0, 0x0a46, 0x8515}, // "ADMtek ADM8515 USB NIC" + { 0, 0, 0, 0x0a47, 0x9601}, // "Hirose USB-100" + { 0, 0, 0, 0x0a46, 0x9000} // "DM9000E" +}; + mutex gDriverLock; // auto-release helper class class DriverSmartLock { @@ -42,7 +53,6 @@ ~DriverSmartLock() { mutex_unlock(&gDriverLock); } }; - DavicomDevice * create_davicom_device(usb_device device) { @@ -184,7 +194,8 @@ &usb_davicom_device_removed }; - gUSBModule->register_driver(DRIVER_NAME, 0, 0, NULL); + gUSBModule->register_driver(DRIVER_NAME, gSupportedDevices, + sizeof(gSupportedDevices)/sizeof(usb_support_descriptor), NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; }