USB клавиатурите изпращат ли само сигнали или ги получават ли?

Съдържание:

USB клавиатурите изпращат ли само сигнали или ги получават ли?
USB клавиатурите изпращат ли само сигнали или ги получават ли?

Видео: USB клавиатурите изпращат ли само сигнали или ги получават ли?

Видео: USB клавиатурите изпращат ли само сигнали или ги получават ли?
Видео: CS50 2014 - Week 1 - YouTube 2024, Април
Anonim
Повечето от нас никога не обръщат много внимание на нашите клавиатури, стига те да работят добре, но ако спрете да мислите за това за момент, те изпращат ли сигнали само на нашите компютри или има активен процес на обратно виждане на работното място ? Днешната публикация "SuperUser Q &A" е отговорът на въпроса на любознателен читател.
Повечето от нас никога не обръщат много внимание на нашите клавиатури, стига те да работят добре, но ако спрете да мислите за това за момент, те изпращат ли сигнали само на нашите компютри или има активен процес на обратно виждане на работното място ? Днешната публикация "SuperUser Q &A" е отговорът на въпроса на любознателен читател.

Днешната сесия за въпроси и отговори ни идва с любезното съдействие на SuperUser - подразделение на Stack Exchange - обединяване на уеб сайтове с въпроси и отговори.

Въпроса

Reader на SuperUser 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 клавиатури само сигнали или също така получават ли ги?

Отговорът

Сътрудниците на SuperUser 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):
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):
Image
Image

Последвано от отговора на Дмитрий Григориев:

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).
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? Вижте цялата тема на дискусията тук.

Image Credit: Лука Джоунс (Flickr)

Препоръчано: