Revision: 5946
Author: pebender
Date: Mon Dec 14 18:28:54 2009
Log: - Switched to lircudevd for supporting multiple remote controls.
- Moved LIRC event device support from lircd to lircudevd.
- Renamed LIRC device ps3bdremote to bdremote.
- Moved starting bdremoteng from lirc.pm to bdremote.pm.


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

Added:
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/bdremote.pm
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/06-minimyth-hotplug-02-lircudevd.rules.disabled
Modified:
  /trunk/gar-minimyth/html/minimyth/document-changelog.txt
  /trunk/gar-minimyth/script/meta/minimyth/files/configure.mk
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-lib-list
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_LIRC.pm
   
/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

=======================================
--- /dev/null
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/bdremote.pm
   
Mon Dec 14 18:28:54 2009
@@ -0,0 +1,53 @@
+################################################################################
+# bdremote
+################################################################################
+package init::bdremote;
+
+use strict;
+use warnings;
+
+use MiniMyth ();
+
+sub start
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    my $device = undef;
+    my $driver = undef;
+
+    my @device_list = split(/ +/,  
$minimyth->var_get('MM_LIRC_DEVICE_LIST'));
+    foreach my $device_item (@device_list)
+    {
+        ($device, $driver, undef) = split(/,/, $device_item);
+        if ($driver eq 'bdremote')
+        {
+            last;
+        }
+    }
+    if ($driver eq 'bdremote')
+    {
+        $minimyth->message_output('info', "starting Sony PS3 Blu-ray Disc  
Remote Control daemon ...");
+
+        my $daemon = '/usr/sbin/bdremoteng';
+        $daemon = $daemon . " -l";
+        $daemon = $daemon . " -E";
+        $daemon = $daemon . " -a $device";
+        $daemon = $daemon . " -t 30";
+        $daemon = $daemon . " -p 8765";
+        system(qq($daemon));
+    }
+    return 1;
+}
+
+sub stop
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    $minimyth->application_stop('bdremoteng', "starting Sony PS3 Blu-ray  
Disc Remote Control daemon ...");
+
+    return 1;
+}
+
+1;
=======================================
--- /dev/null
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/06-minimyth-hotplug-02-lircudevd.rules.disabled
    
Mon Dec 14 18:28:54 2009
@@ -0,0 +1,44 @@
+ACTION=="add", ENV{mm_device_owner}=="?*", GOTO="end"
+
+ACTION!="add|remove", GOTO="end"
+
+KERNEL=="event[0-9]*", SUBSYSTEM=="input", GOTO="begin"
+GOTO="end"
+LABEL="begin"
+
+PROGRAM="mm_device_blacklist lircudevd", RESULT=="yes", GOTO="end"
+
+ATTRS{name}=="lircudevd", GOTO="end"
+
+ATTRS{name}=="lircd", \
+  ENV{lircudevd.enable}="true", \
+  ENV{lircudevd.keymap}="default.keymap"
+
+ATTRS{name}=="bdremoteng", \
+  ENV{lircudevd.enable}="true", \
+  ENV{lircudevd.keymap}="bdremoteng.keymap"
+
+SUBSYSTEMS=="usb", GOTO="begin-usb"
+GOTO="end-usb"
+LABEL="begin-usb"
+ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p"
+ENV{ID_VENDOR}=="05a4", ENV{ID_MODEL}=="9881", \
+  ENV{lircudevd.enable}="true", \
+  ENV{lircudevd.keymap}="03_$env{ID_VENDOR}_$env{ID_MODEL}.keymap"
+ENV{ID_VENDOR}=="0766", ENV{ID_MODEL}=="0204", \
+  ENV{lircudevd.enable}="true", \
+  ENV{lircudevd.keymap}="03_$env{ID_VENDOR}_$env{ID_MODEL}.keymap"
+ENV{ID_VENDOR}=="147a", ENV{ID_MODEL}=="e02d", \
+  ENV{lircudevd.enable}="true", \
+  ENV{lircudevd.keymap}="03_$env{ID_VENDOR}_$env{ID_MODEL}.keymap"
+LABEL="end-usb"
+
+SUBSYSTEMS=="bluetooth", GOTO="begin-bluetooth"
+GOTO="end-bluetooth"
+LABEL="begin-bluetooth"
+
+LABEL="end-bluetooth"
+
+ENV{lircudevd.enable}== "true", ENV{mm_device_owner}="lircudevd"
+
+LABEL="end"
=======================================
--- /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Sun Dec 13  
23:58:23 2009
+++ /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Mon Dec 14  
18:28:54 2009
@@ -5,7 +5,7 @@
  MiniMyth release. For earlier changes see the yearly changelog files.

   
--------------------------------------------------------------------------------
-Changes since 72 (2009-12-13):
+Changes since 72 (2009-12-14):

  Current MythTV versions
      MythTV 0.20-softpad: version 0.20.2.softpad, release-0-20-fixes branch  
svn 16082 and
@@ -53,6 +53,8 @@
        KEY_NUMERIC_n should be mapped to KEY_n by either lircd or lircudevd.
      - Patched bdremote-ng used for bdremote support so that it has an event
        device output.
+    - Switched to lircudevd for supporting multiple remote controls.
+    - Moved event device support from lircd to lircudevd.

  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/configure.mk Tue Dec  1  
09:45:52 2009
+++ /trunk/gar-minimyth/script/meta/minimyth/files/configure.mk Mon Dec 14  
18:28:54 2009
@@ -29,9 +29,10 @@
      audio \
      video \
      bluetooth \
+    bdremote \
      wiimote \
-    irtrans \
      iguanair \
+    irtrans \
      lirc \
      bluetoothd \
      g15daemon \
@@ -47,10 +48,12 @@
      sharpaquos \
      lcdproc \
      g15daemon \
+    bluetoothd \
      lirc \
-    iguanair \
      irtrans \
+    iguanair \
      wiimote \
+    bdremote \
      bluetooth \
      audio \
      media \
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-lib-list   
 
Mon Nov  2 16:31:40 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-lib-list   
 
Mon Dec 14 18:28:54 2009
@@ -9,6 +9,7 @@
  libthread_db.so.1
  mythtv/filters/
  udev/cdrom_id
+udev/usb_id

  # http
  mod_accesslog.so
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_LIRC.pm
       
Thu Dec 10 15:23:03 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_LIRC.pm
       
Mon Dec 14 18:28:54 2009
@@ -34,7 +34,23 @@
          }
          return $value_default;
      },
-    value_valid    => 'yes|no'
+    value_valid    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $value_valid;
+        if ($minimyth->var_get('MM_LIRC_DRIVER') =~ /^irtrans$/)
+        {
+            $value_valid = 'no';
+        }
+        else
+        {
+            $value_valid = 'yes|no';
+        }
+
+        return $value_valid;
+    }
  };
  $var_list{'MM_LIRC_DEVICE_BLACKLIST'} =
  {
@@ -74,7 +90,7 @@
  {
      value_default  => 'none',
      value_valid    => 'none|.+',
-    value_obsolete => 'auto|mceusb2|mceusbnew',
+    value_obsolete => 'auto|mceusb2|mceusbnew|ps3bdremote',
      value_none     => ''
  };
  $var_list{'MM_LIRC_DEVICE'} =
@@ -114,12 +130,12 @@
          my $driver = $minimyth->var_get('MM_LIRC_DRIVER');
          # We cannot test for the Sony PlayStation 3 Blu-ray Disc Remote  
Control device
          # as it uses Bluetooth and is very unlikely to be paired.
-        if      (($driver) &&($driver =~ /^ps3bdremote$/))
+        if      (($driver) && ($driver =~ /^bdremote$/))
          {
              return 1;
          }
          # We cannot test for the LIRC UDP device.
-        elsif (($driver) &&($driver =~ /^udp$/))
+        elsif (($driver) && ($driver =~ /^udp$/))
          {
              return 1;
          }
@@ -546,12 +562,7 @@

          my @device_list;

-        # If the manual LIRC driver is not 'irtrans',
-        # then create LIRC device list.
-        # If the manually configured LIRC driver is 'irtrans',
-        # then the IRTrans server will act as the LIRC device
-        # so no LIRC device list is created.
-        if ($minimyth->var_get('MM_LIRC_DRIVER') ne 'irtrans')
+        # Create the LIRC device list.
          {
              my $device     =  
$minimyth->device_canonicalize($minimyth->var_get('MM_LIRC_DEVICE'));
              my $driver     = $minimyth->var_get('MM_LIRC_DRIVER');
@@ -577,7 +588,7 @@
                      }
                  }
              }
-            # Remove any dumplicates.
+            # Remove any duplicates.
              {
                  my $prev = '';
                  @device_list = grep($_ ne $prev && (($prev) = $_),  
sort(@device_list));
@@ -622,7 +633,7 @@
  };
  $var_list{'MM_LIRC_KERNEL_MODULE_LIST'} =
  {
-    prerequisite   =>  
['MM_LIRC_KERNEL_MODULE', 'MM_LIRC_KERNEL_MODULE_OPTIONS', 
'MM_LIRC_FETCH_LIRCMD_CONF'],
+    prerequisite   =>  
['MM_LIRC_KERNEL_MODULE', 'MM_LIRC_KERNEL_MODULE_OPTIONS', 
'MM_LIRC_AUTO_ENABLED', 'MM_LIRC_DEVICE_LIST', 'MM_LIRC_FETCH_LIRCMD_CONF'],
      value_clean    => sub
      {
          my $minimyth = shift;
@@ -645,6 +656,19 @@
          {
              push(@kernel_modules,  
$minimyth->var_get('MM_LIRC_KERNEL_MODULE'));
          }
+        # Since we have drivers,
+        # MiniMyth will be starting lircd and lircudevd, both of which  
require uinput.
+        if ($minimyth->var_get('MM_LIRC_DEVICE_LIST') ne '')
+        {
+            push(@kernel_modules, 'uinput');
+        }
+        # Since we may detect devices routed through lircudevd in the  
future,
+        # MiniMyth will be starting lircudevd, which requires uinput.
+        if ($minimyth->var_get('MM_LIRC_AUTO_ENABLED') eq 'yes')
+        {
+            push(@kernel_modules, 'uinput');
+        }
+        # lircmd requires uinput.
          if ($minimyth->var_get('MM_LIRC_FETCH_LIRCMD_CONF') eq 'yes')
          {
              push(@kernel_modules, 'uinput');
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Thu Nov 19 16:53:28 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
       
Mon Dec 14 18:28:54 2009
@@ -112,43 +112,14 @@

      my @device_list = split(/ +/,  
$minimyth->var_get('MM_LIRC_DEVICE_LIST'));

-    # There are no remote control devices, so there is no need to continue.
-    if (($#device_list + 1) <= 0)
+    # There are no remote control devices and we will not auto-detect any  
later, so there is no need to continue.
+    if ((($#device_list + 1) <= 0) &&
+        ($minimyth->var_get('MM_LIRC_AUTO_ENABLED') == 'no'))
      {
          return 1;
      }

      $minimyth->message_output('info', "starting remote control(s) ...");
-
-    # Determine master LIRC daemon.
-    # The master LIRC daemon combines the LIRC daemons for multiple LIRC  
devices.
-    # Therefore, if there is more than one LIRC device, then we need a  
master LIRC daemon.
-    my $daemon_master_required = 'no';
-    if (($#device_list + 1) > 1)
-    {
-        $daemon_master_required = 'yes'
-    }
-    foreach my $device_item (@device_list)
-    {
-        my @device_args = split(/,/, $device_item);
-        my $driver = $device_args[1];
-        if ($driver =~ /^ps3bdremote$/)
-        {
-            $daemon_master_required = 'yes'
-        }
-    }
-    my $daemon_master = '';
-    if ($daemon_master_required =~ /^yes$/)
-    {
-        $daemon_master = '/usr/sbin/lircd';
-        $daemon_master = $daemon_master . ' --driver=null';
-        $daemon_master = $daemon_master . ' --output=/var/run/lirc/lircd  
--pidfile=/var/run/lirc/lircd.pid';
-        for (my $index = 0 ; $index <= $#device_list ; $index++)
-        {
-            my $port = 8765 + $index;
-            $daemon_master = $daemon_master . " --connect=localhost:$port"
-        }
-    }

      # Create directories used by the LIRC daemon.
      File::Path::mkpath('/var/lock', { mode => 0755 });
@@ -157,7 +128,6 @@
      chmod(0755, '/var/run/lirc');

      # Enable wakeup and start an LIRC daemon for each device.
-    my $index = 0;
      foreach my $device_item (@device_list)
      {
          my @device_args = split(/,/, $device_item);
@@ -170,8 +140,11 @@
              next;
          }

-        # Convert driver to the the lirc daemon appropriate driver.
-        if    (($driver) && ($driver =~ /^ps3bdremote$/))
+        # Convert the driver to the lirc daemon appropriate driver.
+        if    (($driver) && ($driver =~ /^bdremote$/))
+        {
+        }
+        elsif (($driver) && ($driver =~ /^irtrans$/))
          {
          }
          elsif (($driver) && (open(FILE, '-|', '/usr/sbin/lircd  
--driver=help 2>&1')))
@@ -195,54 +168,27 @@
              $self->_remote_wakeup_enable($device);
          }

-        # Start daemon.
-        my $daemon = '';
-        if ($driver =~ /^ps3bdremote$/)
-        {
-            my $port = 8765 + $index;
-            $daemon = '/usr/sbin/bdremoteng';
-            $daemon = $daemon . " -l";
-            $daemon = $daemon . " -R ':UP'";
-            $daemon = $daemon . " -a $device";
-            $daemon = $daemon . " -t 30";
-            $daemon = $daemon . " -p $port";
-        }
-        else
+        # Start an lircd instance associated with the device the device is
+        # handled by a unless a daemon other than lircd.
+        if ( ($driver !~ /^bdremote$/) &&
+             ($driver !~ /^irtrans$/ ) )
          {
              my $instance = $device;
              $instance =~ s/\/+/~/g;
              $instance =~ s/^~dev~//;
-            if ($daemon_master)
-            {
-                my $port = 8765 + $index;
-                $daemon = '/usr/sbin/lircd';
-                $daemon = $daemon . " --release=:UP";
-                $daemon = $daemon . " --device=$device --driver=$driver";
-                $daemon = $daemon . "  
--output=/var/run/lirc/lircd-$instance  
--pidfile=/var/run/lirc/lircd-$instance.pid";
-                $daemon = $daemon . " --listen=$port";
-                $daemon = $daemon . " $lircd_conf";
-            }
-            else
-            {
-                $daemon = '/usr/sbin/lircd';
-                $daemon = $daemon . " --release=:UP";
-                $daemon = $daemon . " --device=$device --driver=$driver";
-                $daemon = $daemon . ' --output=/var/run/lirc/lircd  
--pidfile=/var/run/lirc/lircd.pid';
-                $daemon = $daemon . " $lircd_conf";
-                 
symlink('/var/run/lirc/lircd', "/var/run/lirc/lircd-$instance");
-            }
-        }
-        $minimyth->message_log('info', "started '$daemon'.");
-        system(qq($daemon));
-
-        $index++;
+            my $daemon = '/usr/sbin/lircd';
+            $daemon = $daemon . " --driver=$driver";
+            $daemon = $daemon . " --device=$device";
+            $daemon = $daemon . " --output=/var/run/lirc/lircd-$instance  
--pidfile=/var/run/lirc/lircd-$instance.pid";
+            $daemon = $daemon . " --uinput";
+            $daemon = $daemon . " $lircd_conf";
+            $minimyth->message_log('info', "started '$daemon'.");
+            system(qq($daemon));
+        }
      }

-    # Start master LIRC daemon.
-    if ($daemon_master)
-    {
-        system(qq($daemon_master));
-    }
+    # Start the lircudevd daemon.
+    system(qq(/usr/sbin/lircudevd --keymap=/etc/lircudevd.d  
--socket=/var/run/lirc/lircd --release=:UP));

      # Start the irexec daemon.
      if ($minimyth->var_get('MM_LIRC_IREXEC_ENABLED') eq 'yes')
@@ -266,6 +212,7 @@

      if ( ($minimyth->application_running('lircmd')) ||
           ($minimyth->application_running('irexec')) ||
+         ($minimyth->application_running('lircudevd')) ||
           ($minimyth->application_running('lircd')) ||
           ($minimyth->application_running('bdremoteng')) )
      {
@@ -273,6 +220,7 @@

          $minimyth->application_stop('lircmd');
          $minimyth->application_stop('irexec');
+        $minimyth->application_stop('lircudevd');
          $minimyth->application_stop('lircd');
          $minimyth->application_stop('bdremoteng');
      }
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/05-minimyth-detect-lirc.rules.disabled
     
Tue Dec  1 09:37:29 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/lib/udev/rules.d/05-minimyth-detect-lirc.rules.disabled
     
Mon Dec 14 18:28:54 2009
@@ -22,11 +22,9 @@

  PROGRAM="mm_device_blacklist lirc", RESULT=="yes", GOTO="end"

-KERNEL=="event[0-9]*",  SUBSYSTEM=="input", SUBSYSTEMS=="usb", GOTO="begin"
-KERNEL=="hiddev[0-9]*", SUBSYSTEM=="usb",   SUBSYSTEMS=="usb", GOTO="begin"
-KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc",  SUBSYSTEMS=="i2c", GOTO="begin"
-KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc",  SUBSYSTEMS=="usb", GOTO="begin"
-KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty",   SUBSYSTEMS=="usb", GOTO="begin"
+KERNEL=="hiddev[0-9]*", SUBSYSTEM=="usb",  SUBSYSTEMS=="usb", GOTO="begin"
+KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc", SUBSYSTEMS=="i2c", GOTO="begin"
+KERNEL=="lirc[0-9]*",   SUBSYSTEM=="lirc", SUBSYSTEMS=="usb", GOTO="begin"
  GOTO="end"
  LABEL="begin"

@@ -46,10 +44,7 @@
   
#-------------------------------------------------------------------------------
  # non-lirc device list
   
#-------------------------------------------------------------------------------
-  ENV{MODALIAS}=="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"
+ENV{MODALIAS}=="usb:v0FE9p9010d*dc*dsc*dp*ic*isc*ip*",  
ENV{mm_detect_state_lirc}="dvico,"

  LABEL="end-nonlirc"

--

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