有实际的usb通讯协议吗?

我们大多数人从不考虑我们的USB设备,我们只是把它们插进去,然后忘记它们。但是,如果你是一个好奇的类型谁想知道更多的USB如何工作?今天的超级用户问答帖子回答了一位好奇的读者的问题。...

有实际的u**通讯协议吗?

我们大多数人从不考虑我们的USB设备,我们只是把它们**去,然后忘记它们。但是,如果你是一个好奇的类型谁想知道更多的USB如何工作?今天的超级用户问答帖子回答了一位好奇的读者的问题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

图片由埃维尔卡·科瓦尔斯基(Flickr)提供。

问题

超级用户读者**eeb想知道是否真的有USB通信协议:

According to Wikipedia, USB:

  • Defines the cables, connectors, and communicati*** protocols used in a bus for connection, communication, and power supply between computers and electronic devices.

But is there an actual USB Communication Protocol? My understanding is that:

  1. You connect a USB device to a machine (Ubuntu or any kind of Linux for example).
  2. Linux finds the device driver for that device somehow (bonus if you know!) and loads it.
  3. The device is now connected under /dev/theDevice.
  4. User space apps can now read and write to /dev/theDevice and the driver handles the low-level input and output to the underlying device/hardware.

As far as I can tell, a USB Communication Protocol does not appear anywhere in this flow. If my understanding is correct, the USB is just the cable and electrical connection between the PC and the device.

Am I wrong here? Does USB actually implement some kind of low-level protocol that underscores the flow above? If so, what is it and how does it work at a 30,000 foot view?

有实际的USB通讯协议吗?

答案

超级用户贡献者RedGrittyBrick和projectdp为我们提供了答案。首先,红砖:

Yes (see USB protocols).

As I understand it, the USB spec defines a complex set of layered protocols and device profiles.

For example, USB devices can conform to high-level templates like mass-storage, keyboard, human interface device, etc. and be managed by a generic device driver. Some USB devices can communicate at a lower level such that the operating system’s low level USB support can recognize that device-specific higher level drivers are needed.

接着是projectdp的回答:

Question

Is there a low-level USB communication protocol in action and what is it?

Answer

Yes, there is. The USB specification includes the USB protocol which defines the way the bus is used on a bit level. This would be the low-level protocol that underlies the higher level protocols (i.e. mass-storage, HID, etc.).

For specifics on how the USB protocol works, this OSDev wiki is helpful. Here is another interesting description using sequence diagrams to describe the various data transacti*** per the USB protocol.

Bonus Question

How does Linux find and load the device driver for that device?

Bonus Answer

On Linux when using a USB-enabled kernel, a working USB device will be detected via the hardware and kernel due to the USB specification. On the hardware side, the detection is done by the USB Host Controller. Then in the kernel the Host Controller Driver takes over and translates the low-level bits on the wire to USB protocol formatted information. This information then gets populated in the u**core driver in the kernel.

I paraphrased from this excellent Opensourceforu article, which has much more detail and clarity about your question in the Linux context.

请务必通过下面共享的线程链接查看其余的生动讨论!


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-11 01:11
  • 阅读 ( 219 )
  • 分类:互联网

你可能感兴趣的文章

今天你应该戒掉10个浪费时间的习惯

... 根据大卫·卡达维的说法,大多数成功人士实际上并不铺床。 ...

  • 发布于 2021-03-16 03:27
  • 阅读 ( 183 )

使用以下10个工具从iso创建一个可引导usb

...低估其他USB到ISO工具。烧录时间的范围变化不大,因此它实际上可以归结为您需要的特性和在特定实用程序中找到的特性。 ...

  • 发布于 2021-03-23 17:58
  • 阅读 ( 240 )

什么是火线电缆,你真的需要吗?

...接器。 不过,命名方案是准确的,因为它代表了电缆的实际速度:400 Mbps与800 Mbps。相比之下,USB2.0是480Mbps,USB3.0完全超过了它的5Gbps。 给你自己买个狗 不幸的是,现在你会发现你需要一个fireware-to-2018适配器就像你需要实际的...

  • 发布于 2021-04-04 03:11
  • 阅读 ( 129 )

不要惊慌,但是所有的usb设备都有一个巨大的安全问题

...上,当您将设备连接到计算机时,设备上的固件允许设备实际运行。例如,一个典型的USB闪存驱动器固件将管理文件的来回传输。USB键盘的固件将键盘上的物理按键转换为通过USB连接发送到计算机的数字按键数据。 这个固件本...

  • 发布于 2021-04-07 17:01
  • 阅读 ( 149 )

usb type-c解释:什么是usb-c,为什么你会想要它

...备一起使用。 虽然USB-C的规范最早是在2014年发布的,但实际上这项技术只是在去年才流行起来。它现在正在形成一个真正的替代品,不仅是旧的USB标准,而且是其他标准,如Thunderbolt和DisplayPort。测试甚至在工程中提供一个新的U...

  • 发布于 2021-04-08 05:57
  • 阅读 ( 160 )

android usb连接说明:mtp、ptp和usb大容量存储

...系统——Windows不需要理解文件系统,只有Android需要。 实际上,MTP的功能很像USB大容量存储。例如,MTP设备显示在Windows资源管理器中,以便您可以浏览和传输文件。Linux还通过libmtp支持MTP设备,libmtp通常包含在流行的桌面Linux发...

  • 发布于 2021-04-11 08:16
  • 阅读 ( 299 )

USB2.0与USB3.0:你应该升级你的闪存驱动器吗?

...需要考虑的问题。谁不希望他们的USB驱动器快十倍呢? 实际上,这个标准只是定义了通过USB端口的最大数据传输速率。设备将有其他瓶颈。例如,USB驱动器将受到闪存速度的限制。 如果你不确定是否有USB3.0端口,只需看看USB端...

  • 发布于 2021-04-11 12:33
  • 阅读 ( 156 )

sandisk的8tb外部ssd原型是有史以来最大的

在消费电子展上,在微型闪存驱动器中存储大量存储实际上是一个传统,SanDisk再次推出了一款新的8TB便携式固态硬盘的原型,这是迄今为止最大的外部固态硬盘。不过,尽管存储容量巨大,8TB硬盘还是相对较小的——它可以很...

  • 发布于 2021-04-20 11:12
  • 阅读 ( 106 )

你不知道usb-c规格兔子洞有多深

...须处理糟糕得令人恼火的电缆和集线器,并试图理解各种协议(如Thunderbolt、HDMI和DisplayPort)的复杂混合体,这些协议理论上也适用于这一根电缆(加上它目前所需的所有加密狗)。 但朋友们,我甚至还没有接近触及...

  • 发布于 2021-05-08 15:24
  • 阅读 ( 143 )

节目说明:今天在随机fcc戏剧!

...备这篇文章,当我们录制Vergecast的时候,我必须做。。。实际的演出记录。你喜欢早一点还是晚一点?请在评论中告诉我。不管怎样,继续。。。显示。。。笔记。 大书 今晚或周末花点时间阅读本·波普在Koko上的文章,Koko是...

  • 发布于 2021-05-10 04:14
  • 阅读 ( 145 )
Deng57812
Deng57812

0 篇文章

相关推荐