[英]USB-HID data initialisation
I configured the USB driver at my RPi4 as a USB-Slave device and set the USB descriptors in the RPI4 to enumarate as a ordenary USB keyboard.我在我的 RPi4 上将 USB 驱动程序配置为 USB 从设备,并将 RPI4 中的 USB 描述符设置为普通的 USB 键盘。 Therefore I wrote a Java program on the RPi4 which read-in the keyboard states from the USB driver (Scroll-Lock, Num-Lock, and so on)
因此,我在 RPi4 上编写了一个 Java 程序,该程序从 USB 驱动程序(Scroll-Lock、Num-Lock 等)读取键盘状态
This works great.这很好用。 I can plug in the RPi4 at any PC.
我可以在任何 PC 上插入 RPi4。 If I hit the Num-Lock key at the hardware- keyboard my RPi recognizes the change at the same time and shows the same state in the Java programm as the led at the hardware keyboard.
如果我在硬件键盘上按下 Num-Lock 键,我的 RPi 会同时识别更改,并在 Java 程序中显示与硬件键盘上的 LED 相同的 state。
But how the heck does initialisation work for such states?但是对于这些状态,初始化到底是如何工作的呢? I did not find any hint at the USB documentation upto now.
到目前为止,我在 USB 文档中没有找到任何提示。
This event-triggered data flow from PC to RPI4 works as intended and is absolutely right.这种从 PC 到 RPI4 的事件触发数据流按预期工作并且绝对正确。 But how can I trigger in this USB data flow model a "manual update" for my program internal states at the startup of my Java program?
但是,如何在 USB 数据流 model 中触发 Java 程序启动时程序内部状态的“手动更新”?
To detect the state of the numlock/capslock/scrolllock you need to read the values of the respective LED lights report that the host sends to the device soon after it is plugged in.要检测 numlock/capslock/scrolllock 的 state,您需要读取主机在插入设备后不久发送给设备的相应 LED 灯报告的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.