系列文章目次
xHCI 简朴分析
USB Root Hub 分析
USB Hub 检测装备
<hr>
<hr> 一、弁言
USB Hub 检测装备 一文中讲到,当有 USB 插入时,它会激活 hub_events 函数。
- static int hub_thread(void *__unused)
- {
-
-
- do {
-
-
- hub_events();
- wait_event_interruptible(khubd_wait,
- !list_empty(&hub_event_list) ||
- kthread_should_stop());
- try_to_freeze();
- } while (!kthread_should_stop() || !list_empty(&hub_event_list));
- pr_debug("%s: khubd exiting\n", usbcore_name);
- return 0;
- }
复制代码 二、hub_events
- static void hub_events(void)
- {
-
-
- // ...
- while (1) {
-
-
- // ...
- tmp = hub_event_list.next;
- list_del_init(tmp);
- hub = list_entry(tmp, struct usb_hub, event_list);
- // 描述 usb 设备(Hub,整体,不是接口)
- hdev = hub->hdev;
- intf = to_usb_interface(hub->intfdev);
- // hub 接口设备
- hub_dev = &intf->dev;
- // ...
- /* Lock the device, then check to see if we were
- * disconnected while waiting for the lock to succeed. */
- if (locktree(hdev) < 0) {
-
-
- // ...
- /* Autoresume */
- ret = usb_autopm_get_interface(intf);
- // ...
- /* deal with port status changes */
- for (i = 1; i <= hub->descriptor->bNbrPorts; i++) {
-
-
- // ...
- ret = hub_port_status(hub, i,
- &portstatus, &portchange);
- // ...
- if (connect_change)
- hub_port_connect_change(hub, i,
- portstatus, portchange);
- } /* end for i */
- // ...
- if (!hdev->parent && !hub
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |