Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117275
b: refs/heads/master
c: 7d9a06d
h: refs/heads/master
i:
  117273: 2888fe9
  117271: dd876f2
v: v3
  • Loading branch information
Carlos Corbacho authored and Len Brown committed Oct 8, 2008
1 parent 125e3e6 commit 9c0f73a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 105 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0606e1abfcb66c3a29722162f5d2c7ad8b638237
refs/heads/master: 7d9a06de616f69374dab00396f27cf00962a72c9
28 changes: 4 additions & 24 deletions trunk/Documentation/laptops/acer-wmi.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Acer Laptop WMI Extras Driver
http://code.google.com/p/aceracpi
Version 0.1
9th February 2008
Version 0.2
18th August 2008

Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk>

Expand Down Expand Up @@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to
ever wish to remove the card, or swap it out at some point, please get in touch
with me, as we may well be able to gain some data on wireless card detection.

To read the status of the wireless radio (0=off, 1=on):
cat /sys/devices/platform/acer-wmi/wireless

To enable the wireless radio:
echo 1 > /sys/devices/platform/acer-wmi/wireless

To disable the wireless radio:
echo 0 > /sys/devices/platform/acer-wmi/wireless

To set the state of the wireless radio when loading acer-wmi, pass:
wireless=X (where X is 0 or 1)
The wireless radio is exposed through rfkill.

Bluetooth
*********
Expand All @@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth
module off the internet that is compatible with your laptop and fit it, then
it will work just fine with acer-wmi.

To read the status of the bluetooth module (0=off, 1=on):
cat /sys/devices/platform/acer-wmi/wireless

To enable the bluetooth module:
echo 1 > /sys/devices/platform/acer-wmi/bluetooth

To disable the bluetooth module:
echo 0 > /sys/devices/platform/acer-wmi/bluetooth

To set the state of the bluetooth module when loading acer-wmi, pass:
bluetooth=X (where X is 0 or 1)
Bluetooth is exposed through rfkill.

3G
**
Expand Down
101 changes: 21 additions & 80 deletions trunk/drivers/misc/acer-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,30 +125,22 @@ enum interface_flags {

static int max_brightness = 0xF;

static int wireless = -1;
static int bluetooth = -1;
static int mailled = -1;
static int brightness = -1;
static int threeg = -1;
static int force_series;

module_param(mailled, int, 0444);
module_param(wireless, int, 0444);
module_param(bluetooth, int, 0444);
module_param(brightness, int, 0444);
module_param(threeg, int, 0444);
module_param(force_series, int, 0444);
MODULE_PARM_DESC(wireless, "Set initial state of Wireless hardware");
MODULE_PARM_DESC(bluetooth, "Set initial state of Bluetooth hardware");
MODULE_PARM_DESC(mailled, "Set initial state of Mail LED");
MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness");
MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware");
MODULE_PARM_DESC(force_series, "Force a different laptop series");

struct acer_data {
int mailled;
int wireless;
int bluetooth;
int threeg;
int brightness;
};
Expand Down Expand Up @@ -851,8 +843,6 @@ static void __init acer_commandline_init(void)
* capability isn't available on the given interface
*/
set_u32(mailled, ACER_CAP_MAILLED);
set_u32(wireless, ACER_CAP_WIRELESS);
set_u32(bluetooth, ACER_CAP_BLUETOOTH);
set_u32(threeg, ACER_CAP_THREEG);
set_u32(brightness, ACER_CAP_BRIGHTNESS);
}
Expand Down Expand Up @@ -1057,40 +1047,30 @@ static void acer_rfkill_exit(void)
}

/*
* Read/ write bool sysfs macro
* sysfs interface
*/
#define show_set_bool(value, cap) \
static ssize_t \
show_bool_##value(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
static ssize_t show_bool_threeg(struct device *dev,
struct device_attribute *attr, char *buf)
{
u32 result; \
acpi_status status = get_u32(&result, cap); \
if (ACPI_SUCCESS(status)) \
return sprintf(buf, "%u\n", result); \
return sprintf(buf, "Read error\n"); \
} \
\
static ssize_t \
set_bool_##value(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
u32 tmp = simple_strtoul(buf, NULL, 10); \
acpi_status status = set_u32(tmp, cap); \
if (ACPI_FAILURE(status)) \
return -EINVAL; \
return count; \
} \
static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
show_bool_##value, set_bool_##value);

show_set_bool(wireless, ACER_CAP_WIRELESS);
show_set_bool(bluetooth, ACER_CAP_BLUETOOTH);
show_set_bool(threeg, ACER_CAP_THREEG);
acpi_status status = get_u32(&result, ACER_CAP_THREEG);
if (ACPI_SUCCESS(status))
return sprintf(buf, "%u\n", result);
return sprintf(buf, "Read error\n");
}

static ssize_t set_bool_threeg(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
u32 tmp = simple_strtoul(buf, NULL, 10);
acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
if (ACPI_FAILURE(status))
return -EINVAL;
return count;
}
static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg,
set_bool_threeg);

/*
* Read interface sysfs macro
*/
static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
char *buf)
{
Expand Down Expand Up @@ -1180,16 +1160,6 @@ pm_message_t state)
if (!data)
return -ENOMEM;

if (has_cap(ACER_CAP_WIRELESS)) {
get_u32(&value, ACER_CAP_WIRELESS);
data->wireless = value;
}

if (has_cap(ACER_CAP_BLUETOOTH)) {
get_u32(&value, ACER_CAP_BLUETOOTH);
data->bluetooth = value;
}

if (has_cap(ACER_CAP_MAILLED)) {
get_u32(&value, ACER_CAP_MAILLED);
data->mailled = value;
Expand All @@ -1210,15 +1180,6 @@ static int acer_platform_resume(struct platform_device *device)
if (!data)
return -ENOMEM;

if (has_cap(ACER_CAP_WIRELESS))
set_u32(data->wireless, ACER_CAP_WIRELESS);

if (has_cap(ACER_CAP_BLUETOOTH))
set_u32(data->bluetooth, ACER_CAP_BLUETOOTH);

if (has_cap(ACER_CAP_THREEG))
set_u32(data->threeg, ACER_CAP_THREEG);

if (has_cap(ACER_CAP_MAILLED))
set_u32(data->mailled, ACER_CAP_MAILLED);

Expand All @@ -1243,12 +1204,6 @@ static struct platform_device *acer_platform_device;

static int remove_sysfs(struct platform_device *device)
{
if (has_cap(ACER_CAP_WIRELESS))
device_remove_file(&device->dev, &dev_attr_wireless);

if (has_cap(ACER_CAP_BLUETOOTH))
device_remove_file(&device->dev, &dev_attr_bluetooth);

if (has_cap(ACER_CAP_THREEG))
device_remove_file(&device->dev, &dev_attr_threeg);

Expand All @@ -1261,20 +1216,6 @@ static int create_sysfs(void)
{
int retval = -ENOMEM;

if (has_cap(ACER_CAP_WIRELESS)) {
retval = device_create_file(&acer_platform_device->dev,
&dev_attr_wireless);
if (retval)
goto error_sysfs;
}

if (has_cap(ACER_CAP_BLUETOOTH)) {
retval = device_create_file(&acer_platform_device->dev,
&dev_attr_bluetooth);
if (retval)
goto error_sysfs;
}

if (has_cap(ACER_CAP_THREEG)) {
retval = device_create_file(&acer_platform_device->dev,
&dev_attr_threeg);
Expand Down

0 comments on commit 9c0f73a

Please sign in to comment.