Skip to content

Commit

Permalink
Battery (Haiku): handle empty slots
Browse files Browse the repository at this point in the history
My ThinkPad has a second slot for external batteries.
  • Loading branch information
mmuman authored and CarterLi committed Feb 19, 2025
1 parent 6e98db3 commit 3e5d129
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/detection/battery/battery_haiku.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const char* parseBattery(int dfd, const char* battId, FFlist* results)
if (ioctl(fd, GET_EXTENDED_BATTERY_INFO, &extended, sizeof(extended)) != 0)
return "ioctl(GET_EXTENDED_BATTERY_INFO) failed";

if (extended.last_full_charge == (uint32)-1)
return "Skipped";

FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
ffStrbufInitS(&battery->modelName, extended.model_number);
ffStrbufInitS(&battery->manufacturer, extended.oem_info);
Expand Down

0 comments on commit 3e5d129

Please sign in to comment.