Added a new state constant, HDAPS_ON.
Changed hdaps_update_status to use the new constant when determining whether or not HDAPS has changed states from "on" to "off."
#ifndef __HDAPS_H__
#define __HDAPS_H__
#ifndef __HDAPS_H__
#define __HDAPS_H__
#define UNLOAD_HEADS_FMT "/sys/block/%s/device/unload_heads"
/* The most devices we'll consider. Gotta stop somewhere. */
#define UNLOAD_HEADS_FMT "/sys/block/%s/device/unload_heads"
/* The most devices we'll consider. Gotta stop somewhere. */
/* This just gets the status. */
int status = parse_int_from_file(hdaps->sysfs_file);
/* This just gets the status. */
int status = parse_int_from_file(hdaps->sysfs_file);
+ /* The value in the sysfs_file represents the number of milliseconds
+ * that the drive heads will be parked. Of course, this will
+ * generally count down, and appear different each time we poll.
+ *
+ * So, to determine whether or not HDAPS has gone from "on"
+ * to "off," we treat all values greater than zero the same.
+ */
+ if (status > 0) {
+ status = HDAPS_ON;
+ }
+
if (status != hdaps->previous_status) {
/* And we only update the icon if we need to. */
hdaps_set_icon(hdaps, status);
if (status != hdaps->previous_status) {
/* And we only update the icon if we need to. */
hdaps_set_icon(hdaps, status);