openatx / adbutils

pure python adb library for google adb service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError when using the .battery() method

arnold-layne opened this issue · comments

I'm getting a ValueError when trying to use the .battery() method on a AdbDevice class instance even tho it works perfectly fine through pure adb, here's the replication:

from adbutils import adb
d = adb.device()
AdbDevice(serial=RXCT303****) # Last 4 digits censored
d.battery()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python312\Lib\site-packages\adbutils\shell.py", line 522, in battery
key, val = line.strip().split(':', 1)
^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

The output I get when using pure adb through the shell command 'adb shell dumpsys battery':

Current Battery Service state:
AC powered: false
USB powered: true
Wireless powered: false
Max charging current: 0
Max charging voltage: 0
Charge counter: 2809520
status: 2
health: 2
present: true
level: 69
scale: 100
voltage: 4061
temperature: 313
technology: Li-ion
batteryMiscEvent: 65536
batteryCurrentEvent: 32768
mSecPlugTypeSummary: 2
LED Charging: true
LED Low Battery: true
current now: 532
charge counter: 2809520
Adaptive Fast Charging Settings: false
Super Fast Charging Settings: true
USE_FAKE_BATTERY: false
FEATURE_WIRELESS_FAST_CHARGER_CONTROL: true
mWasUsedWirelessFastChargerPreviously: false
mWirelessFastChargingSettingsEnable: true
LLB CAL: 20220323
LLB MAN:
LLB CURRENT: YEAR2024M6D11
LLB DIFF: 115
SEC_FEATURE_BATTERY_FULL_CAPACITY: true
mFullCapacityEnable: false
FEATURE_HICCUP_CONTROL: true
FEATURE_SUPPORTED_DAILY_BOARD: false
SEC_FEATURE_BATTERY_LIFE_EXTENDER: false
SEC_FEATURE_USE_WIRELESS_POWER_SHARING: true
health: vendor.samsung.hardware.health@2.0::ISehHealth@Proxy
BatteryInfoBackUp
mSavedBatteryAsoc: 94
mSavedBatteryMaxTemp: 486
mSavedBatteryMaxCurrent: 5258
mSavedBatteryUsage: 55334
FEATURE_SAVE_BATTERY_CYCLE: true
SEC_FEATURE_PREVENT_SWELLING: false