Question

I have a UPS which outputs data, like battery status, via serial port. This UPS is connected to a computer via USB, using a serial port to USB adapter. Communication with the UPS is possible with hyper terminal via a custom protocol.

Is it possible to write a HID power device driver for Windows using the USB output from the UPS? This driver should translate the custom protocol to the HID power device protocol.

Was it helpful?

Solution

Yes that can be done by writing a WDM or KMDF USB HID mini driver for your UPS. In the HID Mini driver, you must have to define the HID report descriptor with USB power device usages in the hid collections. In that driver you need to configure and enumerate your USB pipes which are used for virtual serial port communication right now. You have to send and receive data directly from and to USB pipes.

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. 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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top