【问题标题】:How does xhci_urb_enqueue() know which endpoint to send the control request to in Linux USB stack?xhci_urb_enqueue() 如何知道在 Linux USB 堆栈中将控制请求发送到哪个端点?
【发布时间】:2019-01-15 05:45:42
【问题描述】:

我试图了解xhci_urb_enqueue() 如何确定转发控制请求的端点地址。从代码中它调用ep_index = xhci_get_endpoint_index(&urb->ep->desc) 来获取最终使用epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK 来确定端点地址的ep_index。

我的理解是,获取device/configuration/interface /endpoint descriptors 的控制请求仅由 ep0 回答,并且在主机向设备发出Set_Address/Set_configuration 之后,从那时起,所有控制请求都应发送到端点中提到的实际端点地址描述符。

我的问题是:

  1. USB 设备是否应该在收到 Set_configuration 请求后启动端点?

  2. 在上述设置阶段如何以及何时设置epd->bEndpointAddress

【问题讨论】:

    标签: linux-kernel usb libusb usb-drive


    【解决方案1】:

    我发现ep_index 会根据从描述符中读取的设备驱动程序/XHCI 进行更改。在设置阶段,只有控制请求被传递给 USB 设备,所以 ep_index 始终为 0 (urb_pipetype(urb) == PIPE_CONTROL),这是基于 USB 协议设计的。设置阶段完成后,ep_index 始终为批量/int 传输请求 (urb_pipetype(urb) == PIPE_BULK | PIPE_INTERRUPT 返回正确的端点索引。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-13
      • 2012-02-07
      • 2017-01-12
      • 1970-01-01
      相关资源
      最近更新 更多