Author: pebender
Date: Sat Sep 13 12:43:57 2008
New Revision: 3744

Modified:
    trunk/gar-minimyth/html/minimyth/document-changelog.txt
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_game_start
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep_on_ss
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_ss_suspend
    trunk/gar-minimyth/script/perl/perl-MiniMyth/checksums
    trunk/gar-minimyth/script/perl/perl-MiniMyth/files/MiniMyth.pm

Log:
- Changed mm_sleep so that it restarts commands that it stops using the
   original command line not the default command line.
- Changed mm_sleep_on_ss so that it daemonizes.
- Changed mm_ss_suspend so that it daemonizes.



Modified: trunk/gar-minimyth/html/minimyth/document-changelog.txt
==============================================================================
--- trunk/gar-minimyth/html/minimyth/document-changelog.txt     (original)
+++ trunk/gar-minimyth/html/minimyth/document-changelog.txt     Sat Sep 13  
12:43:57 2008
@@ -1,7 +1,7 @@
  MiniMyth Changelog

   
--------------------------------------------------------------------------------
-Changes since 58 (2008-09-11):
+Changes since 58 (2008-09-13):

  Current MythTV versions
      MythTV 0.21:  version 0.21.0,      release-0-21-fixes branch svn 18228.
@@ -9,6 +9,12 @@

  Modified MPlayer SVN version:
      - Changed it to use the external dvdread libraries.
+
+Modified MiniMyth commands
+    - Changed mm_sleep so that it restarts commands that it stops using the
+      original command line not the default command line.
+    - Changed mm_sleep_on_ss so that it daemonizes.
+    - Changed mm_ss_suspend so that it daemonizes.

  Added packages
      lib/libdvdread.

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_game_start
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_game_start
        
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_game_start
        
Sat Sep 13 12:43:57 2008
@@ -4,7 +4,6 @@
  use warnings;

  require File::Basename;
-require File::Spec;
  require MiniMyth;

  my $minimyth = new MiniMyth;
@@ -248,10 +247,7 @@
      }

      # Suspend screen saver while the emulator is running.
-    {
-        my $devnull = File::Spec->devnull;
-        system(qq(/usr/bin/mm_ss_suspend $program > $devnull 2>&1 &));
-    }
+    system(qq(/usr/bin/mm_ss_suspend $program));

      # Run the emulator.
      system(join(' ', $emulator->{'program'}, @{$emulator->{'argument'}},  
qq('$game_file')));

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep    
 
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep    
 
Sat Sep 13 12:43:57 2008
@@ -35,25 +35,55 @@
  $minimyth->x_applications_exit('mythfrontend');

  # Stop LCDd because it can stop working as a result of suspend.
-while ($minimyth->application_running('LCDd'))
+if ($minimyth->application_running('LCDd'))
  {
-    if (open(FILE, '>', "/var/lib/mm_sleep.$$/LCDd")) { close(FILE); }
-    $minimyth->application_stop('LCDd');
+    if (open(FILE, '>', "/var/lib/mm_sleep.$$/LCDd"))
+    {
+        foreach (@{$minimyth->application_cmds('LCDd')})
+        {
+            print FILE "$_\n";
+        }
+        close(FILE);
+    }
+    while ($minimyth->application_running('LCDd'))
+    {
+        $minimyth->application_stop('LCDd');
+    }
  }

  # Stop irexec so that the remote button press used to wake up the frontend
  # does not suspend the frontend.
-while ($minimyth->application_running('irexec'))
+if ($minimyth->application_running('irexec'))
  {
-    if (open(FILE, '>', "/var/lib/mm_sleep.$$/irexec")) { close(FILE); }
-    $minimyth->application_stop('irexec');
+    if (open(FILE, '>', "/var/lib/mm_sleep.$$/irexec"))
+    {
+        foreach (@{$minimyth->application_cmds('irexec')})
+        {
+            print FILE "$_\n";
+        }
+        close(FILE);
+    }
+    while ($minimyth->application_running('irexec'))
+    {
+        $minimyth->application_stop('irexec');
+    }
  }

  # Stop mm_sleep_on_ss so that it does not immediately send the frontend  
back to sleep.
-while ($minimyth->application_running('mm_sleep_on_ss'))
+if ($minimyth->application_running('mm_sleep_on_ss'))
  {
-    if (open(FILE, '>', "/var/lib/mm_sleep.$$/mm_sleep_on_ss")) {  
close(FILE); }
-    $minimyth->application_stop('mm_sleep_on_ss');
+    if (open(FILE, '>', "/var/lib/mm_sleep.$$/mm_sleep_on_ss"))
+    {
+        foreach (@{$minimyth->application_cmds('mm_sleep_on_ss')})
+        {
+            print FILE "$_\n";
+        }
+        close(FILE);
+    }
+    while ($minimyth->application_running('mm_sleep_on_ss'))
+    {
+        $minimyth->application_stop('mm_sleep_on_ss');
+    }
  }

  # Stop X
@@ -80,21 +110,54 @@
  # If mm_sleep_on_ss was running before suspend, then restart it.
  if (-e "/var/lib/mm_sleep.$$/mm_sleep_on_ss")
  {
-    if (! $minimyth->application_running('mm_sleep_on_ss')) {  
system(qq(/usr/bin/mm_sleep_on_ss &)); }
+    if (! $minimyth->application_running('mm_sleep_on_ss'))
+    {
+        if (open(FILE, '<', "/var/lib/mm_sleep.$$/mm_sleep_on_ss"))
+        {
+            while(<FILE>)
+            {
+                chomp;
+                system($_);
+            }
+            close(FILE);
+        }
+    }
      unlink("/var/lib/mm_sleep.$$/mm_sleep_on_ss");
  }

  # If irexec was running before suspend, then restart it.
  if (-e "/var/lib/mm_sleep.$$/irexec")
  {
-    if (! $minimyth->application_running('irexec')) {  
system(qq(/usr/bin/irexec -d /etc/lircrc)); }
+    if (! $minimyth->application_running('irexec'))
+    {
+        if (open(FILE, '<', "/var/lib/mm_sleep.$$/irexec"))
+        {
+            while(<FILE>)
+            {
+                chomp;
+                system($_);
+            }
+            close(FILE);
+        }
+    }
      unlink("/var/lib/mm_sleep.$$/irexec");
  }

  # If LCDd was running before suspend, then restart it.
  if (-e "/var/lib/mm_sleep.$$/LCDd")
  {
-    if (! $minimyth->application_running('LDCd')) {  
system(qq(/usr/sbin/LCDd -c /etc/LCDd.conf)); }
+    if (! $minimyth->application_running('LDCd'))
+    {
+        if (open(FILE, '<', "/var/lib/mm_sleep.$$/LCDd"))
+        {
+            while(<FILE>)
+            {
+                chomp;
+                system($_);
+            }
+            close(FILE);
+        }
+    }
      unlink("/var/lib/mm_sleep.$$/LCDd");
  }


Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep_on_ss
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep_on_ss
       
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep_on_ss
       
Sat Sep 13 12:43:57 2008
@@ -5,6 +5,7 @@

  require File::Spec;
  require MiniMyth;
+require POSIX;

  my $minimyth = new MiniMyth;

@@ -20,6 +21,17 @@
      clean_up();
  }

+sub daemonize
+{
+    chdir('/')                 or die;
+    open(STDIN, '<', $devnull) or die;
+    open(STDOUT,'>', $devnull) or die;
+    defined(my $pid = fork())  or die;
+    die if $pid;
+    POSIX::setsid()            or die;
+    open(STDERR,'>', $devnull) or die;
+}
+
  sub clean_up
  {
      # Use the ps command to list information needed about each process.
@@ -61,6 +73,8 @@
          }
      }
  }
+
+daemonize();

  # Make sure we are root.
  {

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_ss_suspend
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_ss_suspend
        
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_ss_suspend
        
Sat Sep 13 12:43:57 2008
@@ -4,10 +4,24 @@
  use warnings;

  require MiniMyth;
+require POSIX;

  my $program = shift;

  my $minimyth = new MiniMyth;
+
+sub daemonize
+{
+    chdir('/')                 or die;
+    open(STDIN, '<', $devnull) or die;
+    open(STDOUT,'>', $devnull) or die;
+    defined(my $pid = fork())  or die;
+    die if $pid;
+    POSIX::setsid()            or die;
+    open(STDERR,'>', $devnull) or die;
+}
+
+daemonize();

  while ($minimyth->application_running($program))
  {

Modified: trunk/gar-minimyth/script/perl/perl-MiniMyth/checksums
==============================================================================
--- trunk/gar-minimyth/script/perl/perl-MiniMyth/checksums      (original)
+++ trunk/gar-minimyth/script/perl/perl-MiniMyth/checksums      Sat Sep 13  
12:43:57 2008
@@ -1 +1 @@
-5da635408e3e707a8dfab6867603abcf  download/MiniMyth.pm
+b2997d80bcbb345613507c04e5bc63f1  download/MiniMyth.pm

Modified: trunk/gar-minimyth/script/perl/perl-MiniMyth/files/MiniMyth.pm
==============================================================================
--- trunk/gar-minimyth/script/perl/perl-MiniMyth/files/MiniMyth.pm       
(original)
+++ trunk/gar-minimyth/script/perl/perl-MiniMyth/files/MiniMyth.pm      Sat Sep 
 
13 12:43:57 2008
@@ -81,6 +81,31 @@
      return [EMAIL PROTECTED];
  }

+sub application_cmds
+{
+    my $self        = shift;
+    my $application = shift;
+
+    my $pids = join(',', @{$self->application_pids($application)});
+
+    my @cmds = ();
+
+    if ($pids)
+    {
+        if (open(FILE, '-|', "/bin/ps h -p $pids -o cmd"))
+        {
+            while(<FILE>)
+            {
+                chomp;
+                push(@cmds, $_);
+            }
+            close(FILE);
+        }
+    }
+
+    return [EMAIL PROTECTED];
+}
+
  sub application_running
  {
      my $self        = shift;
@@ -2294,7 +2319,7 @@
      $self->application_stop('mm_sleep_on_ss');
      if ($self->var_get('MM_X_SCREENSAVER_HACK') eq 'sleep')
      {
-        system(qq(/usr/bin/mm_sleep_on_ss &));
+        system(qq(/usr/bin/mm_sleep_on_ss));
      }

      return 1;

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