Design of HID device communication interface based on Wave Panel

Abstract : One of the important issues in the development and use of HID devices is the communication between the device and the host application. Based on the Wave Panel of HID equipment for video editing, this paper first introduces the performance characteristics of HID equipment and the HID communication mechanism under Windows environment. Based on this, a practical HID device communication interface is designed. The communication interface uses related Windows. The API function implements the identification of HID devices. Open and close, and complete the two-way communication process between the device and the host application in asynchronous mode. Finally, the interface was programmed in the Wave Panel. The experimental results show that the interface has good versatility and can better realize the communication function between the HID device and the host application.

Introduction

HID (Human Interface Device) is a type of low-speed USB device. A typical HID device has a keyboard. mouse. Joysticks, etc. Relative to the U disk. For high-speed USB devices such as printers, HID devices are easy to use. Responsive. The advantages of low cost of research and development, and its application fields are very extensive. Currently HID devices are rapidly evolving toward specialization.

Wave Panel is a video color editing software developed by Apple. Color supports a type of dedicated data input and display HID device. The device panel is equipped with buttons. The decoder and the two-dimensional trackball are three controllers that can be fast. Accurately set various video color parameters, and display control and status information on the device's micro display, thus changing the traditional "mouse + keyboard" video editing software control method. Wave Panel does not provide Windows environment and The functionality of the application communication, so it can be designed to be fully functional based on the Wave Panel. Versatile communication interface and verified. This is very helpful for companies and research institutions to flexibly equip and control dedicated HID devices based on actual needs.

1 Wave Panel performance characteristics

In addition to meeting the USB standard, HID devices also have some features closely related to human-computer interaction, including:

1) Communication is usually performed using control mode or interrupt mode. The difference between the two transmission methods is that the control method is suitable for data with no special limitation on the delay, and the interrupt mode is suitable for low delay. Periodic data. The data transfer method of the Wave Panel is the interrupt mode.

2) The amount of data transmitted in a single transmission is small, and the data is mainly based on state change information or control information. The low-speed HID device has a maximum transfer data of 8 bytes, a full-speed device of 64 bytes, and a high-speed device of 1024 bytes. The data exchanged between the host and the HID device is stored in the Report structure.

The input report length of Wave Panel is 27 bytes, of which 0 bytes are used to record the report ID, and the first 41 bits of 1 ~ 6 bytes respectively record the pressing or lifting state of 41 keys, and 7 bits are unused. Set to 0; 7 ~ 19 bytes record the status of 13 decoders; 20 ~ 25 bytes every 2 bytes record the state of a 2D trackball X axis and Y axis; 26 bytes are reserved for firmware upgrade The output report length of the .Wave Panel is 41 bytes, of which 0 ~ 5 bytes are control commands and 6 ~ 40 bytes are characters for displaying information.

3) Use polling to detect device status changes. The HID device may send data to the host at any time, such as when the mouse moves or the keyboard has a button press. Therefore, the HID device polls each control port once in a fixed time interval. When it finds that the device status changes, it generates an input report and sends it to the host. However, the interval between polling is determined by the user's operating speed of the HID device. If the interval is too small, the user does not have time to complete an operation within two polling intervals; otherwise, the response speed of the HID device cannot match the user's operating speed, causing a delay.

The Wave Panel stipulates that all controller ports are polled every 40 milliseconds. If the status of any of the controllers changes within two polling intervals, an input report is generated and sent to the host before the next poll. 40 ms It is determined based on the video display time per frame.

2 HID device communication process

The HID device is the first USB device supported by the Windows operating system. Drivers for HID devices are built into Windows 98 and later, and there is no need to write a dedicated driver when communicating with HID devices. This simplifies the design and development of the communication interface between the HID device and the host application.

Through analysis, the communication between the HID device and the host application can be divided into device identification and opening. Read the report. Write the report and the device closes the four modules.

2. 1 Wave Panel recognition and opening

After the HID device is connected to the host, the vendor ID (VID) is used. The combination of the product ID (PID) and the product version number (PVN) attribute values ​​is used as the unique identifier of the device. The three attribute values ​​of the Wave Panel can be directly obtained from the product manual. Since a host may have multiple HID devices connected at the same time, the application must recognize and open the Wave Panel before communication. This process requires multiple Windows API functions to be called. The basic method is to first obtain a collection of all HID device information currently connected to the host, then enumerate each device in the collection one by one, and compare the VID.PID and PVN values. When the three attribute values ​​are equal to the Wave Panel, it is found. Call CreateFile() to open the Wave Panel and save the Wave Panel device handle. The flow of this module is shown in Figure 1.

Featuring Level VI energy efficiency and meet IEC/EN/UL 62368-1 safety standards, the external universal Power Adapter provides 8 safety protections and best after-sale service. The 25W to 39W series power adapters follows the PC flame retardant plastic case, accepts three standard AC inlet version IEC320-C6,IEC320-C8 and IEC320-C14 for I.T.E/AV equipment needed.

25 ~ 39 Watt Desktop Adapters

EN61558 Ac adapter,Laptop Adapter,19V Ac Power Adapter,Universal Adapter

Shenzhenshi Zhenhuan Electronic Co Ltd , https://www.szzhpower.com