gui/hdd_menu: use hd-idle instead of hdparm, if available

Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
This commit is contained in:
martii
2013-12-24 15:11:08 +01:00
committed by Jacek Jendrzej
parent b45511b196
commit 7341dce214

View File

@@ -271,6 +271,24 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
if (n < 0)
return 0;
if (!access("/sbin/hd-idle", X_OK)) {
system("kill $(pidof hd-idle)");
int sleep_seconds = g_settings.hdd_sleep;
switch (sleep_seconds) {
case 241:
sleep_seconds = 30 * 60;
break;
case 242:
sleep_seconds = 60 * 60;
break;
default:
sleep_seconds *= 5;
}
if (sleep_seconds)
my_system(3, "/sbin/hd-idle", "-i", to_string(sleep_seconds).c_str());
return 1;
}
const char hdparm[] = "/sbin/hdparm";
bool hdparm_link = false;
struct stat stat_buf;