yangsong8-a1 opened a new pull request, #22095:
URL: https://github.com/apache/nuttx/pull/22095
## Summary
goldfish_battery_register() only enabled the interrupt, so the battery
state was reported for the first time when the emulator raised an
interrupt. Until then readers of the gauge (for example the
battery_state uORB topic) got no data. Queue the battery work once at
registration to publish the initial state.
The first commit only fixes the nxstyle errors that goldfish_battery.c
already had on master (switch body indentation). It does not change
code.
## Impact
drivers/power/battery/goldfish_battery.c only. No API change.
## Testing
Ubuntu 22.04, arm-none-eabi-gcc 13.2.Rel1. There is no goldfish board
in the tree, so a local board (not part of this PR) was made from
qemu-armv7a with CONFIG_ARCH_CHIP_GOLDFISH_ARM, CONFIG_DEVICE_TREE,
CONFIG_BATTERY_GAUGE and CONFIG_GOLDFISH_BATTERY; its bringup calls
goldfish_battery_register() with the /goldfish_battery node from the
FDT. The image runs in the goldfish (Android) emulator 32.1.15 with
hw.battery=yes. The init task opens /dev/charge/goldfish_battery right
after boot, before the emulator raises any battery interrupt, and polls
it for 2 s. Three boots each:
master:
goldfish_battery_register: 0
poll(2000 ms) = 0 revents 0x0 read -1 mask 0x00000000
This PR:
goldfish_battery_register: 0
poll(2000 ms) = 1 revents 0x1 read 4 mask 0x000000bd
0xbd is the STATE, ONLINE, VOLTAGE, CURRENT, CAPACITY and TEMPERATURE
change bits that goldfish_battery_work() reports.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]