Origin commit data
------------------
Branch: ni/coolstream
Commit: 5e69fd2b22
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-06 (Mon, 06 Feb 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-02-06 21:17:40 +01:00
3 changed files with 39 additions and 23 deletions

View File

@@ -1150,12 +1150,12 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
if (n < 0)
return menu_return::RETURN_NONE;
const char hdidle[] = "/sbin/hd-idle";
bool have_hdidle = !access(hdidle, X_OK);
if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60)
g_settings.hdd_sleep = 60;
const char hdidle[] = "/sbin/hd-idle";
bool have_hdidle = !access(hdidle, X_OK);
if (have_hdidle) {
system("kill $(pidof hd-idle)");
int sleep_seconds = g_settings.hdd_sleep;
@@ -1171,12 +1171,22 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
}
if (sleep_seconds)
my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str());
while (n--)
free(namelist[i]);
free(namelist);
return menu_return::RETURN_NONE;
}
const char hdparm[] = "/sbin/hdparm";
bool have_hdparm = !access(hdparm, X_OK);
if (!have_hdparm)
{
while (n--)
free(namelist[i]);
free(namelist);
return menu_return::RETURN_NONE;
}
struct stat stat_buf;
bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode);
@@ -1190,12 +1200,11 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise);
snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name);
if (have_hdidle)
my_system(3, hdparm, M_opt, opt);
else if (have_nonbb_hdparm)
if (have_nonbb_hdparm)
my_system(4, hdparm, M_opt, S_opt, opt);
else // busybox hdparm doesn't support "-M"
my_system(3, hdparm, S_opt, opt);
free(namelist[i]);
}
free(namelist);