Control and status calls with csCode = 70 are optional for all drivers. Making a control call with csCode = 70 sets the device's power-saving mode, while a status call returns it. Information is passed in the following structure in csParam[0] :
enum {
kcsGetPowerMode = 70 /* returns the current power mode*/
kcsSetPowerMode = 70 /* sets the current power mode*/
};
enum {
pmActive = 0, /* normal operation */
pmStandby = 1, /* minimal energy saving state; can go active
in 5 seconds */
pmIdle = 2, /* substantial energy savings; can go active
in 15 seconds */
pmSleep = 3 /* maximum energy savings; device may be
turned off */
};
struct LowPowerMode
{
unsigned char mode;
};
The differences among these low power modes are the amount of energy savings and the time it takes to return to the active state. Each device driver must determine the appropriate level of energy saving support for the device that it drives. If the device can go into active state in all possible low power states within 5 seconds, it should map both pmIdle and pmSleep to pmStandby. If the device takes a minimum of 10 seconds to go into active state from a low power state, then it should map pmStandby to pmActive. All device drivers should support these four modes; they should never return an error because they do not support a particular mode. Low power modes that are not possible on a given device should be mapped to other appropriate modes.
For the device to become active, it is not required that the device driver get a control call telling it to make the device active. Any operation that requires the device to become active is sufficient. For example, if a hard disk driver currently has its drive in sleep mode and it gets a read call, it should automatically wake up the drive and respond to the read request. Once the drive is made active, the device driver requires a control call telling it to put the device into some other mode. It should not put the device into an inactive mode automatically unless it is managing the device's power state independently of the Mac OS Power Manager.
Drivers that support low power mode calls should return true to the 'lpwr' DriverGestalt call listed in Table 8-5. Drivers that do not support these calls should return false to the 'lpwr' DriverGestalt call, return controlErr to the SetPowerMode ( csCode = 70) control call, and return statusErr to the GetPowerMode ( csCode = 70) status call.