usb通信 协议_是否有实际的USB通信协议?

usb通信 协议_是否有实际的USB通信协议?

usb通信 协议

usb通信 协议_是否有实际的USB通信协议?

Most of us never give much thought to our USB devices, we just plug them in and forget about them. But what if you are the curious type who wants to know more about how USB works? Today’s SuperUser Q&A post has the answers to a curious reader’s questions.

我们大多数人从不对USB设备进行过多的思考,只需要插入USB设备就可以了。 但是,如果您是一个好奇的人,想更多地了解USB的工作原理,该怎么办? 今天的“超级用户问答”帖子回答了好奇的读者的问题。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

Photo courtesy of Evilelka Kowalski (Flickr).

图片由Evilelka Kowalski(Flickr)提供

问题 (The Question)

SuperUser reader smeeb wants to know if there really is an actual USB Communication Protocol:

超级用户阅读器smeeb想知道是否真的存在一个USB通信协议:

According to Wikipedia, USB:

根据*, USB

  • Defines the cables, connectors, and communications 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:

但是,是否有实际的USB通信协议? 我的理解是:

  1. You connect a USB device to a machine (Ubuntu or any kind of Linux for example).

    您将USB设备连接到计算机(例如,Ubuntu或任何类型Linux)。
  2. Linux finds the device driver for that device somehow (bonus if you know!) and loads it.

    Linux会以某种方式找到该设备的设备驱动程序(如果知道的话,会加分! )并加载它。

  3. The device is now connected under /dev/theDevice.

    现在,该设备已在/ 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.

    用户空间应用程序现在可以读取和写入/ dev / theDevice ,并且驱动程序可以处理底层输入和输出到底层设备/硬件。

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.

据我所知, USB通信协议没有出现在该流程的任何地方。 如果我的理解是正确的,则USB只是PC和设备之间的电缆和电气连接。

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是否真的实现了强调上述流程的某种低级协议? 如果是这样,它是什么?在30,000英尺的视线下它如何工作?

Is there an actual USB Communication Protocol?

是否有实际的USB通信协议?

答案 (The Answer)

SuperUser contributors RedGrittyBrick and projectdp have the answer for us. First up, RedGrittyBrick:

超级用户贡献者RedGrittyBrick和projectdp为我们找到了答案。 首先,RedGrittyBrick:

Yes (see USB protocols).

是(请参阅USB协议)。

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

据我了解,USB规范定义了一组复杂的分层协议和设备配置文件。

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.

例如,USB设备可以符合诸如大容量存储,键盘,人机接口设备等的高级模板,并可以由通用设备驱动程序进行管理。 某些USB设备可以在较低级别进行通信,因此操作系统的底层USB支持可以识别出需要特定于设备的高层驱动程序。

Followed by the answer from projectdp:

随后是来自projectdp的答案:

Question

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

运行中的低层USB通信协议是什么?

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.).

就在这里。 USB规范包括USB协议,该协议定义了比特级总线的使用方式。 这将是在更高级别协议(即大容量存储,HID等)基础上的低级别协议。

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 transactions per the USB protocol.

有关USB协议如何工作的详细信息,此OSDev Wiki非常有用。 这是另一个有趣的描述,使用序列图描述了每个USB协议的各种数据事务。

Bonus Question

奖金问题

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

Linux如何找到并加载该设备的设备驱动程序?

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 usbcore driver in the kernel.

在Linux上,当使用支持USB的内核时,由于USB规范,将通过硬件和内核检测到可用的USB设备。 在硬件方面,检测是通过USB主机控制器完成的。 然后在内核中,主机控制器驱动程序接管并将线路上的低级位转换为USB协议格式的信息。 然后,此信息将填充到内核的usbcore驱动程序中。

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

我从这篇出色的Opensourceforu文章中解释了这一点,该文章在Linux上下文中对您的问题有更多的细节和清晰性。

Make sure to check out the rest of the lively discussion via the thread link shared below!

确保通过下面共享的线程链接查看其余的热烈讨论!



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

翻译自: https://www.howtogeek.com/208611/is-there-an-actual-usb-communication-protocol/

usb通信 协议