Open hellboysatan opened 3 months ago
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.
I would like it to not show the UPS name, but only the battery, or the Microsoft AC adapter if possible.
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.
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".
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?
Status update:
I've now inspected hidbatt.inf
, which is the in-built driver used when testing on Windows:
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.
Would it be possible to refactor that program to show it's the battery and not the UPS?