Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Device report 0% charge if additional batteries already exist #11

Open
forderud opened this issue Aug 28, 2024 · 5 comments
Open

Comments

@forderud
Copy link
Contributor

forderud commented Aug 28, 2024

First, thanks a lot for sharing this project!

I noticed that the Arduino device always shows up as a battery with 0% charge when testing in Windows on a laptop that already has a battery.
image

Work-around

It appear to be possible to work around this problem by disabling the real battery device in Device Manager:
image
The remaining Arduino battery then afterwards shows up with correct charge:
single battery

ASK: It would be great if the device could show up with correct charge also on multi-battery setups. I'm not sure, but have a feeling that this can be achieved by tweaking some HID parameters.

@abratchik
Copy link
Owner

abratchik commented Aug 28, 2024

You are welcome. This is known issue, unfortunately.

Windows 10 does allow multiple batteries in the system and all of them can be displayed in the tray. However, the batteries must report their status in the same mode (HID specification supports maH, mwH and percentage) but most of UPS are only reporting percentage of charge. If you already have ACPI battery in your system (let's say you are testing on a laptop) then the percentage may not be reflected correctly.

You may change the units in the sketch how the remaining charge is reported and this will fix the issue but it will be valid only for the Windows host with the ACPI battery.

@forderud
Copy link
Contributor Author

forderud commented Aug 29, 2024

You may change the units in the sketch how the remaining charge is reported and this will fix the issue but it will be valid only for the Windows host with the ACPI battery.

I just tested changing HID_PD_CAPACITYMODE from 2 (%) to 1 (mwH) and it did indeed fix the problem. Thanks a lot for the tip! I fully understand that all values here are artificial, so whether or not the aggregated battery capacity % for all batteries reported by Windows is correct or not doesn't really matter for me. I'm just interested in making the capacity always show up on screen.

Are you interested in updating the UPS.ino example with this change? If so, then I can submit a PR on it.

@abratchik
Copy link
Owner

Well, if your fix is tested on Linux, Mac and Windows then of course I will accept, why not? :-) Will be happy to.

@forderud
Copy link
Contributor Author

Well, if your fix is tested on Linux, Mac and Windows then of course I will accept, why not? :-) Will be happy to.

Great! However, it will take me some days to test on all those platforms. Will get back to you when I'm done.

forderud added a commit to forderud/HIDPowerDevice that referenced this issue Aug 29, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Aug 29, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery.
@forderud
Copy link
Contributor Author

forderud commented Aug 29, 2024

See #14 for a proposed fix this this annoyance.

forderud added a commit to forderud/HIDPowerDevice that referenced this issue Aug 30, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 3, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 3, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 9, 2024
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 9, 2024
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 9, 2024
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 16, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Sep 29, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Oct 13, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Oct 14, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Oct 15, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.

DISCLAIMER: This also changes the DesignedCapacity & FullChargedCapacity reported by Windows from 100 to 361. I don't understand why.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Oct 17, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.

This also implies changing the FullChargeCapacity & DesignCapacity units to AmpSec with 24bit parameter size as documented in the HID Power Device standard.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Nov 7, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.
forderud added a commit to forderud/HIDPowerDevice that referenced this issue Nov 7, 2024
This fixes abratchik#11 by also reporting battery capacity percentage on Windows laptops that already has a battery. This makes the sample more interesting to demonstrate.

The `CapacityMode` units are documented in [Usage Tables for HID Power Devices](https://www.usb.org/sites/default/files/pdcv11.pdf) section 4.2.3 Battery Controls.

The total battery charge % reported by Windows appear to be a weighted sum of each battery, weighted by their respective capacities. The Arduino battery is currently harcoded to `iFullChargeCapacity = 100` mWh, which is quite small. It does therefore have a relatively low influence on the total battery charge % on the laptop I've tested on.

This also implies changing the FullChargeCapacity & DesignCapacity units to AmpSec with 24bit parameter size as documented in the HID Power Device standard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants