On Fri, Apr 09, 2010 at 08:40:08PM +0200, Corentin Chary wrote: > On Fri, Apr 9, 2010 at 5:07 PM, Yong Wang <yong.y.wang@xxxxxxxxxxxxxxx> wrote: > > +static int read_brightness(struct backlight_device *bd) > > +{ > > + ? ? ? static u32 ctrl_param; > > + ? ? ? acpi_status status; > > + > > + ? ? ? status = eeepc_wmi_get_devstate(EEEPC_WMI_DEVID_BACKLIGHT, &ctrl_param); > > + > > + ? ? ? if (ACPI_FAILURE(status)) > > + ? ? ? ? ? ? ? return -1; > > + ? ? ? else > > + ? ? ? ? ? ? ? return ctrl_param & 0x000000FF; > > +} > > ctrl_param & 0xFF seems simpler > OK. > > +static int eeepc_wmi_backlight_notify(struct eeepc_wmi *eeepc_wmi, bool increase) > > +{ > > + ? ? ? struct backlight_device *bd = eeepc_wmi->backlight_dev; > > + ? ? ? int old = bd->props.brightness; > > + ? ? ? int new; > > + > > + ? ? ? if (increase) > > + ? ? ? ? ? ? ? new = old + 1; > > + ? ? ? else > > + ? ? ? ? ? ? ? new = old - 1; > > + > > + ? ? ? if (new > bd->props.max_brightness) > > + ? ? ? ? ? ? ? new = bd->props.max_brightness; > > + ? ? ? else if (new < 0) > > + ? ? ? ? ? ? ? new = 0; > > + > > + ? ? ? bd->props.brightness = new; > > + ? ? ? backlight_update_status(bd); > > Do you really need to do that ? Can't you just use read_backlight() > and do nothing (just call backlight_force_update) ? > If you really need to do that (but I don't think so), can't you just > do "new = event - NOTIFY_BRN_MIN" ? > Backlight does not change when pressing the brightness hotkeys. Therefore read_backlight returns the old brightness value. Unlike the netbooks eeepc-laptop is written for, the new ones based on WMI could generate two different notification codes depending on which brightness hotkey is pressed. #define NOTIFY_BRNUP_MIN 0x11 #define NOTIFY_BRNUP_MAX 0x1f #define NOTIFY_BRNDOWN_MIN 0x20 #define NOTIFY_BRNDOWN_MAX 0x2e > > - ? ? ? if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID)) { > > + ? ? ? if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID) || !wmi_has_guid(EEEPC_WMI_MGMT_GUID)) { > > ? ? ? ? ? ? ? ?pr_warning("EEEPC WMI: No known WMI GUID found\n"); > > ? ? ? ? ? ? ? ?return -ENODEV; > > ? ? ? ?} > > Maybe you could make the driver work only for the available GUID. If > EVENT_GUID is here, provide hotkeys. > If MGMT is here, provide extra functions. And if none are there, return -ENODEV; > As far as what I heard from ASUS, either all of the GUIDs or none of them are present. Thanks -Yong -- 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