Skip to main content

USB鍵盤只發送信號還是他們收到信號?

USB鍵盤只發送信號還是他們收到信號?

Geoffrey Carr

我們大多數人只要工作得很好就不會過多地考慮我們的鍵盤,但是如果你停下來思考它,他們只會向我們的計算機發送信號,或者是否在工作中有一個積極的來回過程?今天的超級用戶問答帖子有一個好奇的讀者問題的答案。

今天的問答環節由SuperUser提供,這是Stack Exchange的一個細分,Stack Exchange是一個社區驅動的問答網站分組。

問題

超級用戶讀者Ne Mo想知道USB鍵盤是否只發送信號或是否也接收信號:

A USB keyboard does not need to receive any signals from a computer, just power, right? Or does it need to receive signals as well as send them?

USB鍵盤只發送信號還是接收信號?

答案

超級用戶貢獻者LawrenceC和Dmitry Grigoryev為我們提供了答案。首先,LawrenceC:

From the “Device Class Definition for Human Interface Devices (HID)” specification:

To change the keyboard LEDs, the keyboard accepts a command to do so. So it is not an “input-only” device (meaning it only outputs data to the host). That being said, there is a negotiation and enumeration process with all USB devices that require a back-and-forth conversation between the host and the device. You cannot have a “read-only” USB device. Even before USB, the computer’s keyboard controller would accept commands because it did a few things besides read the keyboard (reference):

接下來是Dmitry Grigoryev的回答:

Any USB device regardless of its class requires bidirectional communication to function. Every USB device (or function in terms of USB specifications) is represented as a set of endpoints which can be thought of as buffers which accept or receive data. However, even endpoints which can only send data wait for a special packet called a token before they can reply:

The gray boxes represent the USB host while the white boxes represent USB functions (chart source).

Even so-called interrupt transfers are done in this way, with the USB host polling connected devices using token packets. What differs between regular (bulk) transfers and interrupt transfers is that the polling time is small and guaranteed in the latter case. Still, all transfers are initiated by the host.


有什麼要補充說明嗎?在評論中發聲。想要從其他精通技術的Stack Exchange用戶那裡閱讀更多答案嗎?在這裡查看完整的討論主題。

圖片來源:Luke Jones(Flickr)

Link
Plus
Send
Send
Pin