require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_POWER_H_)) {
    eval 'sub _SYS_POWER_H_ () {1;}' unless defined(&_SYS_POWER_H_);
    require 'sys/ioccom.ph';
    unless(defined(&_KERNEL)) {
	require 'stdint.ph';
    }
    eval 'sub PSWITCH_TYPE_POWER () {0;}' unless defined(&PSWITCH_TYPE_POWER);
    eval 'sub PSWITCH_TYPE_SLEEP () {1;}' unless defined(&PSWITCH_TYPE_SLEEP);
    eval 'sub PSWITCH_TYPE_LID () {2;}' unless defined(&PSWITCH_TYPE_LID);
    eval 'sub PSWITCH_TYPE_RESET () {3;}' unless defined(&PSWITCH_TYPE_RESET);
    eval 'sub PSWITCH_TYPE_ACADAPTER () {4;}' unless defined(&PSWITCH_TYPE_ACADAPTER);
    eval 'sub PSWITCH_TYPE_HOTKEY () {5;}' unless defined(&PSWITCH_TYPE_HOTKEY);
    eval 'sub PSWITCH_HK_DISPLAY_CYCLE () {"display-cycle";}' unless defined(&PSWITCH_HK_DISPLAY_CYCLE);
    eval 'sub PSWITCH_HK_LOCK_SCREEN () {"lock-screen";}' unless defined(&PSWITCH_HK_LOCK_SCREEN);
    eval 'sub PSWITCH_HK_BATTERY_INFO () {"battery-info";}' unless defined(&PSWITCH_HK_BATTERY_INFO);
    eval 'sub PSWITCH_HK_EJECT_BUTTON () {"eject-button";}' unless defined(&PSWITCH_HK_EJECT_BUTTON);
    eval 'sub PSWITCH_HK_ZOOM_BUTTON () {"zoom-button";}' unless defined(&PSWITCH_HK_ZOOM_BUTTON);
    eval 'sub PSWITCH_HK_VENDOR_BUTTON () {"vendor-button";}' unless defined(&PSWITCH_HK_VENDOR_BUTTON);
    unless(defined(&THINKPAD_NORMAL_HOTKEYS)) {
	eval 'sub PSWITCH_HK_FNF1_BUTTON () {"fnf1-button";}' unless defined(&PSWITCH_HK_FNF1_BUTTON);
	eval 'sub PSWITCH_HK_WIRELESS_BUTTON () {"wireless-button";}' unless defined(&PSWITCH_HK_WIRELESS_BUTTON);
	eval 'sub PSWITCH_HK_WWAN_BUTTON () {"wWAN-button";}' unless defined(&PSWITCH_HK_WWAN_BUTTON);
	eval 'sub PSWITCH_HK_POINTER_BUTTON () {"pointer-button";}' unless defined(&PSWITCH_HK_POINTER_BUTTON);
	eval 'sub PSWITCH_HK_FNF10_BUTTON () {"fnf10-button";}' unless defined(&PSWITCH_HK_FNF10_BUTTON);
	eval 'sub PSWITCH_HK_FNF11_BUTTON () {"fnf11-button";}' unless defined(&PSWITCH_HK_FNF11_BUTTON);
	eval 'sub PSWITCH_HK_BRIGHTNESS_UP () {"brightness-up";}' unless defined(&PSWITCH_HK_BRIGHTNESS_UP);
	eval 'sub PSWITCH_HK_BRIGHTNESS_DOWN () {"brightness-down";}' unless defined(&PSWITCH_HK_BRIGHTNESS_DOWN);
	eval 'sub PSWITCH_HK_THINKLIGHT () {"thinklight";}' unless defined(&PSWITCH_HK_THINKLIGHT);
	eval 'sub PSWITCH_HK_VOLUME_UP () {"volume-up";}' unless defined(&PSWITCH_HK_VOLUME_UP);
	eval 'sub PSWITCH_HK_VOLUME_DOWN () {"volume-down";}' unless defined(&PSWITCH_HK_VOLUME_DOWN);
	eval 'sub PSWITCH_HK_VOLUME_MUTE () {"volume-mute";}' unless defined(&PSWITCH_HK_VOLUME_MUTE);
	eval 'sub PSWITCH_HK_STAR_BUTTON () {"star-button";}' unless defined(&PSWITCH_HK_STAR_BUTTON);
	eval 'sub PSWITCH_HK_SCISSORS_BUTTON () {"scissors-button";}' unless defined(&PSWITCH_HK_SCISSORS_BUTTON);
	eval 'sub PSWITCH_HK_BLUETOOTH_BUTTON () {"bluetooth-button";}' unless defined(&PSWITCH_HK_BLUETOOTH_BUTTON);
	eval 'sub PSWITCH_HK_KEYBOARD_BUTTON () {"keyboard-button";}' unless defined(&PSWITCH_HK_KEYBOARD_BUTTON);
    }
    eval 'sub PSWITCH_TYPE_RADIO () {6;}' unless defined(&PSWITCH_TYPE_RADIO);
    eval 'sub PSWITCH_EVENT_PRESSED () {0;}' unless defined(&PSWITCH_EVENT_PRESSED);
    eval 'sub PSWITCH_EVENT_RELEASED () {1;}' unless defined(&PSWITCH_EVENT_RELEASED);
    eval 'sub PENVSYS_TYPE_TEMP () {10;}' unless defined(&PENVSYS_TYPE_TEMP);
    eval 'sub PENVSYS_TYPE_VOLTAGE () {11;}' unless defined(&PENVSYS_TYPE_VOLTAGE);
    eval 'sub PENVSYS_TYPE_POWER () {12;}' unless defined(&PENVSYS_TYPE_POWER);
    eval 'sub PENVSYS_TYPE_RESISTANCE () {13;}' unless defined(&PENVSYS_TYPE_RESISTANCE);
    eval 'sub PENVSYS_TYPE_BATTERY () {14;}' unless defined(&PENVSYS_TYPE_BATTERY);
    eval 'sub PENVSYS_TYPE_FAN () {15;}' unless defined(&PENVSYS_TYPE_FAN);
    eval 'sub PENVSYS_TYPE_DRIVE () {16;}' unless defined(&PENVSYS_TYPE_DRIVE);
    eval 'sub PENVSYS_TYPE_INDICATOR () {17;}' unless defined(&PENVSYS_TYPE_INDICATOR);
    eval 'sub PENVSYS_EVENT_NORMAL () {90;}' unless defined(&PENVSYS_EVENT_NORMAL);
    eval 'sub PENVSYS_EVENT_CRITICAL () {100;}' unless defined(&PENVSYS_EVENT_CRITICAL);
    eval 'sub PENVSYS_EVENT_CRITOVER () {110;}' unless defined(&PENVSYS_EVENT_CRITOVER);
    eval 'sub PENVSYS_EVENT_CRITUNDER () {120;}' unless defined(&PENVSYS_EVENT_CRITUNDER);
    eval 'sub PENVSYS_EVENT_WARNOVER () {130;}' unless defined(&PENVSYS_EVENT_WARNOVER);
    eval 'sub PENVSYS_EVENT_WARNUNDER () {140;}' unless defined(&PENVSYS_EVENT_WARNUNDER);
    eval 'sub PENVSYS_EVENT_BATT_CRIT () {170;}' unless defined(&PENVSYS_EVENT_BATT_CRIT);
    eval 'sub PENVSYS_EVENT_BATT_WARN () {175;}' unless defined(&PENVSYS_EVENT_BATT_WARN);
    eval 'sub PENVSYS_EVENT_BATT_HIGH () {177;}' unless defined(&PENVSYS_EVENT_BATT_HIGH);
    eval 'sub PENVSYS_EVENT_BATT_MAX () {178;}' unless defined(&PENVSYS_EVENT_BATT_MAX);
    eval 'sub PENVSYS_EVENT_LOW_POWER () {180;}' unless defined(&PENVSYS_EVENT_LOW_POWER);
    eval 'sub PENVSYS_EVENT_STATE_CHANGED () {190;}' unless defined(&PENVSYS_EVENT_STATE_CHANGED);
    eval 'sub PENVSYS_EVENT_LIMITS () {200;}' unless defined(&PENVSYS_EVENT_LIMITS);
    eval 'sub PENVSYS_EVENT_CAPACITY () {210;}' unless defined(&PENVSYS_EVENT_CAPACITY);
    eval 'sub PENVSYS_EVENT_NULL () {220;}' unless defined(&PENVSYS_EVENT_NULL);
    eval 'sub POWER_EVENT_MSG_SIZE () {32;}' unless defined(&POWER_EVENT_MSG_SIZE);
    eval 'sub POWER_EVENT_SWITCH_STATE_CHANGE () {0;}' unless defined(&POWER_EVENT_SWITCH_STATE_CHANGE);
    eval 'sub POWER_EVENT_ENVSYS_STATE_CHANGE () {1;}' unless defined(&POWER_EVENT_ENVSYS_STATE_CHANGE);
    eval 'sub pev_switch () { ($_pev_data->{_pev_d_switch});}' unless defined(&pev_switch);
    eval 'sub POWER_EVENT_RECVDICT () { &_IOWR(ord(\'P\'), 1, \'struct plistref\');}' unless defined(&POWER_EVENT_RECVDICT);
    eval 'sub POWER_IOC_GET_TYPE () { &_IOR(ord(\'P\'), 0, \'struct power_type\');}' unless defined(&POWER_IOC_GET_TYPE);
    if(defined(&_KERNEL)) {
	eval 'sub POWER_IOC_GET_TYPE_WITH_LOSSAGE () { &_IOR(ord(\'P\'), 0, $sizeof{\'struct power_type\'});}' unless defined(&POWER_IOC_GET_TYPE_WITH_LOSSAGE);
    }
}
1;
