Revision: 5954
Author: pebender
Date: Tue Dec 15 10:48:23 2009
Log: - Modified scripts so that they enable wake-on-usb using /sys rather  
than /proc.


http://code.google.com/p/minimyth/source/detail?r=5954

Modified:
  /trunk/gar-minimyth/html/minimyth/document-changelog.txt
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm

=======================================
--- /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Mon Dec 14  
21:51:29 2009
+++ /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Tue Dec 15  
10:48:23 2009
@@ -55,6 +55,8 @@
        device output.
      - Switched to lircudevd for supporting multiple remote controls.
      - Moved event device support from lircd to lircudevd.
+    - Modified scripts so that they enable wake-on-usb using /sys rather  
than
+      /proc.

  Fixed bugs
      - Fixed a bug that caused mm_sleep and mm_sleep_on_ss to output an  
error
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Mon Dec 14 18:28:54 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Tue Dec 15 10:48:23 2009
@@ -12,93 +12,51 @@
  use File::Path ();
  use MiniMyth ();

+                my $dir = File::Basename::dirname($_);
  sub _remote_wakeup_enable
  {
      my $self   = shift;
      my $device = shift;

-    my $wakeup_node = undef;
-
-    if (($device) && (-e $device) && (open(FILE, '-|', qq(/sbin/udevadm  
info --query=all --attribute-walk --name='$device'))))
-    {
-        my $kernels    = undef;
-        my $subsystems = undef;
-        my $class      = undef;
-        my $in_record  = 0;
+    my $path = undef;
+    if (($device) && (-e $device) && (open(FILE, '-|', qq(/sbin/udevadm  
info --query=path --name='$device'))))
+    {
          while (<FILE>)
          {
              chomp;
-            my $field = $_;
-            if ($field =~ /^ *looking at parent device .*$/)
-            {
-                $kernels    = undef;
-                $subsystems = undef;
-                $class      = undef;
-                $in_record  = 1;
-                next;
-            }
-            if ($in_record)
-            {
-                if ($field =~ /^ *$/)
-                {
-                    if (($kernels =~ /^[^ ]+/) && ($subsystems =~ /^pci$/)  
&& ($class =~ /^0x0c03(0|1|2)0$/))
-                    {
-                        $wakeup_node = "$subsystems:$kernels";
+            $path = Cwd::abs_path(qq(/sys/$_));
+            last;
+        }
+        close(FILE);
+    }
+
+    if ($path)
+    {
+        while (($path) && ($path !~ /^\/sys$/))
+        {
+            if (-e qq($path/power/wakeup))
+            {
+                my $state = undef;
+                if (open(FILE, '<', qq($path/power/wakeup)))
+                {
+                    while (<FILE>)
+                    {
+                        chomp;
+                        $state = $_;
                          last;
                      }
-                    $in_record  = 0;
-                    next;
-                }
-                if ($field =~ /^ *([^ ]+)=="(.*)"$/)
-                {
-                    my $name  = $1;
-                    my $value = $2;
-                    given ($name)
-                    {
-                        when (/^KERNELS$/)
-                        {
-                            $kernels = $value;
-                        }
-                        when (/^SUBSYSTEMS$/)
-                        {
-                            $subsystems = $value;
-                        }
-                        when (/^ATTRS{class}$/)
-                        {
-                            $class = $value;
-                        }
-                    }
-                    next;
+                    close(FILE);
+                }
+                if ($state =~ /^disabled$/)
+                {
+                    if (open(FILE, '>', qq($path/power/wakeup)))
+                    {
+                        print FILE q(enabled);
+                        close(FILE);
+                    }
                  }
              }
-        }
-        close(FILE);
-    }
-
-    if ((defined($wakeup_node)) && ($wakeup_node ne ''))
-    {
-        if ((-r '/proc/acpi/wakeup') &&  
(open(FILE, '<', '/proc/acpi/wakeup')))
-        {
-            my $wakeup_device = undef;
-            my $wakeup_status = undef;
-            foreach (grep(/ $wakeup_node$/, (<FILE>)))
-            {
-                chomp;
-                ($wakeup_device, undef, $wakeup_status) = split(/ +/, $_);
-                last;
-            }
-            close(FILE);
-
-            if ((defined($wakeup_device)) && ($wakeup_device ne '') &&
-                (defined($wakeup_status)) && ($wakeup_status ne '') &&
-                ($wakeup_status ne 'enabled'))
-            {
-                if ((-w '/proc/acpi/wakeup') &&  
(open(FILE, '>', '/proc/acpi/wakeup')))
-                {
-                    print FILE $wakeup_device . "\n";
-                    close(FILE);
-                }
-            }
+            $path = File::Basename::dirname($path);
          }
      }

--

You received this message because you are subscribed to the Google Groups 
"minimyth-commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/minimyth-commits?hl=en.


Reply via email to