In big-hardware-info/src/big_hardware_info/collectors/inxi_parser.py you have
charge = 0
if "charge" in cleaned:
charge_str = str(cleaned["charge"])
match = re.search(r"(\d+(?:\.\d+)?)", charge_str)
if match:
charge = float(match.group(1))
and it give a wrong battery percent.
Change it to
charge = 0
if "charge" in cleaned:
charge_str = str(cleaned["charge"])
# Prefer the percentage inside parentheses: "54.0 Wh (98.4%)"
match = re.search(r"\((\d+(?:\.\d+)?)\s*%\)", charge_str)
if not match:
# Direct form for peripherals: "100%"
match = re.search(r"(\d+(?:\.\d+)?)\s*%", charge_str)
if not match:
# Fallback: first number (edge cases)
match = re.search(r"(\d+(?:\.\d+)?)", charge_str)
if match:
charge = float(match.group(1))
and all this good ;)
In
big-hardware-info/src/big_hardware_info/collectors/inxi_parser.pyyou haveand it give a wrong battery percent.
Change it to
and all this good ;)