Linux USB驱动

一、Linux USB框图

主要就分为俩大块:

        1、USB subsystem

        2、USB Driver     ————   驱动开发人员大多在这一块工作

二、Linux USB框图中各个部件的解释

USB Device

This is just a normal USB device like Pendrive, Mice, Keyboards, USB to Serial converter, USB MP3 Player, etc.

USB Host Controller

The USB host controller is used to control the communications between the host system and USB devices. This USB host controller contains both hardware and software parts.

Hardware:

This hardware part is used for the below operations.

  • Detecting the connected and disconnected USB devices.
  • Providing power to the connected USB devices.
  • and so on.

Software:

The software part is also called as a USB host controller driver. This will be used to loading the correct USB device drivers, and managing the data transfer between the driver and USB host controller.

So this USB host controller is doing the initial transaction once the USB device is detected in the system. Here Initial transaction means, get the devices vendor id, get the devices product id, device type, etc. Once that is done, then the USB host controller driver will assign the appropriate USB device driver to the device.

There are multiple USB host controller interfaces are available.

  • Open Host Controller Interface (OHCI) – USB 1.X. eg: USB 1.1
  • Universal Host Controller Interface (UHCI) – USB 1.X.
  • Enhanced Host Controller Interface (EHCI) – USB 2.0.
  • Extended Host Controller Interface (XHCI) – USB 3.0.

USB core

USB core is a codebase consisting of routines and structures available to HCDs (Host Controller Driver) and USB drivers.

USB Driver

This is the USB driver which we are going to write for the USB devices.

三、USB描述符

Till now, we have some ideas about the USB and its subsystem in Linux. Now Let’s discuss the USB device. The USB device contains a number of descriptors that help to define what the device is capable of. We will discuss about the below descriptors.

  • Device descriptor
  • Configuration descriptor
  • Interface descriptor
  • Endpoint descriptor

Device descriptor

USB devices can only have one device descriptor. The device descriptor includes information such as what USB revision the device complies with, the Product and Vendor IDs used to load the appropriate drivers, and the number of possible configuration descriptors the device can have.

Configuration descriptor

The configuration descriptor specifies values such as the amount of power this particular configuration uses if the device is self or bus-powered and the number of interfaces it has.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

denglin12315

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值