2
* wireless.c Wifi 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_wifi_read(char *buffer, struct omnibook_operation *io_op)
27
if ((retval = backend_aerial_get(io_op, &state)))
31
sprintf(buffer + len, "Wifi adapter is %s", (state & WIFI_EX) ? "present" : "absent");
34
sprintf(buffer + len, " and %s", (state & WIFI_STA) ? "enabled" : "disabled");
35
len += sprintf(buffer + len, ".\n");
37
sprintf(buffer + len, "Wifi Kill switch is %s.\n", (state & KILLSWITCH) ? "on" : "off");
43
static int omnibook_wifi_write(char *buffer, struct omnibook_operation *io_op)
48
if(mutex_lock_interruptible(&io_op->backend->mutex))
51
if ((retval = __backend_aerial_get(io_op, &state)))
56
else if (*buffer == '1')
63
if ((retval = __backend_aerial_set(io_op, state)))
67
mutex_unlock(&io_op->backend->mutex);
71
static struct omnibook_feature wifi_driver;
73
static int __init omnibook_wifi_init(struct omnibook_operation *io_op)
79
* Refuse enabling/disabling a non-existent device
82
if ((retval = backend_aerial_get(io_op, &state)))
85
if (!(state & WIFI_EX))
86
wifi_driver.write = NULL;
91
static struct omnibook_tbl wireless_table[] __initdata = {
92
{TSM70 | TSX205, {ACPI,}}, /* stubs to select backend */
93
{TSM40, {SMI,}}, /* stubs to select backend */
97
static struct omnibook_feature __declared_feature wifi_driver = {
100
.read = omnibook_wifi_read,
101
.write = omnibook_wifi_write,
102
.init = omnibook_wifi_init,
103
.ectypes = TSM70 | TSM40 | TSX205,
104
.tbl = wireless_table,
107
module_param_named(wifi, wifi_driver.enabled, int, S_IRUGO);
108
MODULE_PARM_DESC(wifi, "Use 0 to disable, 1 to enable Wifi adapter control");