简体   繁体   English

带串行端口的UPS的HID电源设备驱动程序

[英]HID power device driver for UPS with serial port

I have a UPS which outputs data, like battery status, via serial port. 我有一台UPS,它通过串行端口输出数据,例如电池状态。 This UPS is connected to a computer via USB, using a serial port to USB adapter. 此UPS使用USB适配器的串行端口通过USB连接到计算机。 Communication with the UPS is possible with hyper terminal via a custom protocol. 超级终端可以通过自定义协议与UPS进行通信。

Is it possible to write a HID power device driver for Windows using the USB output from the UPS? 是否可以使用UPS的USB输出为Windows编写HID电源设备驱动程序? This driver should translate the custom protocol to the HID power device protocol. 该驱动程序应将自定义协议转换为HID电源设备协议。

Yes that can be done by writing a WDM or KMDF USB HID mini driver for your UPS. 是的,可以通过为您的UPS编写WDM或KMDF USB HID迷你驱动程序来完成。 In the HID Mini driver, you must have to define the HID report descriptor with USB power device usages in the hid collections. 在HID Mini驱动程序中,必须必须在hid集合中使用USB电源设备的用法定义HID报告描述符。 In that driver you need to configure and enumerate your USB pipes which are used for virtual serial port communication right now. 在该驱动程序中,您需要立即配置和枚举用于虚拟串行端口通信的USB管道。 You have to send and receive data directly from and to USB pipes. 您必须直接从USB管道发送和接收数据。

In this HID mini driver, once you define report descriptor with usage pages such as Battery system with necessary uses as hid reports and handle IOCTL calls from the top HID class driver, you can see your UPS attached as a HID UPS Battery in the Windows device manager. 在此HID微型驱动程序中,一旦您定义了带有使用情况页面的报告描述符(例如具有必要用途的电池系统作为隐藏报告)并处理了来自顶级HID类驱动程序的IOCTL调用,您便可以在Windows设备中看到UPS作为HID UPS电池连接了经理。 You can see the UPS as a battery with charging status, AC power status, battery remaining capacity % on the power options panel as well as in the system tray, like what we see in the laptop's battery status on the system tray. 您可以在电源选项面板以及系统托盘中将UPS视为具有充电状态,交流电源状态,电池剩余电量%的电池,就像我们在系统托盘中笔记本电脑的电池状态中看到的那样。

Also you can send the existing UPS commands what you are sending now via hyper terminal would be then sent via HID API calls such as HidD_GetFeature, HidD_SetFeature, HidD_GetInputReport, HidD_SetOutputReport functions from a custom developed application as per your requirements. 您还可以根据需要,通过超级终端发送现有的UPS命令,然后再通过HID API调用(例如,HidD_GetFeature,HidD_SetFeature,HidD_GetInputReport,HidD_SetOutputReport函数)通过​​超级终端发送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM