Linux 为什么从usb 3.0端口拔下usb扬声器时U盘无法寻址?

Linux 为什么从usb 3.0端口拔下usb扬声器时U盘无法寻址?,linux,linux-kernel,linux-device-driver,embedded-linux,Linux,Linux Kernel,Linux Device Driver,Embedded Linux,我的主板有一个usb3.0端口和一个usb2.0端口。错误发生在usb3.0端口中。Linux内核版本是3.10.65 生成错误的脚本: 将USB扬声器插入usb3.0端口 在USB扬声器中连续播放音频 拔下USB扬声器,拔下时不要停止音频播放 将usb3.0磁盘插入usb3.0端口 然后USB主机控制器无法寻址U盘 系统报告以下日志: # # # # ./test.sh [ 68.036091] usb 3-1: USB disconnect, device number 2 [

我的主板有一个usb3.0端口和一个usb2.0端口。错误发生在usb3.0端口中。Linux内核版本是3.10.65

生成错误的脚本:

  • 将USB扬声器插入usb3.0端口
  • 在USB扬声器中连续播放音频
  • 拔下USB扬声器,拔下时不要停止音频播放
  • 将usb3.0磁盘插入usb3.0端口
  • 然后USB主机控制器无法寻址U盘
  • 系统报告以下日志:

    # 
    # 
    # 
    # ./test.sh 
    [   68.036091] usb 3-1: USB disconnect, device number 2
    [   68.041659] cannot submit urb (err = -19)
    [   78.860028] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [   84.070030] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [   84.280026] usb 4-1: device not accepting address 2, error -62
    [   89.460027] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [   94.670025] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [   94.880020] usb 4-1: device not accepting address 3, error -62
    [  100.060036] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [  105.270044] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [  105.480024] usb 4-1: device not accepting address 4, error -62
    [  110.660024] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [  115.870026] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for address device command
    [  116.080020] usb 4-1: device not accepting address 5, error -62
    [  116.086478] hub 4-0:1.0: unable to enumerate USB device on port 1
    
    经过长时间的调试,我发现如果我添加调试信息,错误永远不会发生。但我不知道为什么

    void usb_set_device_state(struct usb_device *udev,
            enum usb_device_state new_state)
    {
        unsigned long flags;
        int wakeup = -1;
    
        spin_lock_irqsave(&device_state_lock, flags);
        if (udev->state == USB_STATE_NOTATTACHED)
            ;   /* do nothing */
        else if (new_state != USB_STATE_NOTATTACHED) {
    
            /* root hub wakeup capabilities are managed out-of-band
             * and may involve silicon errata ... ignore them here.
             */
            if (udev->parent) {
                if (udev->state == USB_STATE_SUSPENDED
                        || new_state == USB_STATE_SUSPENDED)
                    ;   /* No change to wakeup settings */
                else if (new_state == USB_STATE_CONFIGURED)
                    wakeup = (udev->quirks &
                        USB_QUIRK_IGNORE_REMOTE_WAKEUP) ? 0 :
                        udev->actconfig->desc.bmAttributes &
                        USB_CONFIG_ATT_WAKEUP;
                else
                    wakeup = 0;
            }
            if (udev->state == USB_STATE_SUSPENDED &&
                new_state != USB_STATE_SUSPENDED)
                udev->active_duration -= jiffies;
            else if (new_state == USB_STATE_SUSPENDED &&
                    udev->state != USB_STATE_SUSPENDED)
                udev->active_duration += jiffies;
            udev->state = new_state;
        } else
            recursively_mark_NOTATTACHED(udev);
    
        if (new_state == USB_STATE_NOTATTACHED) {   
            printk("[%s %d] .\n", __func__, __LINE__);
            printk("[%s %d] .\n", __func__, __LINE__);
            printk("[%s %d] .\n", __func__, __LINE__);
        }
        spin_unlock_irqrestore(&device_state_lock, flags);
        if (wakeup >= 0)
            device_set_wakeup_capable(&udev->dev, wakeup);
    }
    
    enter code here
    

    它是否在v5.6-rc6上复制?如果没有,请升级您的系统。如果不可能,请针对您正在使用的发行版提交一份bug报告,并附上此信息。添加调试信息会隐藏竞争条件。感谢您的回复。我无法更新内核。这是一个已经开发了很长时间的产品。是的,我应该联系我的芯片供应商寻求帮助。