Battery (Linux): remove option --battery-dir

It was added in c5c3cecb93 but there was no comment or issues linked to indicate why it was necessary.

`/sys/class/power_supply` is standardized in <https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power>. I don't I want to support non-standard platform unless proper reason is given
This commit is contained in:
Carter Li
2024-01-04 14:18:06 +08:00
parent 6698283430
commit cd0109c382
6 changed files with 5 additions and 49 deletions
+3 -4
View File
@@ -101,14 +101,13 @@ static void parseBattery(FFstrbuf* dir, const char* id, FFBatteryOptions* option
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
{
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
ffStrbufAppend(&baseDir, &options->dir);
ffStrbufEnsureEndsWithC(&baseDir, '/');
ffStrbufAppend(&baseDir, "/sys/class/power_supply/");
uint32_t baseDirLength = baseDir.length;
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(baseDir.chars);
if(dirp == NULL)
return "opendir(batteryDir) == NULL";
return "opendir(\"/sys/class/power_supply/\") == NULL";
struct dirent* entry;
while((entry = readdir(dirp)) != NULL)
@@ -122,7 +121,7 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
}
if(results->length == 0)
return "batteryDir doesn't contain any battery folder";
return "\"/sys/class/power_supply/\" doesn't contain any battery folder";
return NULL;
}