2 * wireless.c Bluetooth feature
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * Written by Mathieu BĂ©rard <mathieu.berard@crans.org>, 2006
21 static int omnibook_bt_read(char *buffer, struct omnibook_operation *io_op)
27 if ((retval = backend_aerial_get(io_op, &state)))
31 sprintf(buffer + len, "Bluetooth adapter is %s",
32 (state & BT_EX) ? "present" : "absent");
34 len += sprintf(buffer + len, " and %s", (state & BT_STA) ? "enabled" : "disabled");
35 len += sprintf(buffer + len, ".\n");
40 static int omnibook_bt_write(char *buffer, struct omnibook_operation *io_op)
45 if(mutex_lock_interruptible(&io_op->backend->mutex))
48 if ((retval = __backend_aerial_get(io_op, &state)))
53 else if (*buffer == '1')
60 retval = __backend_aerial_set(io_op, state);
63 mutex_unlock(&io_op->backend->mutex);
67 static struct omnibook_feature bt_driver;
69 static int __init omnibook_bt_init(struct omnibook_operation *io_op)
75 * Refuse enabling/disabling a non-existent device
78 if ((retval = backend_aerial_get(io_op, &state)))
82 bt_driver.write = NULL;
87 static struct omnibook_tbl wireless_table[] __initdata = {
88 {TSM70 | TSA105 | TSX205, {ACPI,}}, /* stubs to select backend */
89 {TSM40, {SMI,}}, /* stubs to select backend */
93 static struct omnibook_feature __declared_feature bt_driver = {
96 .read = omnibook_bt_read,
97 .write = omnibook_bt_write,
98 .init = omnibook_bt_init,
99 .ectypes = TSM70 | TSM40 | TSA105 | TSX205,
100 .tbl = wireless_table,
103 module_param_named(bluetooth, bt_driver.enabled, int, S_IRUGO);
104 MODULE_PARM_DESC(bluetooth, "Use 0 to disable, 1 to enable bluetooth adapter control");