#3355 HIGH Update.: Wireless shutdown on Laptop Lid Close

Zarro Boogs per Child bugtracker at laptop.org
Fri Jun 13 19:02:51 EDT 2008


#3355: Wireless shutdown on Laptop Lid Close
--------------------------+-------------------------------------------------
  Reporter:  kimquirk     |       Owner:  dsaxena         
      Type:  enhancement  |      Status:  assigned        
  Priority:  high         |   Milestone:  Update.2 (8.2.0)
 Component:  kernel       |     Version:                  
Resolution:               |    Keywords:  update.1?       
  Verified:  0            |    Blocking:                  
 Blockedby:               |  
--------------------------+-------------------------------------------------

Comment(by cjb):

 Here's a patch for the kernel interface to the EC commands:

 {{{
 [PATCH #3355] Add sysfs support for powering down the OLPC 88W8838
 wireless chip.

 This uses the OLPC EC 0x35/0x25 interface.

 Question:  is simple_strtoul() safe here?

 Signed-off-by: Chris Ball <cjb at laptop.org>
 ---
  arch/x86/kernel/olpc-pm.c |   19 +++++++++++++++++++
  1 files changed, 19 insertions(+), 0 deletions(-)

 diff --git a/arch/x86/kernel/olpc-pm.c b/arch/x86/kernel/olpc-pm.c
 index e99a464..9f0a565 100644
 --- a/arch/x86/kernel/olpc-pm.c
 +++ b/arch/x86/kernel/olpc-pm.c
 @@ -43,6 +43,8 @@
  /* These, and the battery EC commands, should be in an olpc.h. */
  #define EC_WRITE_SCI_MASK 0x1b
  #define EC_READ_SCI_MASK  0x1c
 +#define EC_WLAN_ENTER_RESET 0x35
 +#define EC_WLAN_LEAVE_RESET 0x25

  extern void do_olpc_suspend_lowlevel(void);

 @@ -661,6 +663,19 @@ static ssize_t wackup_show(struct kobject *s, struct
 kobj_attribute *attr,
         return sprintf(buf, "%s\n", wackup_source ? wackup_source :
 "none");
  }

 +static ssize_t wlanreset_execute(struct kobject *s, struct kobj_attribute
 *attr,
 +               const char *buf, size_t n)
 +{
 +       unsigned int val = simple_strtoul(buf, NULL, 0);
 +       if (val == 1) {
 +               olpc_ec_cmd(EC_WLAN_ENTER_RESET, NULL, 0, NULL, 0);
 +       }
 +       else if (val == 0) {
 +               olpc_ec_cmd(EC_WLAN_LEAVE_RESET, NULL, 0, NULL, 0);
 +       }
 +       return n;
 +}
 +
  static struct kobj_attribute control_attr =
         __ATTR(olpc-pm, 0644, control_show, control_store);

 @@ -670,10 +685,14 @@ static struct kobj_attribute test_attr =
  static struct kobj_attribute wackup_attr =
         __ATTR(wakeup-source, 0400, wackup_show, NULL);

 +static struct kobj_attribute wlanreset_attr =
 +       __ATTR(wlan-reset, 0644, NULL, wlanreset_execute);
 +
  static struct attribute * olpc_attributes[] = {
         &control_attr.attr,
         &test_attr.attr,
         &wackup_attr.attr,
 +       &wlanreset_attr.attr,
         NULL
  };

 ]}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/3355#comment:38>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list