Skip to content

Commit 90068ab

Browse files
committed
Battery (NetBSD): fix battery percentage detection
1 parent 5567e6c commit 90068ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/detection/battery/battery_nbsd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
4646
{
4747
if (prop_object_type(dict) != PROP_TYPE_DICTIONARY)
4848
continue;
49-
49+
5050
const char* desc = NULL;
5151
if (!prop_dictionary_get_string(dict, "description", &desc))
5252
continue;
@@ -88,7 +88,7 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
8888
ffStrbufInit(&battery->manufactureDate);
8989
battery->timeRemaining = -1;
9090

91-
battery->capacity = (double) curr / max;
91+
battery->capacity = (double) curr / (double) max * 100.;
9292
if (charging)
9393
ffStrbufAppendS(&battery->status, "Charging, ");
9494
else if (dischargeRate)
@@ -102,6 +102,6 @@ const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* r
102102
}
103103
}
104104
prop_object_iterator_release(itKey);
105-
105+
106106
return NULL;
107107
}

0 commit comments

Comments
 (0)