]> Devoid-pointer.net GitWeb - omnibook.git/commitdiff
* Get back to "work" after a few weeks without hacking : Attempt to make BT enabling...
authorMathieu Bérard <mathieu.berard@crans.org>
Fri, 13 Oct 2006 23:42:03 +0000 (23:42 +0000)
committerMathieu Bérard <mathieu.berard@crans.org>
Fri, 13 Oct 2006 23:42:03 +0000 (23:42 +0000)
* Update ChangleLog

acpi.c
doc/ChangeLog

diff --git a/acpi.c b/acpi.c
index c210e1473ad500aa17beb58def589f9c522f319a..0b2284a67783781f246c9101d94445923be39c79 100644 (file)
--- 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;
 }
 
index b00e8c91061125f3b7acd09f129604e98947974b..099feabce14371488400c7fd0edc6f1349e3effb 100644 (file)
@@ -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 <math_b@users.sourceforge.net>
 * The minimal required kernel version is now 2.6.9 (kref API)