Linux那些事儿 之 戏说USB(2)漫漫辛酸路

USB的一生充满了PK,并在PK中发展,1.0、1.1、2.0,漫漫辛酸路,一把辛酸泪。


这张表是从USB2.0 spec里直接拿过来的,可以看出,它的高速模式最高已经达到了480Mbps,即60MBps,这是个什么概念,也就是说,照这个速度,你将自己从网上下的小短片备份到自己的移动硬盘上不用一秒钟,而按照USB1.1最高12Mbps的速度,你需要将近1分钟。2.0比1.1的最高速度足足提高了几十倍。USB走过的这段辛酸路,对咱们来说最直观的结果也就是传输速度提高了,过程很艰辛,结果很简单,是不。

USB的各个版本是兼容的。每个USB2.0 控制器带有3个芯片,根据设备的识别方式将信号发送到正确的控制芯片。我们可以将1.1设备连接到2.0的控制器上使用,不过它只能达到1.1的速度。同时也可以将2.0的设备连接到1.1的控制器上,不过不能指望它能以2.0的速度运行。

显然,Linux对USB1.1和2.0都是支持的,通过看drivers/usb/host目录下的Kconfig文件,我们可以知道内核里支持的控制器。

config USB_EHCI_HCD
	tristate "EHCI HCD (USB 2.0) support"
	---help---
	  The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
	  "high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
	  If your USB host controller supports USB 2.0, you will likely want to
	  configure this Host Controller Driver.

	  EHCI controllers are packaged with "companion" host controllers (OHCI
	  or UHCI) to handle USB 1.1 devices connected to root hub ports.  Ports
	  will connect to EHCI if the device is high speed, otherwise they
	  connect to a companion controller.  If you configure EHCI, you should
	  probably configure the OHCI (for NEC and some other vendors) USB Host
	  Controller Driver or UHCI (for Via motherboards) Host Controller
	  Driver too.

	  You may want to read <file:Documentation/usb/ehci.txt>.

	  To compile this driver as a module, choose M here: the
	  module will be called ehci-hcd.

这里使用的都是3.18.2 版本内核的。所有与USB相关的代码都在drivers/usb目录下面。上面的Kconfig文件说的很清楚,ehci-hcd模块支持的是USB2.0控制器的高速模式,它本身并不支持全速或低速模式,对连接上的USB1.1设备的支持,是通过ohci-hcd或uhci-hcd模块。如果我们只配置了EHCI,就不能使用usb的鼠标键盘。有时碰到usb键盘或鼠标不能用的情况,很可能就是因为配置EHCI的同时没有配置OHCI或UHCI。

config USB_OHCI_HCD
	tristate "OHCI HCD (USB 1.1) support"
	---help---
	  The Open Host Controller Interface (OHCI) is a standard for accessing
	  USB 1.1 host controller hardware.  It does more in hardware than Intel's
	  UHCI specification.  If your USB host controller follows the OHCI spec,
	  say Y.  On most non-x86 systems, and on x86 hardware that's not using a
	  USB controller from Intel or VIA, this is appropriate.  If your host
	  controller doesn't use PCI, this is probably appropriate.  For a PCI
	  based system where you're not sure, the "lspci -v" entry will list the
	  right "prog-if" for your USB controller(s):  EHCI, OHCI, or UHCI.

	  To compile this driver as a module, choose M here: the
	  module will be called ohci-hcd.

config USB_UHCI_HCD
	tristate "UHCI HCD (most Intel and VIA) support"
	depends on PCI || USB_UHCI_SUPPORT_NON_PCI_HC
	---help---
	  The Universal Host Controller Interface is a standard by Intel for
	  accessing the USB hardware in the PC (which is also called the USB
	  host controller). If your USB host controller conforms to this
	  standard, you may want to say Y, but see below. All recent boards
	  with Intel PCI chipsets (like intel 430TX, 440FX, 440LX, 440BX,
	  i810, i820) conform to this standard. Also all VIA PCI chipsets
	  (like VIA VP2, VP3, MVP3, Apollo Pro, Apollo Pro II or Apollo Pro
	  133) and LEON/GRLIB SoCs with the GRUSBHC controller.
	  If unsure, say Y.

	  To compile this driver as a module, choose M here: the
	  module will be called uhci-hcd.

OHCI和UHCI虽然支持的都是1.1的控制器,但是支持的硬件范围不一样,如果你在编译内核,直接选上它们就是了。

USB既然能一路PK走过来,也算是一个挺能秀的角色了,不然也不会有那么多的拥护者。既然这里说的就是USB,也挑一些大家可能感兴趣的帮它秀一下。USB为所有的USB外设都提供了单一的的标准的连接类型,这就简化了外设的设计,也让我们不用再去想哪个设备对应哪个插槽的问题,就象种萝卜,一个萝卜一个坑,但是哪个萝卜种到哪个坑里我们是不用想的吧。

USB支持热插拔,其它的如SCSI设备等必须在关掉主机的情况下才能增加或移走外围设备。所以说,USB的一生不仅仅是PK的一生,也是丰富多彩的一生,不用实行一夫一妻制,可以不用关机就能更换不同种类的外设。

USB在设备供电方面提供了灵活性。USB外设可以通过USB电缆供电,不然咱们的移动硬盘、ipod什么的也用不了了。

USB能够支持从几十k到几十m的传输速率,来适应不同种类的外设,这点前面那张表说得很详细了。它可以支持多个设备同时操作,也支持多功能的设备。多功能的设备当然指的就是一个设备同时有多个功能,大白话,比如USB扬声器。这通过在一个设备里包含多个接口来支持,一个接口支持一个功能,这是后话了。

USB可以支持多达127个设备,很多吧,不过比起皇帝的后宫佳丽三千来说还不是一个数量级的。

USB可以保证固定的带宽,这个对视频音频设备是利好。

USB spec上还有很多可以秀的,就不多说了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值