File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1123,7 +1123,7 @@ elseif(Haiku)
11231123 src/common/netif/netif_haiku.c
11241124 src/common/networking_linux.c
11251125 src/common/processing_linux.c
1126- src/detection/battery/battery_nosupport .c
1126+ src/detection/battery/battery_haiku .c
11271127 src/detection/bios/bios_nosupport.c
11281128 src/detection/board/board_nosupport.c
11291129 src/detection/bootmgr/bootmgr_nosupport.c
Original file line number Diff line number Diff line change 1+ #include "fastfetch.h"
2+ #include "battery.h"
3+ #include "common/io/io.h"
4+ #include "util/stringUtils.h"
5+
6+ void parseBattery (FFstrbuf * content , FFlist * results )
7+ {
8+ char * line = NULL ;
9+ size_t n = 0 ;
10+ while (ffStrbufGetline (& line , & n , content ))
11+ {
12+
13+ }
14+ }
15+
16+ const char * ffDetectBattery (FFBatteryOptions * options , FFlist * results )
17+ {
18+ FF_AUTO_CLOSE_DIR DIR * dir = opendir ("/dev/power/acpi_battery/" );
19+ if (!dir ) return "opendir(/dev/power/acpi_battery) failed" ;
20+
21+ FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate ();
22+ struct dirent * entry ;
23+ while ((entry = readdir (dir )))
24+ {
25+ if (entry -> d_name [0 ] == '.' ) continue ;
26+ if (!ffReadFileBufferRelative (dirfd (dir ), entry -> d_name , & content )) continue ;
27+ parseBattery (& content , results );
28+ }
29+
30+ return "To be supported" ;
31+ }
You can’t perform that action at this time.
0 commit comments