From: Mathieu Bérard Date: Fri, 13 Oct 2006 23:42:03 +0000 (+0000) Subject: * Get back to "work" after a few weeks without hacking : Attempt to make BT enabling... X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=af4965bdbe559c32a0071af0176064d7c177501b;p=omnibook.git * Get back to "work" after a few weeks without hacking : Attempt to make BT enabling/disabling work * Update ChangleLog --- diff --git a/acpi.c b/acpi.c index c210e14..0b2284a 100644 --- a/acpi.c +++ b/acpi.c @@ -52,6 +52,11 @@ static char ec_dev_list[][20] = { #define TOSHIBA_ACPI_BT_CLASS "bluetooth" #define TOSHIBA_ACPI_DEVICE_NAME "bluetooth adapter" +#define TOSH_BT_ACTIVATE_USB "AUSB" +#define TOSH_BT_DISABLE_USB "DUSB" +#define TOSH_BT_POWER_ON "BTPO" +#define TOSH_BT_POWER_OFF "BTPF" + /* * ACPI driver for Toshiba Bluetooth device */ @@ -72,7 +77,8 @@ static struct acpi_driver omnibook_bt_driver = { * ACPI backend private data structure */ struct acpi_backend_data { - acpi_handle ec_handle; + acpi_handle ec_handle; /* Handle on ACPI EC device */ + acpi_handle bt_handle; /* Handle on ACPI BT device */ struct kref refcount; /* Reference counter of this backend */ }; @@ -194,24 +200,36 @@ static int omnibook_acpi_execute(acpi_handle dev_handle, char *method, const int return 0; } +/* forward declaration */ +struct omnibook_backend acpi_backend; + static int omnibook_acpi_bt_add(struct acpi_device *device) { + struct acpi_backend_data *priv_data = acpi_backend.data; + dprintk("Enabling found Toshiba Bluetooth ACPI device.\n"); strcpy(acpi_device_name(device), TOSHIBA_ACPI_DEVICE_NAME); strcpy(acpi_device_class(device), TOSHIBA_ACPI_BT_CLASS); - omnibook_acpi_execute(device->handle, "AUSB", NULL, NULL); /* Activate USB */ - omnibook_acpi_execute(device->handle, "BTPO", NULL, NULL); /* Power On */ + /* Save handle in backend private data structure. ugly. */ + priv_data->bt_handle = device->handle; + + omnibook_acpi_execute(device->handle, TOSH_BT_ACTIVATE_USB, NULL, NULL); + omnibook_acpi_execute(device->handle, TOSH_BT_POWER_ON, NULL, NULL); return 0; } static int omnibook_acpi_bt_remove(struct acpi_device *device, int type) { + struct acpi_backend_data *priv_data = acpi_backend.data; + dprintk("Disabling Toshiba Bluetooth ACPI device.\n"); - omnibook_acpi_execute(device->handle, "DUSB", NULL, NULL); /* Diable USB */ - omnibook_acpi_execute(device->handle, "BTPF", NULL, NULL); /* Power Off */ + priv_data->bt_handle = NULL; + omnibook_acpi_execute(device->handle, TOSH_BT_DISABLE_USB, NULL, NULL); + omnibook_acpi_execute(device->handle, TOSH_BT_POWER_OFF, NULL, NULL); return 0; } + static int omnibook_acpi_get_wireless(const struct omnibook_operation *io_op, unsigned int *state) { int retval = 0; @@ -238,6 +256,7 @@ static int omnibook_acpi_set_wireless(const struct omnibook_operation *io_op, un int retval = 0; int raw_state; struct acpi_backend_data *priv_data = io_op->backend->data; + char *method; raw_state = !!(state & WIFI_STA); /* bit 0 */ raw_state |= !!(state & BT_STA) << 0x1; /* bit 1 */ @@ -247,6 +266,16 @@ static int omnibook_acpi_set_wireless(const struct omnibook_operation *io_op, un if ((retval = omnibook_acpi_execute(priv_data->ec_handle, SET_WIRELESS_METHOD, &raw_state, NULL))) return retval; + /* BT device appears to need more work*/ + if(priv_data->bt_handle) { + method = (state & BT_STA) ? TOSH_BT_POWER_ON : TOSH_BT_POWER_OFF; + if ((retval = omnibook_acpi_execute(priv_data->bt_handle, method, NULL, NULL))) + return retval; + method = (state & BT_STA) ? TOSH_BT_ACTIVATE_USB : TOSH_BT_DISABLE_USB; + if ((retval = omnibook_acpi_execute(priv_data->bt_handle, method, NULL, NULL))) + return retval; + } + return retval; } diff --git a/doc/ChangeLog b/doc/ChangeLog index b00e8c9..099feab 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -6,6 +6,8 @@ Changelog file for omnibook package: 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 +* DMI signature added: + HP Pavilion ze4500 (ectype 7) 2.20060921 Mathieu Bérard * The minimal required kernel version is now 2.6.9 (kref API)