HIDPowerDevice icon indicating copy to clipboard operation
HIDPowerDevice copied to clipboard

HID Battery not UPS

Open hellboysatan opened this issue 1 year ago • 7 comments

Would it be possible to refactor that program to show it's the battery and not the UPS?

hellboysatan avatar Aug 05 '24 11:08 hellboysatan

Sorry, did not understand. The way how it is shown in the OS is controlled by the OS. Usually the UPS is shown as the battery.

abratchik avatar Aug 05 '24 12:08 abratchik

I would like it to not show the UPS name, but only the battery, or the Microsoft AC adapter if possible.

hellboysatan avatar Aug 05 '24 14:08 hellboysatan

not to show where? The device name is constructed by the host OS. Usually it takes the device type, which is taken from the HID constant and may be PID/VID.

abratchik avatar Aug 06 '24 08:08 abratchik

I suspect that what is really being asked here is how to change the HID descriptor so that the device appears like a "Battery" instead of a "UPS" on connected computers. I'm also interested in this myself.

The project currently appears like a "HID UPS Battery" on Windows, and similarly a "UPS" on Linux and macOS. It would be nice if it could also be configured to instead show up as a "Battery". image

I've already tried to change 0x09, 0x04, // USAGE (UPS) on the top of the HID descriptor in HIDPowerDevice.cpp to either 0x09, 0x10, // USAGE (BatterySystem) or 0x09, 0x12, // USAGE (Battery). BatterySystem and Battery are documented with "Physical collection" usage type in the standard, whereas UPS is documented with usage type "Application collection". The 0xA1, 0x01, // COLLECTION (Application) line below therefore also needs to be modified to 0xA1, 0x00, // COLLECTION (Physical).

However, only changing the top-level USAGE to Battery(System) and COLLECTION to Physical only leads to Windows no longer recognizing the device as a UPS or Battery. I therefore suspect that more invasive changes to the HID descriptor are needed to make the device appear as a "Battery".

@abratchik Any suggestions or comments?

forderud avatar Oct 14 '24 11:10 forderud

Status update: I've now inspected hidbatt.inf, which is the in-built driver used when testing on Windows:
image
image

The INF file hardcodes HID_DEVICE_BATTERY.DeviceDesc = "HID UPS Battery", which is probably the source of the device name. I'm not sure though if this hardcoding is fixed, or it it's possible to override it with special HID descriptors.

forderud avatar Oct 14 '24 11:10 forderud

@forderud I want to ask if you found out how to change it?

hellboysatan avatar Jan 23 '25 10:01 hellboysatan

@forderud I want to ask if you found out how to change it?

I've unfortunately not been able to change how the battery appear in Widows.

forderud avatar Jan 23 '25 10:01 forderud