USB键盘仅发送信号还是也接收信号?

Most of us never give much thought to our keyboards as long as they work well, but if you stop to think about it for a moment, do they only send signals to our computers or is there an active back-and-forth process at work? Today’s SuperUser Q&A post has the answer to a curious reader’s question.

只要能正常工作,我们大多数人就不会对键盘进行过多思考,但是如果您停下来想一会儿,它们只是将信号发送到我们的计算机还是在进行中来回活动? ? 今天的“超级用户问答”帖子回答了一个好奇的读者的问题。

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网站分组。

问题 (The Question)

SuperUser reader Ne Mo wants to know if USB keyboards only send signals or if they receive them too:

超级用户阅读器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键盘不需要电源就可以接收来自计算机的任何信号,对吗? 还是需要接收信号并发送信号?

Do USB keyboards only send signals or do they receive them too?

USB键盘仅发送信号还是也接收信号?

答案 (The Answer)

SuperUser contributors LawrenceC and Dmitry Grigoryev have the answer for us. First up, LawrenceC:

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

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

根据“ 人机接口设备(HID)的设备类定义 ”规范:

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

要更改键盘指示灯,键盘可以接受命令。 因此,它不是“仅输入”设备(意味着它仅将数据输出到主机)。 话虽如此,所有USB设备都有一个协商和枚举过程,需要主机与设备之间来回对话。 您不能有“只读” USB设备。 甚至在使用USB之前,计算机的键盘控制器都会接受命令,因为它除了读取键盘( 参考资料 )外还做了其他一些事情:

Followed by the answer from Dmitry Grigoryev:

随后是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:

任何USB设备,无论其类别如何,都需要双向通信才能起作用。 每个USB设备(或按照USB规格的功能)都表示为一组端点,这些端点可以看作是接收或接收数据的缓冲区。 但是,即使只能发送数据的端点也要等待一个称为令牌的特殊数据包,然后它们才能答复:

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

灰色框代表USB主机,而白色框代表USB功能( 图表来源 )。

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.

USB主机使用令牌包轮询连接的设备,即使是所谓的中断传输也是如此。 常规(批量)传输和中断传输之间的区别在于轮询时间较短,并且在后一种情况下可以保证。 尽管如此,所有传输都是由主机发起的。



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的用户那里获得更多答案? 在此处查看完整的讨论线程

Image Credit: Luke Jones (Flickr)

图片来源: 卢克·琼斯(Flickr)

翻译自: https://www.howtogeek.com/299085/do-usb-keyboards-only-send-signals-or-do-they-receive-them-too/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值