Re: [PATCH 2/3] asus-wmi: report brightness key events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Corentin,

No, I don't use acpi_backlight=vendor or something like that.
And there is no ACPI backlight functions in the BIOS.
Yes, we just need to inform the userspace to update the backlight
brightness status,
and I found that using backlight_notify doesn't work, so I let it send
the key event directly.

Best regards,
AceLan Kao.

2012/3/9 Corentin Chary <corentin.chary@xxxxxxxxx>:
> On Fri, Mar 9, 2012 at 3:17 AM, AceLan Kao <acelan.kao@xxxxxxxxxxxxx> wrote:
>> Some ASUS ET2012 All-in-One machines will handle the brightness events
>> from BIOS, but we still need the key events to inform X to draw the
>> brightness OSD.
>>
>> Signed-off-by: AceLan Kao <acelan.kao@xxxxxxxxxxxxx>
>> ---
>>  drivers/platform/x86/asus-wmi.c  |    8 +++++++-
>>  drivers/platform/x86/asus-wmi.h  |    1 +
>>  drivers/platform/x86/eeepc-wmi.c |    7 ++++++-
>>  3 files changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
>> index 48e96f3..80c05ff 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -1272,7 +1272,13 @@ static void asus_wmi_notify(u32 value, void *context)
>>
>>        if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
>>                if (!acpi_video_backlight_support())
>> -                       asus_wmi_backlight_notify(asus, orig_code);
>> +               {
>> +                       if (unlikely(asus->driver->need_brightness_event))
>> +                               sparse_keymap_report_event(asus->inputdev,
>> +                                       code, key_value, autorelease);
>> +                       else
>> +                               asus_wmi_backlight_notify(asus, orig_code);
>> +               }
>
> If events are already handled by the BIOS you need to use
> backlight_notify. Keys are only sent when userspace need to update the
> backlight by itself. The GUI should only use uevents sent by the
> backlight device.
> Is the generic ACPI backlight functional ? Do you have to use
> acpi_backlight=vendor ?
>
>>        } else if (!sparse_keymap_report_event(asus->inputdev, code,
>>                                               key_value, autorelease))
>>                pr_info("Unknown key %x pressed\n", code);
>> diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
>> index 45fb62c..d6683ba 100644
>> --- a/drivers/platform/x86/asus-wmi.h
>> +++ b/drivers/platform/x86/asus-wmi.h
>> @@ -38,6 +38,7 @@ struct asus_wmi;
>>  struct asus_wmi_driver {
>>        bool                    hotplug_wireless;
>>        bool                    scalar_panel_brightness;
>> +       bool                    need_brightness_event;
>>        int                     wapf;
>>
>>        const char              *name;
>> diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
>> index c5f4c64..311f317 100644
>> --- a/drivers/platform/x86/eeepc-wmi.c
>> +++ b/drivers/platform/x86/eeepc-wmi.c
>> @@ -63,6 +63,8 @@ MODULE_PARM_DESC(hotplug_wireless,
>>
>>  static const struct key_entry eeepc_wmi_keymap[] = {
>>        /* Sleep already handled via generic ACPI code */
>> +       { KE_KEY, 0x11, { KEY_BRIGHTNESSUP } },
>> +       { KE_KEY, 0x20, { KEY_BRIGHTNESSDOWN } },
>>        { KE_KEY, 0x30, { KEY_VOLUMEUP } },
>>        { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },
>>        { KE_KEY, 0x32, { KEY_MUTE } },
>> @@ -167,7 +169,9 @@ static void eeepc_dmi_check(struct asus_wmi_driver *driver)
>>                char oemstring[30];
>>                while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
>>                        if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
>> -                               if (oemstring[18] == '3')
>> +                               if (oemstring[18] == '1')
>> +                                       driver->need_brightness_event = true;
>> +                               else if (oemstring[18] == '3')
>>                                        driver->scalar_panel_brightness = true;
>>                                break;
>>                        }
>> @@ -179,6 +183,7 @@ static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
>>  {
>>        driver->hotplug_wireless = hotplug_wireless;
>>        driver->scalar_panel_brightness = false;
>> +       driver->need_brightness_event = false;
>>        driver->wapf = -1;
>>        eeepc_dmi_check(driver);
>>  }
>> --
>> 1.7.9
>>
>
>
>
> --
> Corentin Chary
> http://xf.iksaif.net



-- 
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux