Comment 8 for bug 435190

Revision history for this message
Antti Kaihola (akaihola) wrote :

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 */
        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.