The "1" parameter is the "nowakeup" option. Executing the above call as root always spins up my disk (also when replacing "1" with "0"). The corresponding code is:
nowakeup = atoi (argv[2]);
if (sk_disk_open (device, &d) != 0) { g_printerr ("Failed to open disk %s: %m\n", device); goto out;
}
if (sk_disk_check_sleep_mode (d, &awake) != 0) { g_printerr ("Failed to check if disk %s is awake: %m\n", device); goto out;
}
/* don't wake up disk unless specically asked to */
if (nowakeup && !awake) { g_printerr ("Disk %s is asleep and nowakeup option was passed\n", device);
ret = 2; goto out;
}
So either sk_disk_check_sleep_mode fails to detect that the disk is sleeping, or the nowakeup option is parsed incorrectly. I'll debug that later.
I peeked at the source code. The ATA smart collect script is called by the daemon like this:
/usr/ lib/devicekit- disks/devkit- disks-helper- ata-smart- collect /dev/sdb 1
The "1" parameter is the "nowakeup" option. Executing the above call as root always spins up my disk (also when replacing "1" with "0"). The corresponding code is:
nowakeup = atoi (argv[2]);
if (sk_disk_open (device, &d) != 0) {
g_printerr ("Failed to open disk %s: %m\n", device);
goto out;
}
if (sk_disk_ check_sleep_ mode (d, &awake) != 0) {
g_printerr ("Failed to check if disk %s is awake: %m\n", device);
goto out;
}
/* don't wake up disk unless specically asked to */
g_printerr ("Disk %s is asleep and nowakeup option was passed\n", device);
goto out;
if (nowakeup && !awake) {
ret = 2;
}
So either sk_disk_ check_sleep_ mode fails to detect that the disk is sleeping, or the nowakeup option is parsed incorrectly. I'll debug that later.