1 /* 2 * Copyright 2004-2011, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef POWER_MANAGMENT_H 6 #define POWER_MANAGMENT_H 7 8 9 #include <Drivers.h> 10 11 12 // io controls 13 enum { 14 // ioctl response with kMagicFreqID 15 IDENTIFY_DEVICE = B_DEVICE_OP_CODES_END + 20001, 16 17 GET_BATTERY_INFO, 18 GET_EXTENDED_BATTERY_INFO, 19 WATCH_BATTERY, 20 STOP_WATCHING_BATTERY 21 }; 22 23 24 // ACPI Battery: 25 // magic id returned by IDENTIFY_DEVICE 26 const uint32 kMagicACPIBatteryID = 17822; 27 28 29 // Our known battery states 30 #define BATTERY_DISCHARGING 0x01 31 #define BATTERY_CHARGING 0x02 32 #define BATTERY_CRITICAL_STATE 0x04 33 34 35 typedef struct { 36 int state; 37 int current_rate; 38 int capacity; 39 int voltage; 40 } acpi_battery_info; 41 42 43 typedef struct { 44 int power_unit; 45 int design_capacity; 46 int last_full_charge; 47 int technology; 48 int design_voltage; 49 int design_capacity_warning; 50 int design_capacity_low; 51 int capacity_granularity_1; 52 int capacity_granularity_2; 53 char model_number[32]; 54 char serial_number[32]; 55 char type[32]; 56 char oem_info[32]; 57 } acpi_extended_battery_info; 58 59 60 #endif 61