diff --git a/src/add-ons/kernel/drivers/wmi/Jamfile b/src/add-ons/kernel/drivers/wmi/Jamfile index dcb773e130..c932205b98 100644 --- a/src/add-ons/kernel/drivers/wmi/Jamfile +++ b/src/add-ons/kernel/drivers/wmi/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src add-ons kernel drivers wmi ; -UsePrivateHeaders wmi ; +UsePrivateHeaders drivers wmi ; UsePrivateKernelHeaders ; KernelAddon wmi : diff --git a/src/add-ons/kernel/drivers/wmi/WMIACPI.cpp b/src/add-ons/kernel/drivers/wmi/WMIACPI.cpp index 4d9c3c496b..1838d4d9d8 100644 --- a/src/add-ons/kernel/drivers/wmi/WMIACPI.cpp +++ b/src/add-ons/kernel/drivers/wmi/WMIACPI.cpp @@ -17,6 +17,7 @@ device_manager_info *gDeviceManager; +smbios_module_info *gSMBios; acpi_status wmi_acpi_adr_space_handler(uint32 function, @@ -453,9 +454,9 @@ wmi_acpi_register_child_devices(void *cookie) } - module_dependency module_dependencies[] = { { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager }, + { SMBIOS_MODULE_NAME, (module_info**)&gSMBios }, {} }; diff --git a/src/add-ons/kernel/drivers/wmi/WMIAsus.cpp b/src/add-ons/kernel/drivers/wmi/WMIAsus.cpp index 80d84eb8a7..e72daebcaa 100644 --- a/src/add-ons/kernel/drivers/wmi/WMIAsus.cpp +++ b/src/add-ons/kernel/drivers/wmi/WMIAsus.cpp @@ -19,6 +19,8 @@ #define ASUS_WMI_METHODID_DSTS 0x53545344 #define ASUS_WMI_METHODID_DEVS 0x53564544 + +#define ASUS_WMI_DEVID_ALS_ENABLE 0x00050001 #define ASUS_WMI_DEVID_BRIGHTNESS 0x00050012 #define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021 @@ -37,12 +39,14 @@ private: static void _NotifyHandler(acpi_handle handle, uint32 notify, void *context); void _Notify(acpi_handle handle, uint32 notify); + status_t _EnableAls(uint32 enable); private: device_node* fNode; wmi_device_interface* wmi; wmi_device wmi_cookie; uint32 fDstsID; const char* fEventGuidString; + bool fEnableALS; }; @@ -51,7 +55,8 @@ WMIAsus::WMIAsus(device_node *node) : fNode(node), fDstsID(ASUS_WMI_METHODID_DSTS), - fEventGuidString(NULL) + fEventGuidString(NULL), + fEnableALS(false) { CALLED(); @@ -77,6 +82,13 @@ WMIAsus::WMIAsus(device_node *node) TRACE("_SFUN: %x\n", value); } + // some ASUS laptops need to be ALS forced + fEnableALS = + gSMBios->match_vendor_product("ASUSTeK COMPUTER INC.", "UX430UAR"); + if (fEnableALS && _EnableAls(1) == B_OK) { + TRACE("ALSC enabled\n"); + } + // install event handler if (wmi->install_event_handler(wmi_cookie, ACPI_ASUS_WMI_EVENT_GUID, _NotifyHandler, this) == B_OK) { @@ -87,6 +99,11 @@ WMIAsus::WMIAsus(device_node *node) WMIAsus::~WMIAsus() { + // for ALS + if (fEnableALS && _EnableAls(0) == B_OK) { + TRACE("ALSC disabled\n"); + } + if (fEventGuidString != NULL) wmi->remove_event_handler(wmi_cookie, fEventGuidString); } @@ -119,6 +136,14 @@ WMIAsus::_EvaluateMethod(uint32 methodId, uint32 arg0, uint32 arg1, } +status_t +WMIAsus::_EnableAls(uint32 enable) +{ + CALLED(); + return _SetDevState(ASUS_WMI_DEVID_ALS_ENABLE, enable, NULL); +} + + status_t WMIAsus::_GetDevState(uint32 devId, uint32 *value) { diff --git a/src/add-ons/kernel/drivers/wmi/WMIPrivate.h b/src/add-ons/kernel/drivers/wmi/WMIPrivate.h index ec8be7f930..b9d620b99d 100644 --- a/src/add-ons/kernel/drivers/wmi/WMIPrivate.h +++ b/src/add-ons/kernel/drivers/wmi/WMIPrivate.h @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -43,6 +44,7 @@ class WMIDevice; extern device_manager_info *gDeviceManager; +extern smbios_module_info *gSMBios; extern wmi_device_interface gWMIDeviceModule; extern driver_module_info gWMIAsusDriverModule;