一:前言 繼UHCI的驅(qū)動(dòng)之后,,我們對(duì)USB Control的運(yùn)作有了一定的了解,。在接下來的分析中,我們對(duì)USB設(shè)備的驅(qū)動(dòng)做一個(gè)全面的分析,,我們先從HUB的驅(qū)動(dòng)說起,。關(guān)于HUB,usb2.0 spec上有詳細(xì)的定義,基于這部份的代碼位于linux-2.6.25/drivers/usb/core下,,也就是說,,這部份代碼是位于core下,和具體設(shè)備是無關(guān)的,,因?yàn)楦鲝S商的hub都是按照spec的要求來設(shè)計(jì)的,。 二:UHCI驅(qū)動(dòng)中的root hub 記得在分析UHCI驅(qū)動(dòng)的時(shí)候,曾詳細(xì)分析過root hub的初始化操作,。為了分析方便,,將代碼片段列出如下: usb_add_hcd() à usb_alloc_dev(): struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1) { …… …… //usb_device,內(nèi)嵌有struct device結(jié)構(gòu),對(duì)這個(gè)結(jié)構(gòu)進(jìn)行初始化 device_initialize(&dev->dev),; dev->dev.bus = &usb_bus_type; dev->dev.type = &usb_device_type; …… …… } 一看到前面對(duì)dev的賦值,,根據(jù)我們對(duì)設(shè)備模型的理解,一旦這個(gè)device進(jìn)行注冊(cè),,就會(huì)發(fā)生driver和device的匹配過程了,。 不過,現(xiàn)在還不是分析這個(gè)過程的時(shí)候,,我們先來看一下,,USB子系統(tǒng)中的兩種驅(qū)動(dòng)。 三:USB子系統(tǒng)中的兩種驅(qū)動(dòng) linux-2.6.25/drivers/usb/core/driver.c中,,我們可以找到兩種register driver的方式,,分別為usb_register_driver()和usb_register_device_driver()。分別來分析一下這兩個(gè)接口,。 usb_register_device_driver()接口的代碼如下: int usb_register_device_driver(struct usb_device_driver *new_udriver, struct module *owner) { int retval = 0; if (usb_disabled()) return -ENODEV; new_udriver->drvwrap.for_devices = 1; new_udriver->drvwrap.driver.name = (char *) new_udriver->name; new_udriver->drvwrap.driver.bus = &usb_bus_type; new_udriver->drvwrap.driver.probe = usb_probe_device; new_udriver->drvwrap.driver.remove = usb_unbind_device; new_udriver->drvwrap.driver.owner = owner; retval = driver_register(&new_udriver->drvwrap.driver),; if (!retval) { pr_info("%s: registered new device driver %s\n", usbcore_name, new_udriver->name),; usbfs_update_special(),; } else { printk(KERN_ERR "%s: error %d registering device " " driver %s\n", usbcore_name, retval, new_udriver->name); } return retval; } 首先,,通過usb_disabled()來判斷一下usb是否被禁用,如果被禁用,,當(dāng)然就不必執(zhí)行下面的流程了,,直接退出即可。 從上面的代碼,很明顯可以看到,, struct usb_device_driver 對(duì)struct device_driver進(jìn)行了一次封裝,,我們注意一下這里的賦值操作:new_udriver->drvwrap.for_devices = 1.等等。這些在后面都是用派上用場(chǎng)的,。 usb_register_driver()的代碼如下: int usb_register_driver(struct usb_driver *new_driver, struct module *owner, const char *mod_name) { int retval = 0; if (usb_disabled()) return -ENODEV; new_driver->drvwrap.for_devices = 0; new_driver->drvwrap.driver.name = (char *) new_driver->name; new_driver->drvwrap.driver.bus = &usb_bus_type; new_driver->drvwrap.driver.probe = usb_probe_interface; new_driver->drvwrap.driver.remove = usb_unbind_interface; new_driver->drvwrap.driver.owner = owner; new_driver->drvwrap.driver.mod_name = mod_name; spin_lock_init(&new_driver->dynids.lock),; INIT_LIST_HEAD(&new_driver->dynids.list); retval = driver_register(&new_driver->drvwrap.driver),; if (,!retval) { pr_info("%s: registered new interface driver %s\n", usbcore_name, new_driver->name); usbfs_update_special(),; usb_create_newid_file(new_driver),; } else { printk(KERN_ERR "%s: error %d registering interface " " driver %s\n", usbcore_name, retval, new_driver->name); } return retval; } 很明顯,,在這里接口里,,將new_driver->drvwrap.for_devices設(shè)為了0.而且兩個(gè)接口的porbe()函數(shù)也不一樣。 其實(shí),,對(duì)于usb_register_driver()可以看作是usb設(shè)備中的接口驅(qū)動(dòng),,而usb_register_device_driver()是一個(gè)單純的USB設(shè)備驅(qū)動(dòng)。 四: hub的驅(qū)動(dòng)分析 4.1: usb_bus_type->match()的匹配過程 usb_bus_type->match()用來判斷驅(qū)動(dòng)和設(shè)備是否匹配,,它的代碼如下: static int usb_device_match(struct device *dev, struct device_driver *drv) { /* devices and interfaces are handled separately */ //usb device的情況 if (is_usb_device(dev)) { /* interface drivers never match devices */ if (,!is_usb_device_driver(drv)) return 0; /* TODO: Add real matching code */ return 1; } //interface的情況 else { struct usb_interface *intf; struct usb_driver *usb_drv; const struct usb_device_id *id; /* device drivers never match interfaces */ if (is_usb_device_driver(drv)) return 0; intf = to_usb_interface(dev); usb_drv = to_usb_driver(drv),; id = usb_match_id(intf, usb_drv->id_table),; if (id) return 1; id = usb_match_dynamic_id(intf, usb_drv); if (id) return 1; } return 0; } 這里的match會(huì)區(qū)分上面所說的兩種驅(qū)動(dòng),,即設(shè)備的驅(qū)動(dòng)和接口的驅(qū)動(dòng),。 is_usb_device()的代碼如下: static inline int is_usb_device(const struct device *dev) { return dev->type == &usb_device_type; } 很明顯,對(duì)于root hub來說,,這個(gè)判斷是肯定會(huì)滿足的,。 static inline int is_usb_device_driver(struct device_driver *drv) { return container_of(drv, struct usbdrv_wrap, driver)-> for_devices; } 回憶一下,我們?cè)诜治鰑sb_register_device_driver()的時(shí)候,,不是將new_udriver->drvwrap.for_devices置為了1么,?所以對(duì)于usb_register_device_driver()注冊(cè)的驅(qū)動(dòng)來說,這里也是會(huì)滿足的,。 因此,,對(duì)應(yīng)root hub的情況,從第一個(gè)if就會(huì)匹配到usb_register_device_driver()注冊(cè)的驅(qū)動(dòng),。 對(duì)于接口的驅(qū)動(dòng),,我們等遇到的時(shí)候再來進(jìn)行分析。 4.2:root hub的驅(qū)動(dòng)入口 既然我們知道,root hub會(huì)匹配到usb_bus_type->match()的驅(qū)動(dòng),,那這個(gè)驅(qū)動(dòng)到底是什么呢,?我們從usb子系統(tǒng)的初始化開始說起。 在linux-2.6.25/drivers/usb/core/usb.c中,。有這樣的一段代碼: subsys_initcall(usb_init),; 對(duì)于subsys_initcall()我們已經(jīng)不陌生了,在很多地方都會(huì)遇到它,。在系統(tǒng)初始化的時(shí)候,,會(huì)調(diào)用到它對(duì)應(yīng)的函數(shù)。在這里,,即為usb_init(),。 在usb_init()中,有這樣的代碼片段: static int __init usb_init(void) { …… …… 1 if (,!retval) goto out; …… } 在這里終于看到usb_register_device_driver()了,。 usb_generic_driver會(huì)匹配到所有usb 設(shè)備。定義如下: struct usb_device_driver usb_generic_driver = { .name = "usb", .probe = generic_probe, .disconnect = generic_disconnect, #ifdef CONFIG_PM .suspend = generic_suspend, .resume = generic_resume, #endif .supports_autosuspend = 1, }; 現(xiàn)在是到分析probe()的時(shí)候了,。我們這里說的并不是usb_generic_driver中的probe,而是封裝在struct usb_device_driver中的driver對(duì)應(yīng)的probe函數(shù),。 在上面的分析, usb_register_device_driver()將封裝的driver的probe()函數(shù)設(shè)置為了usb_probe_device(),。代碼如下: static int usb_probe_device(struct device *dev) { struct usb_device_driver *udriver = to_usb_device_driver(dev->driver),; struct usb_device *udev; int error = -ENODEV; dev_dbg(dev, "%s\n", __FUNCTION__); //再次判斷dev是否是usb device if (,!is_usb_device(dev)) /* Sanity check */ return error; udev = to_usb_device(dev),; /* TODO: Add real matching code */ /* The device should always appear to be in use * unless the driver suports autosuspend. */ //pm_usage_cnt: autosuspend計(jì)數(shù)。如果此計(jì)數(shù)為1,則不允許autosuspend udev->pm_usage_cnt = !(udriver->supports_autosuspend),; error = udriver->probe(udev),; return error; } 首先,可以通過container_of()將封裝的struct device, struct device_driver轉(zhuǎn)換為struct usb_device和struct usb_device_driver. 然后,,再執(zhí)行一次安全檢查,,判斷dev是否是屬于一個(gè)usb device. 在這里,我們首次接觸到了hub suspend.如果不支持suspend(udriver->supports_autosuspend為0),,則udev->pm_usage_cnt被設(shè)為1,也就是說,,它不允許設(shè)備suspend.否則,將其初始化為0. 最后,,正如你所看到的,,流程轉(zhuǎn)入到了usb_device_driver->probe()。 對(duì)應(yīng)到root hub,流程會(huì)轉(zhuǎn)入到generic_probe(),。代碼如下: static int generic_probe(struct usb_device *udev) { int err, c; /* put device-specific files into sysfs */ usb_create_sysfs_dev_files(udev),; /* Choose and set the configuration. This registers the interfaces * with the driver core and lets interface drivers bind to them. */ if (udev->authorized == 0) dev_err(&udev->dev, "Device is not authorized for usage\n"),; else { //選擇和設(shè)定一個(gè)配置 c = usb_choose_configuration(udev),; if (c >= 0) { err = usb_set_configuration(udev, c),; if (err) { dev_err(&udev->dev, "can't set config #%d, error %d\n", c, err); /* This need not be fatal. The user can try to * set other configurations. */ } } } /* USB device state == configured … usable */ usb_notify_add_device(udev),; return 0; } usb_create_sysfs_dev_files()是在sysfs中顯示幾個(gè)屬性文件,,不進(jìn)行詳細(xì)分析,有興趣的可以結(jié)合之前分析的《linux設(shè)備模型詳解》來看下代碼,。 usb_notify_add_device()是有關(guān)notify鏈表的操作,,這里也不做詳細(xì)分析。 至于udev->authorized,在root hub的初始化中,,是會(huì)將其初始化為1的,。后面的邏輯就更簡(jiǎn)單了。為root hub 選擇一個(gè)配置然后再設(shè)定這個(gè)配置,。 還記得我們?cè)诜治鰎oot hub的時(shí)候,,在usb_new_device()中,會(huì)將設(shè)備的所有配置都取出來,,然后將它們放到了usb_device-> config.現(xiàn)在這些信息終于會(huì)派上用場(chǎng)了,。不太熟悉的,可以看下本站之前有關(guān)usb控制器驅(qū)動(dòng)的文檔,。 Usb2.0 spec上規(guī)定,,對(duì)于hub設(shè)備,只能有一個(gè)config,一個(gè)interface,一個(gè)endpoint.實(shí)際上,,在這里,,對(duì)hub的選擇約束不大,反正就一個(gè)配置,,不管怎么樣,,選擇和設(shè)定都是這個(gè)配置。 不過,,為了方便以后的分析,,我們還是跟進(jìn)去看下usb_choose_configuration()和usb_set_configuration()的實(shí)現(xiàn)。 實(shí)際上,,經(jīng)過這兩個(gè)函數(shù)之后,,設(shè)備的probe()過程也就會(huì)結(jié)束了。 4.2.1:usb_choose_configuration()函數(shù)分析 usb_choose_configuration()的代碼如下: //為usb device選擇一個(gè)合適的配置 int usb_choose_configuration(struct usb_device *udev) { int i; int num_configs; int insufficient_power = 0; struct usb_host_config *c, *best; best = NULL; //config數(shù)組 c = udev->config; //config項(xiàng)數(shù) num_configs = udev->descriptor.bNumConfigurations; //遍歷所有配置項(xiàng) for (i = 0; i < num_configs; (i++, c++)) { struct usb_interface_descriptor *desc = NULL; /* It's possible that a config has no interfaces! */ //配置項(xiàng)的接口數(shù)目 //取配置項(xiàng)的第一個(gè)接口 if (c->desc.bNumInterfaces > 0) desc = &c->intf_cache[0]->altsetting->desc; /* * HP's USB bus-powered keyboard has only one configuration * and it claims to be self-powered; other devices may have * similar errors in their descriptors. If the next test * were allowed to execute, such configurations would always * be rejected and the devices would not work as expected. * In the meantime, we run the risk of selecting a config * that requires external power at a time when that power * isn't available. It seems to be the lesser of two evils. * * Bugzilla #6448 reports a device that appears to crash * when it receives a GET_DEVICE_STATUS request! We don't * have any other way to tell whether a device is self-powered, * but since we don't use that information anywhere but here, * the call has been removed. * * Maybe the GET_DEVICE_STATUS call and the test below can * be reinstated when device firmwares become more reliable. * Don't hold your breath. */ #if 0 /* Rule out self-powered configs for a bus-powered device */ if (bus_powered && (c->desc.bmAttributes & USB_CONFIG_ATT_SELFPOWER)) continue; #endif /* * The next test may not be as effective as it should be. * Some hubs have errors in their descriptor, claiming * to be self-powered when they are really bus-powered. * We will overestimate the amount of current such hubs * make available for each port. * * This is a fairly benign sort of failure. It won't * cause us to reject configurations that we should have * accepted. */ /* Rule out configs that draw too much bus current */ //電源不足,。配置描述符中的電力是所需電力的1/2 if (c->desc.bMaxPower * 2 > udev->bus_mA) { insufficient_power++; continue; } /* When the first config's first interface is one of Microsoft's * pet nonstandard Ethernet-over-USB protocols, ignore it unless * this kernel has enabled the necessary host side driver. */ if (i == 0 && desc && (is_rndis(desc) || is_activesync(desc))) { #if !defined(CONFIG_USB_NET_RNDIS_HOST) && !defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) continue; #else best = c; #endif } /* From the remaining configs, choose the first one whose * first interface is for a non-vendor-specific class. * Reason: Linux is more likely to have a class driver * than a vendor-specific driver. */ //選擇一個(gè)不是USB_CLASS_VENDOR_SPEC的配置 else if (udev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC && (,!desc || desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC)) { best = c; break; } /* If all the remaining configs are vendor-specific, * choose the first one. */ else if (!best) best = c; } if (insufficient_power > 0) dev_info(&udev->dev, "rejected %d configuration%s " "due to insufficient available bus power\n", insufficient_power, plural(insufficient_power)),; //如果選擇好了配置,,返回配置的序號(hào),,否則,返回-1 if (best) { i = best->desc.bConfigurationValue; dev_info(&udev->dev, "configuration #%d chosen from %d choice%s\n", i, num_configs, plural(num_configs)),; } else { i = -1; dev_warn(&udev->dev, "no configuration chosen from %d choice%s\n", num_configs, plural(num_configs)),; } return i; } Linux按照自己的喜好選擇好了配置之后,,返回配置的序號(hào),。不過對(duì)于HUB來說,,它有且僅有一個(gè)配置。 4.2.2:usb_set_configuration()函數(shù)分析 既然已經(jīng)選好配置了,,那就告訴設(shè)備選好的配置,,這個(gè)過程是在usb_set_configuration()中完成的。它的代碼如下: int usb_set_configuration(struct usb_device *dev, int configuration) { int i, ret; struct usb_host_config *cp = NULL; struct usb_interface **new_interfaces = NULL; int n, nintf; if (dev->authorized == 0 || configuration == -1) configuration = 0; else { for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { if (dev->config[i].desc.bConfigurationValue == configuration) { cp = &dev->config[i]; break; } } } if ((,!cp && configuration != 0)) return -EINVAL; /* The USB spec says configuration 0 means unconfigured. * But if a device includes a configuration numbered 0, * we will accept it as a correctly configured state. * Use -1 if you really want to unconfigure the device. */ if (cp && configuration == 0) dev_warn(&dev->dev, "config 0 descriptor??\n"),; 首先,根據(jù)選擇好的配置號(hào)找到相應(yīng)的配置,,在這里要注意了,, dev->config[]數(shù)組中的配置并不是按照配置的序號(hào)來存放的,,而是按照遍歷到順序來排序的。因?yàn)橛行┰O(shè)備在發(fā)送配置描述符的時(shí)候,,并不是按照配置序號(hào)來發(fā)送的,,例如,配置2可能在第一次GET_CONFIGURATION就被發(fā)送了,,而配置1可能是在第二次GET_CONFIGURATION才能發(fā)送,。 取得配置描述信息之后,要對(duì)它進(jìn)行有效性判斷,,注意一下本段代碼的最后幾行代碼:usb2.0 spec上規(guī)定,,0號(hào)配置是無效配置,但是可能有些廠商的設(shè)備并末按照這一約定,,所以在linux中,,遇到這種情況只是打印出警告信息,然后嘗試使用這一配置,。 /* Allocate memory for new interfaces before doing anything else, * so that if we run out then nothing will have changed. */ n = nintf = 0; if (cp) { //接口總數(shù) nintf = cp->desc.bNumInterfaces; //interface指針數(shù)組, new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),, GFP_KERNEL),; if (!new_interfaces) { dev_err(&dev->dev, "Out of memory\n"),; return -ENOMEM; } for (,; n < nintf; ++n) { new_interfaces[n] = kzalloc( sizeof(struct usb_interface), GFP_KERNEL),; if (,!new_interfaces[n]) { dev_err(&dev->dev, "Out of memory\n"); ret = -ENOMEM; free_interfaces: while (--n >= 0) kfree(new_interfaces[n]),; kfree(new_interfaces),; return ret; } } //如果總電源小于所需電流,打印警告信息 i = dev->bus_mA - cp->desc.bMaxPower * 2; if (i < 0) dev_warn(&dev->dev, "new config #%d exceeds power " "limit by %dmA\n", configuration, -i),; } 在這里,,注要是為new_interfaces分配空間,要這意的是,, new_interfaces是一個(gè)二級(jí)指針,,它的最終指向是struct usb_interface結(jié)構(gòu)。特別的,,如果總電流數(shù)要小于配置所需電流,,則打印出警告消息。實(shí)際上,,這種情況在usb_choose_configuration()中已經(jīng)進(jìn)行了過濾,。 /* Wake up the device so we can send it the Set-Config request */ //要對(duì)設(shè)備進(jìn)行配置了,,先喚醒它 ret = usb_autoresume_device(dev); if (ret) goto free_interfaces; /* if it's already configured, clear out old state first. * getting rid of old interfaces means unbinding their drivers. */ //不是處于ADDRESS狀態(tài),,先清除設(shè)備的狀態(tài) if (dev->state != USB_STATE_ADDRESS) usb_disable_device(dev, 1),; /* Skip ep0 */ //發(fā)送控制消息,選取配置 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),, USB_REQ_SET_CONFIGURATION, 0, configuration, 0, NULL, 0, USB_CTRL_SET_TIMEOUT),; if (ret < 0) { /* All the old state is gone, so what else can we do? * The device is probably useless now anyway. */ cp = NULL; } //dev->actconfig存放的是當(dāng)前設(shè)備選取的配置 dev->actconfig = cp; if (!cp) { usb_set_device_state(dev, USB_STATE_ADDRESS),; usb_autosuspend_device(dev),; goto free_interfaces; } //將狀態(tài)設(shè)為CONFIGURED usb_set_device_state(dev, USB_STATE_CONFIGURED); 接下來,,就要對(duì)設(shè)備進(jìn)行配置了,,首先,將設(shè)備喚醒,?;貞浺幌挛覀?cè)诜治鯱HCI驅(qū)動(dòng)時(shí),列出來的設(shè)備狀態(tài)圖,。只有在ADDRESS狀態(tài)才能轉(zhuǎn)入到CONFIG狀態(tài),。(SUSPEND狀態(tài)除外)。 所以,,如果設(shè)備當(dāng)前不是處于ADDRESS狀態(tài),,就需要將設(shè)備的狀態(tài)初始化。usb_disable_device()函數(shù)是個(gè)比較重要的操作,,在接下來再對(duì)它進(jìn)行詳細(xì)分析,。 接著,發(fā)送SET_CONFIGURATION的Control消息給設(shè)備,,用來選擇配置 最后,,將dev->actconfig指向選定的配置,將設(shè)備狀態(tài)設(shè)為CONFIG /* Initialize the new interface structures and the * hc/hcd/usbcore interface/endpoint state. */ //遍歷所有的接口 for (i = 0; i < nintf; ++i) { struct usb_interface_cache *intfc; struct usb_interface *intf; struct usb_host_interface *alt; cp->interface[i] = intf = new_interfaces[i]; intfc = cp->intf_cache[i]; intf->altsetting = intfc->altsetting; intf->num_altsetting = intfc->num_altsetting; //是否關(guān)聯(lián)的接口描述符,,定義在minor usb 2.0 spec中 intf->intf_assoc = find_iad(dev, cp, i),; kref_get(&intfc->ref); //選擇0號(hào)設(shè)置 alt = usb_altnum_to_altsetting(intf, 0),; /* No altsetting 0? We'll assume the first altsetting. * We could use a GetInterface call, but if a device is * so non-compliant that it doesn't have altsetting 0 * then I wouldn't trust its reply anyway. */ //如果0號(hào)設(shè)置不存在,,選排在第一個(gè)設(shè)置 if (!alt) alt = &intf->altsetting[0]; //當(dāng)前的配置 intf->cur_altsetting = alt; usb_enable_interface(dev, intf),; intf->dev.parent = &dev->dev; intf->dev.driver = NULL; intf->dev.bus = &usb_bus_type; intf->dev.type = &usb_if_device_type; intf->dev.dma_mask = dev->dev.dma_mask; device_initialize(&intf->dev),; mark_quiesced(intf); sprintf(&intf->dev.bus_id[0], "%d-%s:%d.%d", dev->bus->busnum, dev->devpath, configuration, alt->desc.bInterfaceNumber); } kfree(new_interfaces),; if (cp->string == NULL) cp->string = usb_cache_string(dev, cp->desc.iConfiguration),; 之前初始化的new_interfaces在這里終于要派上用場(chǎng)了。初始化各接口,,從上面的初始化過程中,,我們可以看出: Intf->altsetting,表示接口的各種設(shè)置 Intf->num_altsetting:表示接口的設(shè)置數(shù)目 Intf->intf_assoc:接口的關(guān)聯(lián)接口(定義于minor usb 2.0 spec) Intf->cur_altsetting:接口的當(dāng)前設(shè)置。 結(jié)合之前在UHCI中的分析,,我們總結(jié)一下: Usb_dev->config,其實(shí)是一個(gè)數(shù)組,,存放設(shè)備的配置。usb_dev->config[m]-> interface[n]表示第m個(gè)配置的第n個(gè)接口的intercace結(jié)構(gòu),。(m,n不是配置序號(hào)和接口序號(hào) *^_^*),。 注意這個(gè)地方對(duì)intf內(nèi)嵌的struct devcie結(jié)構(gòu)賦值,它的type被賦值為了usb_if_device_type.bus還是usb_bus_type.可能你已經(jīng)反應(yīng)過來了,,要和這個(gè)device匹配的設(shè)備是interface的驅(qū)動(dòng),。 特別的,這里的device的命名: sprintf(&intf->dev.bus_id[0], "%d-%s:%d.%d", dev->bus->busnum, dev->devpath, configuration, alt->desc.bInterfaceNumber),; dev指的是這個(gè)接口所屬的usb_dev,結(jié)合我們之前在UHCI中關(guān)于usb設(shè)備命名方式的描述,。可得出它的命令方式如下: USB總線號(hào)-設(shè)備路徑:配置號(hào),。接口號(hào),。 例如,在我的虛擬機(jī)上: [root@localhost devices]# pwd /sys/bus/usb/devices [root@localhost devices]# ls 1-0:1.0 usb1 [root@localhost devices]# 可以得知,,系統(tǒng)只有一個(gè)usb control. 1-0:1.0:表示,第一個(gè)usb control下的root hub的1號(hào)配置的0號(hào)接口,。
|
|