Revision: 5800
Author: pebender
Date: Sun Nov  8 10:12:35 2009
Log: - Added autodetection of the GoTView USB Remote (0419:0001).
- Modified LIRC wakeup enabling so that it works for any USB LIRC device
   (of course the USB LIRC hardware needs to have Wake-on-USB support).


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

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/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/05-minimyth-detect-lirc.rules.disabled

=======================================
--- /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Sat Nov  7  
13:25:49 2009
+++ /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Sun Nov  8  
10:12:35 2009
@@ -5,7 +5,7 @@
  MiniMyth release. For earlier changes see the yearly changelog files.

   
--------------------------------------------------------------------------------
-Changes since 71 (2009-11-07):
+Changes since 71 (2009-11-08):

  Current MythTV versions
      MythTV 0.20-softpad: version 0.20.2.softpad, release-0-20-fixes branch  
svn 16082 and
@@ -29,6 +29,11 @@
      - Added firmware autodetection for the Hauppauge WinTV-HVR-2200 and
        WinTV-HVR-2250.

+Improved LIRC
+    - Added autodetection of the GoTView USB Remote (0419:0001).
+    - Modified LIRC wakeup enabling so that it works for any USB LIRC  
device
+      (of course the USB LIRC hardware needs to have Wake-on-USB support).
+
  Improved Xorg
      - Patched xorg-server to add udev hotplug support for input devices.

=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Fri Oct  9 13:44:36 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Sun Nov  8 10:12:35 2009
@@ -5,6 +5,7 @@

  use strict;
  use warnings;
+use feature "switch";

  use Cwd ();
  use File::Basename ();
@@ -16,125 +17,88 @@
      my $self   = shift;
      my $device = shift;

-    if (($device) && (-e $device) && (open(FILE, '-|', qq(/sbin/udevadm  
info --query=name --root --name='$device'))))
-    {
+    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;
          while (<FILE>)
          {
              chomp;
-            $device = $_;
-            last;
+            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";
+                        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 ((! -r '/sys/class/lirc') ||
-        (! opendir(DIR, '/sys/class/lirc')))
-    {
-        return 1;
-    }
-    my @lirc_list = ();
-    foreach (grep(! /^\./, (readdir(DIR))))
-    {
-        push(@lirc_list, $_);
-    }
-    closedir(DIR);
-
-    foreach my $lirc (@lirc_list)
-    {
-        my $name = '';
-        if (open(FILE, '-|', qq(/sbin/udevadm info --query=name --root  
--path='/sys/class/lirc/$lirc')))
-        {
-            while (<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;
-                $name = $_;
+                ($wakeup_device, undef, $wakeup_status) = split(/ +/, $_);
                  last;
              }
              close(FILE);
-        }
-        if ($name ne $device)
-        {
-            next;
-        }
-
-        my $devpath = Cwd::abs_path(qq(/sys/class/lirc/$lirc/device));
-        $devpath = File::Basename::dirname($devpath);
-        $devpath = File::Basename::dirname($devpath);
-
-        if ((! -r "$devpath/busnum") ||
-            (! open(FILE, '<', "$devpath/busnum")))
-        {
-            next;
-        }
-        my $busnum = undef;
-        foreach (grep(/^[0-9]+$/,(<FILE>)))
-        {
-            chomp;
-            $busnum = $_;
-            last;
-        }
-        close(FILE);
-        if (! defined($busnum))
-        {
-            next;
-        }
-
-        if ((! -r "$devpath/subsystem/devices/usb$busnum/serial") ||
-            (!  
open(FILE, '<', "$devpath/subsystem/devices/usb$busnum/serial")))
-        {
-            next;
-        }
-        my $serial = undef;
-        foreach (grep(! /^$/,(<FILE>)))
-        {
-            chomp;
-            $serial = $_;
-            last;
-        }
-        close(FILE);
-        if (! defined($serial))
-        {
-            next;
-        }
-
-        if ((! -r '/proc/acpi/wakeup') ||
-            (! open(FILE, '<', '/proc/acpi/wakeup')))
-        {
-            next;
-        }
-        my $entry = undef;
-        foreach (grep(/$serial$/, (<FILE>)))
-        {
-            chomp;
-            $entry = $_;
-        }
-        close(FILE);
-        if (! defined($entry))
-        {
-            next;
-        }
-
-        my $device = (split(/ +/, $entry))[0];
-        if ((! defined($device)) || ($device eq ''))
-        {
-            next;
-        }
-
-        my $status = (split(/ +/, $entry))[2];
-        if ((! defined($status)) || ($status eq ''))
-        {
-            next;
-        }
-
-        if ($status ne 'enabled')
-        {
-            if ((! -w '/proc/acpi/wakeup') ||
-                (! open(FILE, '>', '/proc/acpi/wakeup')))
-            {
-                next;
-            }
-            print FILE $device . "\n";
-            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);
+                }
+            }
          }
      }

=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/05-minimyth-detect-lirc.rules.disabled
     
Sat Nov  7 13:25:49 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/05-minimyth-detect-lirc.rules.disabled
     
Sun Nov  8 10:12:35 2009
@@ -46,6 +46,7 @@
   
#-------------------------------------------------------------------------------
  # non-lirc device list
   
#-------------------------------------------------------------------------------
+  ENV{MODALISA}=="input:b0003v0419p0001e*"             ,  
ENV{mm_detect_state_lirc}="devinput,"
    ENV{MODALIAS}=="usb:v0766p0204d*dc*dsc*dp*ic*isc*ip*",  
ENV{mm_detect_state_lirc}="devinput,/etc/lirc/lircd.conf.d/optional/devinput.usb_0766_0204"
    ENV{MODALIAS}=="usb:v0FE9p9010d*dc*dsc*dp*ic*isc*ip*",  
ENV{mm_detect_state_lirc}="dvico,"
    ENV{MODALIAS}=="usb:v147ApE02Dd*dc*dsc*dp*ic*isc*ip*",  
ENV{mm_detect_state_lirc}="devinput,/etc/lirc/lircd.conf.d/optional/devinput.usb_147a_e02d"

--~--~---------~--~----~------------~-------~--~----~
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