From: Mathieu Bérard Date: Mon, 25 Sep 2006 22:00:27 +0000 (+0000) Subject: * Fix bugs in wifi/bluetooth set funtions in nbsmi and acpi X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=c2055c74096471056b448b270d01655d219339cf;p=omnibook.git * Fix bugs in wifi/bluetooth set funtions in nbsmi and acpi I am actually wondering how this could have worked as the raw_value computation was busted. * Add debug printks all over the place. --- diff --git a/acpi.c b/acpi.c index 67460fd..c210e14 100644 --- a/acpi.c +++ b/acpi.c @@ -239,8 +239,8 @@ static int omnibook_acpi_set_wireless(const struct omnibook_operation *io_op, un int raw_state; struct acpi_backend_data *priv_data = io_op->backend->data; - raw_state = state & WIFI_STA; /* bit 0 */ - raw_state |= (state & BT_STA) << 0x1; /* bit 1 */ + raw_state = !!(state & WIFI_STA); /* bit 0 */ + raw_state |= !!(state & BT_STA) << 0x1; /* bit 1 */ dprintk("set_wireless raw_state: %x\n", raw_state); @@ -260,6 +260,8 @@ static int omnibook_acpi_get_display(const struct omnibook_operation *io_op, uns if (retval < 0) return retval; + dprintk("get_display raw_state: %x\n", raw_state); + /* Backend specific to backend-neutral conversion */ *state = (raw_state & LCD_CSTE) ? DISPLAY_LCD_ON : 0; *state |= (raw_state & CRT_CSTE) ? DISPLAY_CRT_ON : 0; @@ -301,6 +303,8 @@ static int omnibook_acpi_set_display(const struct omnibook_operation *io_op, uns return -EINVAL; } + dprintk("set_display raw_state: %x\n", matched); + retval = omnibook_acpi_execute(priv_data->ec_handle, SET_DISPLAY_METHOD, &matched, NULL); if (retval < 0) return retval; diff --git a/doc/ChangeLog b/doc/ChangeLog index cf9987a..b00e8c9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -5,6 +5,7 @@ Changelog file for omnibook package: * Disable Acer support, acerhk module should provided better support with a far more complete autodetection database (see http://www2.informatik.hu-berlin.de/~tauber/acerhk/) +* Fix and improve bluetooth handling for TSM30X class laptops 2.20060921 Mathieu Bérard * The minimal required kernel version is now 2.6.9 (kref API) diff --git a/nbsmi.c b/nbsmi.c index 91d8292..c703fdd 100644 --- a/nbsmi.c +++ b/nbsmi.c @@ -469,6 +469,8 @@ static int omnibook_nbsmi_get_wireless(const struct omnibook_operation *io_op, u if ((retval = nbsmi_smi_read_command(&aerial_op, &data))) goto out; + dprintk("get_wireless (kill switch) raw_state: %x\n", data); + *state = data ? KILLSWITCH : 0; aerial_op.read_addr = SMI_GET_AERIAL; @@ -477,6 +479,8 @@ static int omnibook_nbsmi_get_wireless(const struct omnibook_operation *io_op, u if ((retval = nbsmi_smi_read_command(&aerial_op, &data))) goto out; + dprintk("get_wireless (aerial) raw_state: %x\n", data); + *state |= (data & WLEX_MASK) ? WIFI_EX : 0; *state |= (data & WLAT_MASK) ? WIFI_STA : 0; *state |= (data & BTEX_MASK) ? BT_EX : 0; @@ -489,13 +493,15 @@ static int omnibook_nbsmi_get_wireless(const struct omnibook_operation *io_op, u static int omnibook_nbsmi_set_wireless(const struct omnibook_operation *io_op, unsigned int state) { int retval = 0; - u8 data = 0; + u8 data; struct omnibook_operation aerial_op; aerial_op.write_addr = SMI_SET_AERIAL; - data |= state & BT_STA; - data |= (state & WIFI_STA) << 0x1; + data = !!(state & BT_STA); + data |= !!(state & WIFI_STA) << 0x1; + + dprintk("set_wireless raw_state: %x\n", data); retval = nbsmi_smi_write_command(&aerial_op, data); @@ -520,6 +526,8 @@ static int omnibook_nbmsi_hotkeys_get(const struct omnibook_operation *io_op, un if (retval < 0) return retval; + dprintk("get_hotkeys raw_state: %x\n", data); + *state = (data & SMI_FN_KEYS_MASK) ? HKEY_FN : 0; *state |= (data & SMI_STICK_KEYS_MASK) ? HKEY_STICK : 0; *state |= (data & SMI_FN_TWICE_LOCK_MASK) ? HKEY_TWICE_LOCK : 0; @@ -541,6 +549,8 @@ static int omnibook_nbmsi_hotkeys_set(const struct omnibook_operation *io_op, un data |= (state & HKEY_TWICE_LOCK) ? SMI_FN_TWICE_LOCK_MASK : 0; data |= (state & HKEY_DOCK) ? SMI_FN_DOCK_MASK : 0; + dprintk("set_hotkeys (Fn interface) raw_state: %x\n", data); + retval = nbsmi_smi_write_command(&hotkeys_op, data); if (retval < 0) return retval; @@ -548,6 +558,8 @@ static int omnibook_nbmsi_hotkeys_set(const struct omnibook_operation *io_op, un hotkeys_op.write_addr = SMI_SET_FN_F5_INTERFACE; data = !!(state & HKEY_FNF5); + dprintk("set_hotkeys (Fn F5) raw_state: %x\n", data); + retval = nbsmi_smi_write_command(&hotkeys_op, data); if (retval < 0) return retval;