Author: pebender
Date: Mon May 25 20:58:28 2009
New Revision: 4827

Added:
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/aquosserver.pm
    trunk/gar-minimyth/script/perl/perl-Device-SerialPort/   (props changed)
    trunk/gar-minimyth/script/perl/perl-Device-SerialPort/Makefile
    trunk/gar-minimyth/script/perl/perl-Device-SerialPort/checksums
    trunk/gar-minimyth/script/perl/perl-Device-SerialPort/files/
     
trunk/gar-minimyth/script/perl/perl-Device-SerialPort/files/Device-SerialPort-1.04-configure_args.patch
    trunk/gar-minimyth/script/perl/perl-RFLibs/   (props changed)
    trunk/gar-minimyth/script/perl/perl-RFLibs/Makefile
    trunk/gar-minimyth/script/perl/perl-RFLibs/aquosserver
    trunk/gar-minimyth/script/perl/perl-RFLibs/checksums
    trunk/gar-minimyth/script/perl/perl-RFLibs/files/
     
trunk/gar-minimyth/script/perl/perl-RFLibs/files/RFLibs-v2-aquos_flush_fix.patch
    trunk/gar-minimyth/script/system/aquosserver/   (props changed)
    trunk/gar-minimyth/script/system/aquosserver/Makefile
    trunk/gar-minimyth/script/system/aquosserver/checksums
    trunk/gar-minimyth/script/system/aquosserver/files/
    trunk/gar-minimyth/script/system/aquosserver/files/aquosserver
    trunk/gar-minimyth/script/system/aquosserver/files/aquosserver.patch.gar
Removed:
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_external
Modified:
    trunk/gar-minimyth/html/minimyth/conf/minimyth.conf
    trunk/gar-minimyth/html/minimyth/document-changelog.txt
    trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html
    trunk/gar-minimyth/script/meta/minimyth/Makefile
    trunk/gar-minimyth/script/meta/minimyth/files/configure.mk
     
trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-bin-list
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/lirc.d/lircrc/minimyth/optional/key.volume.external
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_EXTERNAL.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/usr/bin/mm_external_on_ss
     
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_sleep
    trunk/gar-minimyth/script/minimyth.conf.mk

Log:
- Improved external equipment control support
     - Sped up external equipment control script by
         - Switched from perl to sh.
         - Switched from one script to one script per external function.
         - Write script during init so that configuration variables do not  
need
           to be read with each script call.
- Added Sharp Aquos external equipment control support
     - Added Ron Frazier's scripts for controlling a Sharp Aquos television
       using its serial interface:
        
<http://mythtvblog.blogspot.com/2009/05/controlling-sharp-aquos-tv-via-serial.html>.
     - Added MM_EXTERNAL_AQUOS_* variables for configuring the external
       control.
- Added packages perl/perl-Device-SerialPort, perl/perl-RFLibs and  
system/aquosserver.




Modified: trunk/gar-minimyth/html/minimyth/conf/minimyth.conf
==============================================================================
--- trunk/gar-minimyth/html/minimyth/conf/minimyth.conf (original)
+++ trunk/gar-minimyth/html/minimyth/conf/minimyth.conf Mon May 25 20:58:28  
2009
@@ -286,6 +286,12 @@
  # MM_EXTERNAL_VOLUME_DOWN
  # MM_EXTERNAL_VOLUME_UP
  # MM_EXTERNAL_VOLUME_MUTE
+# MM_EXTERNAL_AQUOS_ENABLED
+# MM_EXTERNAL_AQUOS_DEVICE
+# MM_EXTERNAL_AQUOS_PORT
+# MM_EXTERNAL_AQUOS_POWER_ENABLED
+# MM_EXTERNAL_AQUOS_POWER_ENABLED
+# MM_EXTERNAL_AQUOS_INPUT
   
################################################################################
  #MM_EXTERNAL_POWER_OFF='
  #     /usr/bin/irsend <television> KEY_POWEROFF ;

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     Mon May 25  
20:58:28 2009
@@ -1,7 +1,7 @@
  MiniMyth Changelog

   
--------------------------------------------------------------------------------
-Changes since 66 (2009-05-24):
+Changes since 66 (2009-05-25):

  Current MythTV versions
      MythTV 0.20-softpad: version 0.20.2.softpad, release-0-20-fixes branch  
svn 16082 and
@@ -61,14 +61,28 @@
      - Changed Wiimote init so that it warns rather than fails when the
        bluetooth device is not present.

-Improved MythV slave backend support.
+Improved external equipment control support
+    - Sped up external equipment control script by
+        - Switched from perl to sh.
+        - Switched from one script to one script per external function.
+        - Write script during init so that configuration variables do not  
need
+          to be read with each script call.
+
+Added Sharp Aquos external equipment control support
+    - Added Ron Frazier's scripts for controlling a Sharp Aquos television
+      using its serial interface:
+       
<http://mythtvblog.blogspot.com/2009/05/controlling-sharp-aquos-tv-via-serial.html>.
+    - Added MM_EXTERNAL_AQUOS_* variables for configuring the external
+      control.
+
+Improved MythV slave backend support
      - Added support for DVB USB devices that make use of the  
dvb-usb-dib0700
        driver.
      - Added firmware autodetection for the Hauppauge WinTV NOVA-TD:
            - USB VendorId:ProductId = 2040:9580.
            - Firmware filename = dvb-usb-dib0700-1.20.fw.

-Improved MythVideo support.
+Improved MythVideo support
      - Added tmdb.pl script to 0.20.2.softpad, 0.20.2 and 0.21.0.

  Improved Xine
@@ -144,6 +158,9 @@
      Added net/vconfig.
      Added nvidia/nvidia-180.51.
      Added nvidia/nvidia-185.18.08.
+    Added perl/perl-Device-SerialPort.
+    Added perl/perl/perl-RFLibs.
+    Added system/aquosserver.
      Added system/irclient.

  Updated packages

Modified: trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html
==============================================================================
--- trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html        
(original)
+++ trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html        Mon May 
25  
20:58:28 2009
@@ -2868,6 +2868,12 @@
              <li><a  
href="#MM_EXTERNAL_VOLUME_DOWN">MM_EXTERNAL_VOLUME_DOWN</a></li>
              <li><a  
href="#MM_EXTERNAL_VOLUME_UP">MM_EXTERNAL_VOLUME_UP</a></li>
              <li><a  
href="#MM_EXTERNAL_VOLUME_MUTE">MM_EXTERNAL_VOLUME_MUTE</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_ENABLED">MM_EXTERNAL_AQUOS_ENABLED</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_DEVICE">MM_EXTERNAL_AQUOS_DEVICE</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_PORT">MM_EXTERNAL_AQUOS_PORT</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_POWER_ENABLED">MM_EXTERNAL_AQUOS_POWER_ENABLED</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_VOLUME_ENABLED">MM_EXTERNAL_AQUOS_VOLUME_ENABLED</a></li>
+            <li><a  
href="#MM_EXTERNAL_AQUOS_INPUT">MM_EXTERNAL_AQUOS_INPUT</a></li>
            </ul>
            <dl>
              <dt id="MM_EXTERNAL-overview"><strong>Overview</strong></dt>
@@ -2928,6 +2934,85 @@
                  must be set.
                </p>
              </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_ENABLED"><strong>MM_EXTERNAL_AQUOS_ENABLED</strong></dt>
+            <dd>
+              <p>
+                Enable control of a Sharp Aquos television using its  
serial interface.
+                Valid values are 'yes' and 'no',
+                with 'yes' the default when <a  
href="#MM_EXTERNAL_AQUOS_DEVICE">'MM_EXTERNAL_AQUOS_DEVICE'</a> is set, and
+                with 'no' the default when <a  
href="#MM_EXTERNAL_AQUOS_DEVICE">'MM_EXTERNAL_AQUOS_DEVICE'</a> is not set.
+              </p>
+              <p>
+                Sharp Aquos television control using its serial interface  
uses
+                <a  
href="http://mythtvblog.blogspot.com/2009/05/controlling-sharp-aquos-tv-via-serial.html";>Ron
  
Frazier's scripts</a>.
+              </p>
+            </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_DEVICE"><strong>MM_EXTERNAL_AQUOS_DEVICE</strong></dt>
+            <dd>
+              <p>
+                Set the serial device connected to the the Sharp Aquos  
television.
+                Valid values are '' and any serial device,
+                with '' the default.
+              </p>
+            </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_PORT"><strong>MM_EXTERNAL_AQUOS_PORT</strong></dt>
+            <dd>
+              <p>
+                Set the TCP/IP port on which the Sharp Aquos server will  
listen for commands.
+                Valid values are any TCP/IP port number,
+                with '4684' the default.
+              </p>
+            </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_POWER_ENABLED"><strong>MM_EXTERNAL_AQUOS_POWER_ENABLED</strong></dt>
+            <dd>
+              <p>
+                Enable MiniMyth to control the power of a Sharp Aquos  
television through its serial interface.
+                Valid values are 'yes' and 'no', with
+                <a  
href="#MM_EXTERNAL_AQUOS_ENABLED">'MM_EXTERNAL_AQUOS_ENABLED'</a>
+                the default.
+              </p>
+              <p>
+                If your Sharp Aquos television has Energy Star enabled  
(the default),
+                then the serial port will be turned off when the  
television is turned off.
+                Therefore, if you want MiniMyth to be able to power on  
your Sharp Aquos television,
+                you will need to disable Energy Star.
+                In order to do this,
+                telnet/ssh into your MiniMyth system that is controlling  
your Sharp Aquos television
+                and run the command
+              </p>
+              <pre>
+                /bin/echo -e "SERIALPOWERUP ENABLE\nEXIT" | /usr/bin/nc  
localhost {port}
+              </pre>
+              <p>
+                where {port} is the value of
+                <a  
href="#MM_EXTERNAL_AQUOS_PORT">'MM_EXTERNAL_AQUOS_PORT'</a>
+              </p>
+            </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_VOLUME_ENABLED"><strong>MM_EXTERNAL_AQUOS_VOLUME_ENABLED</strong></dt>
+            <dd>
+              <p>
+                Enable MiniMyth to control the volume of a Sharp Aquos  
television through its serial interface.
+                Valid values are 'yes' and 'no', with
+                <a  
href="#MM_EXTERNAL_AQUOS_ENABLED">'MM_EXTERNAL_AQUOS_ENABLED'</a>
+                the default.
+              </p>
+            </dd>
+            <dt  
id="MM_EXTERNAL_AQUOS_INPUT"><strong>MM_EXTERNAL_AQUOS_INPUT</strong></dt>
+            <dd>
+              <p>
+                Set the Sharp Aquos television input number to which the  
MiniMyth system is connected.
+                Valid values are '' and any valid Sharp Aquos television  
input number, with '' the default.
+              </p>
+              <p>
+                If the value is set,
+                then MiniMyth will set the Sharp Aquos television's input  
to the value
+                as part of its external equipment power on sequence.
+              </p>
+              <p>
+                If the value is not set,
+                then MiniMyth will not change the Sharp Aquos television's  
input.
+              </p>
+            </dd>
            </dl>
          </div>
          <div id="MM_SSH_SERVER" class="section">
@@ -3164,7 +3249,7 @@
                alt="Valid CSS!"      height="31" width="88" /></a>
          </div>
          <div class="version">
-          Last Updated on 2009-05-21
+          Last Updated on 2009-05-25
            <br />
             
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;
          </div>

Modified: trunk/gar-minimyth/script/meta/minimyth/Makefile
==============================================================================
--- trunk/gar-minimyth/script/meta/minimyth/Makefile    (original)
+++ trunk/gar-minimyth/script/meta/minimyth/Makefile    Mon May 25 20:58:28  
2009
@@ -15,6 +15,7 @@

  DEPENDS = \
        system/acpid \
+       system/aquosserver \
        utils/alsa-utils \
        utils/busybox \
        net/curl \
@@ -53,6 +54,7 @@
        perl/perl-Date-Manip \
        perl/perl-Lchown \
        perl/perl-MiniMyth \
+       perl/perl-RFLibs \
        utils/pmount \
        net/portmap \
        system/powernowd \

Modified: trunk/gar-minimyth/script/meta/minimyth/files/configure.mk
==============================================================================
--- trunk/gar-minimyth/script/meta/minimyth/files/configure.mk  (original)
+++ trunk/gar-minimyth/script/meta/minimyth/files/configure.mk  Mon May 25  
20:58:28 2009
@@ -31,6 +31,7 @@
      lirc \
      g15daemon \
      lcdproc \
+    aquosserver \
      mythtv \
      font \
      backend \
@@ -39,6 +40,7 @@
      x
  MM_INIT_KILL := \
      x \
+    sharpaquos \
      lcdproc \
      g15daemon \
      lirc \

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-bin-list
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-bin-list    
 
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/lists/minimyth-bin-list    
 
Mon May 25 20:58:28 2009
@@ -3,6 +3,7 @@
  alsactl
  amixer
  aplay
+aquosserver
  blkid
  cvt
  curl

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/lirc.d/lircrc/minimyth/optional/key.volume.external
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/lirc.d/lircrc/minimyth/optional/key.volume.external
      
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/lirc.d/lircrc/minimyth/optional/key.volume.external
      
Mon May 25 20:58:28 2009
@@ -4,7 +4,7 @@
  begin
      prog = irexec
      button = KEY_VOLUMEUP
-    config = /usr/bin/mm_external volume_up
+    config = /usr/bin/mm_external_volume_up
      repeat = 2
      delay = 4
  end
@@ -13,7 +13,7 @@
      prog = irexec
      remote = devinput.mcekbd
      button = KEY_F10
-    config = /usr/bin/mm_external volume_up
+    config = /usr/bin/mm_external_volume_up
      repeat = 2
      delay = 4
  end
@@ -21,7 +21,7 @@
  begin
      prog = irexec
      button = KEY_VOLUMEDOWN
-    config = /usr/bin/mm_external volume_down
+    config = /usr/bin/mm_external_volume_down
      repeat = 2
      delay = 4
  end
@@ -30,7 +30,7 @@
      prog = irexec
      remote = devinput.mcekbd
      button = KEY_F9
-    config = /usr/bin/mm_external volume_down
+    config = /usr/bin/mm_external_volume_down
      repeat = 2
      delay = 4
  end
@@ -38,12 +38,12 @@
  begin
      prog = irexec
      button = KEY_MUTE
-    config = /usr/bin/mm_external volume_mute
+    config = /usr/bin/mm_external_volume_mute
  end

  begin
      prog = irexec
      remote = devinput.mcekbd
      button = KEY_F8
-    config = /usr/bin/mm_external volume_mute
+    config = /usr/bin/mm_external_volume_mute
  end

Added:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/aquosserver.pm
==============================================================================
--- (empty file)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/aquosserver.pm
         
Mon May 25 20:58:28 2009
@@ -0,0 +1,37 @@
+################################################################################
+# aquosserver
+################################################################################
+package init::aquosserver;
+
+use strict;
+use warnings;
+
+use MiniMyth ();
+
+sub start
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    if ($minimyth->var_get('MM_EXTERNAL_AQUOS_ENABLED') eq 'yes')
+    {
+        $minimyth->message_output('info', "starting Sharp Aquos  
server...");
+        my $device = $minimyth->var_get('MM_EXTERNAL_AQUOS_DEVICE');
+        my $port   = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+        system("/usr/sbin/aquosserver serialport_device=$device  
listenport=$port 2>&1 | /usr/bin/logger -t aquosserver -p local0.info &");
+    }
+
+    return 1;
+}
+
+sub stop
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    $minimyth->application_stop("aquosserver", "stopping Sharp Aquos  
server ...");
+
+    return 1;
+}
+
+1;

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_EXTERNAL.pm
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_EXTERNAL.pm
    
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_EXTERNAL.pm
    
Mon May 25 20:58:28 2009
@@ -15,12 +15,99 @@

  $var_list{'MM_EXTERNAL_POWER_OFF'} =
  {
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        unlink('/usr/bin/mm_external_power_off');
+
+        if (open(FILE, '>', '/usr/bin/mm_external_power_off'))
+        {
+            chmod(0755, '/usr/bin/mm_external_power_off');
+            print FILE qq(#!/bin/sh\n);
+
+            my $command = $minimyth->var_get($name);
+            if ($command)
+            {
+                print FILE qq($command\n);
+            }
+            close(FILE);
+        }
+        else
+        {
+            $minimyth->message_output('err', "MM_EXTERNAL_POWER_OFF could  
not write '/usr/bin/mm_external_power_off'.");
+            $success = 0;
+        }
+
+        return $success;
+    }
  };
  $var_list{'MM_EXTERNAL_POWER_ON'} =
  {
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        unlink('/usr/bin/mm_external_power_on');
+
+        if (open(FILE, '>', '/usr/bin/mm_external_power_on'))
+        {
+            chmod(0755, '/usr/bin/mm_external_power_on');
+            print FILE qq(#!/bin/sh\n);
+
+            my $command = $minimyth->var_get($name);
+            if ($command)
+            {
+                print FILE qq($command\n);
+            }
+            close(FILE);
+        }
+        else
+        {
+            $minimyth->message_output('err', "MM_EXTERNAL_POWER_ON could  
not write '/usr/bin/mm_external_power_on'.");
+            $success = 0;
+        }
+
+        return $success;
+    }
  };
  $var_list{'MM_EXTERNAL_VOLUME_DOWN'} =
  {
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        unlink('/usr/bin/mm_external_volume_down');
+
+        if (open(FILE, '>', '/usr/bin/mm_external_volume_down'))
+        {
+            chmod(0755, '/usr/bin/mm_external_volume_down');
+            print FILE qq(#!/bin/sh\n);
+
+            my $command = $minimyth->var_get($name);
+            if ($command)
+            {
+                print FILE qq($command\n);
+            }
+            close(FILE);
+        }
+        else
+        {
+            $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_DOWN  
could not write '/usr/bin/mm_external_volume_down'.");
+            $success = 0;
+        }
+
+        return $success;
+    }
  };
  $var_list{'MM_EXTERNAL_VOLUME_UP'} =
  {
@@ -28,18 +115,41 @@
      extra          => sub
      {
          my $minimyth = shift;
+        my $name     = shift;

          my $success = 1;
+
          if ((  $minimyth->var_get('MM_EXTERNAL_VOLUME_UP')) && (!  
$minimyth->var_get('MM_EXTERNAL_VOLUME_DOWN')))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_UP is set  
but MM_EXTERNAL_VOLUME_DOWN is not set.");
-            $success = 0
+            $success = 0;
          }
          if ((! $minimyth->var_get('MM_EXTERNAL_VOLUME_UP')) && (   
$minimyth->var_get('MM_EXTERNAL_VOLUME_DOWN')))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_UP is not  
set but MM_EXTERNAL_VOLUME_DOWN is set.");
-            $success = 0
+            $success = 0;
+        }
+
+        unlink('/usr/bin/mm_external_volume_up');
+
+        if (open(FILE, '>', '/usr/bin/mm_external_volume_up'))
+        {
+            chmod(0755, '/usr/bin/mm_external_volume_up');
+            print FILE qq(#!/bin/sh\n);
+
+            my $command = $minimyth->var_get($name);
+            if ($command)
+            {
+                print FILE qq($command\n);
+            }
+            close(FILE);
+        }
+        else
+        {
+            $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_UP could  
not write '/usr/bin/mm_external_volume_up'.");
+            $success = 0;
          }
+
          return $success;
      }
  };
@@ -49,50 +159,232 @@
      extra          => sub
      {
          my $minimyth = shift;
+        my $name     = shift;

          my $success = 1;
+
          if ((  $minimyth->var_get('MM_EXTERNAL_VOLUME_MUTE')) && (!  
$minimyth->var_get('MM_EXTERNAL_VOLUME_DOWN')))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_MUTE is  
set but MM_EXTERNAL_VOLUME_DOWN is not set.");
-            $success = 0
+            $success = 0;
          }
          if ((  $minimyth->var_get('MM_EXTERNAL_VOLUME_MUTE')) && (!  
$minimyth->var_get('MM_EXTERNAL_VOLUME_UP'  )))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_MUTE is  
set but MM_EXTERNAL_VOLUME_UP is not set.");
-            $success = 0
+            $success = 0;
          }
          if ((! $minimyth->var_get('MM_EXTERNAL_VOLUME_MUTE')) && (   
$minimyth->var_get('MM_EXTERNAL_VOLUME_DOWN')))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_MUTE is  
not set but MM_EXTERNAL_VOLUME_DOWN is set.");
-            $success = 0
+            $success = 0;
          }
          if ((! $minimyth->var_get('MM_EXTERNAL_VOLUME_MUTE')) && (   
$minimyth->var_get('MM_EXTERNAL_VOLUME_UP'  )))
          {
              $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_MUTE is  
not set but MM_EXTERNAL_VOLUME_UP is set.");
-            $success = 0
+            $success = 0;
+        }
+
+        if (open(FILE, '>>', '/usr/bin/mm_external_volume_mute'))
+        {
+            chmod(0755, '/usr/bin/mm_external_volume_mute');
+            print FILE qq(#!/bin/sh\n);
+
+            my $command = $minimyth->var_get($name);
+            if ($command)
+            {
+                print FILE qq($command\n);
+            }
+            close(FILE);
          }
+        else
+        {
+            $minimyth->message_output('err', "MM_EXTERNAL_VOLUME_MUTE  
could not write '/usr/bin/mm_external_volume_mute'.");
+            $success = 0;
+        }
+
          return $success;
      }
  };
-$var_list{'MM_EXTERNAL_VOLUME_ENABLED'} =
+$var_list{'MM_EXTERNAL_AQUOS_ENABLED'} =
  {
-    prerequisite   =>  
['MM_EXTERNAL_VOLUME_DOWN', 'MM_EXTERNAL_VOLUME_UP', 'MM_EXTERNAL_VOLUME_MUTE'],
-    value_default  => sub
+    prerequisite  => ['MM_EXTERNAL_AQUOS_DEVICE'],
+    value_default => sub
      {
          my $minimyth = shift;
+        my $name     = shift;

-        if ((! $minimyth->var_get('MM_EXTERNAL_VOLUME_DOWN')) &&
-            (! $minimyth->var_get('MM_EXTERNAL_VOLUME_UP'  )) &&
-            (! $minimyth->var_get('MM_EXTERNAL_VOLUME_MUTE')))
+        my $default = 'no';
+        if ($minimyth->var_get('MM_EXTERNAL_AQUOS_DEVICE'))
          {
-            return 'no';
+            $default = 'yes';
          }
-        else
+
+        return $default;
+    },
+    value_valid   => 'no|yes'
+};
+$var_list{'MM_EXTERNAL_AQUOS_DEVICE'} =
+{
+    extra         => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $device = $minimyth->var_get($name);
+        if (($device) && (! -e $device))
          {
-            return 'yes';
+            $minimyth->message_output('err', "Serial port device '$device'  
specified by '$name' does not exist.");
+            return 0;
          }
+
+        return 1;
+    }
+};
+$var_list{'MM_EXTERNAL_AQUOS_PORT'} =
+{
+    value_default => '4684',
+    value_valid   => '(\d+)'
+};
+$var_list{'MM_EXTERNAL_AQUOS_POWER_ENABLED'} =
+{
+    prerequisite  =>  
['MM_EXTERNAL_AQUOS_ENABLED', 'MM_EXTERNAL_AQUOS_PORT', 
'MM_EXTERNAL_POWER_OFF', 'MM_EXTERNAL_POWER_ON'],
+    value_default => sub
+    {
+        my $minimyth = shift;
+
+        return $minimyth->var_get('MM_EXTERNAL_AQUOS_ENABLED');
      },
-    value_valid   => 'no|yes'
+    value_valid   => 'no|yes',
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        if ($minimyth->var_get($name) eq 'yes')
+        {
+            if (open(FILE, '>>', '/usr/bin/mm_external_power_off'))
+            {
+                chmod(0755, '/usr/bin/mm_external_power_off');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(/bin/echo -e "POWER OFF\\nEXIT" |  
/usr/bin/nc localhost $port > /dev/null 2>&1\n);
+                close(FILE);
+            }
+            else
+            {
+                 
$minimyth->message_output('err', "MM_EXTERNAL_AQUOS_POWER_ENABLED could not  
write '/usr/bin/mm_external_power_off'.");
+                $success = 0;
+            }
+            if (open(FILE, '>>', '/usr/bin/mm_external_power_on'))
+            {
+                chmod(0755, '/usr/bin/mm_external_power_on');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(/bin/echo -e "POWER ON\\nEXIT" | /usr/bin/nc  
localhost $port > /dev/null 2>&1\n);
+                close(FILE);
+            }
+            else
+            {
+                 
$minimyth->message_output('err', "MM_EXTERNAL_AQUOS_POWER_ENABLED could not  
write '/usr/bin/mm_external_power_on'.");
+                $success = 0;
+            }
+        }
+
+        return $success;
+    }
+};
+$var_list{'MM_EXTERNAL_AQUOS_VOLUME_ENABLED'} =
+{
+    prerequisite  =>  
['MM_EXTERNAL_AQUOS_ENABLED', 'MM_EXTERNAL_AQUOS_PORT', 
'MM_EXTERNAL_VOLUME_DOWN', 'MM_EXTERNAL_VOLUME_UP', 'MM_EXTERNAL_VOLUME_MUTE'],
+    value_default => sub
+    {
+        my $minimyth = shift;
+
+        return $minimyth->var_get('MM_EXTERNAL_AQUOS_ENABLED');
+    },
+    value_valid   => 'no|yes',
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        if ($minimyth->var_get($name) eq 'yes')
+        {
+            if (open(FILE, '>>', '/usr/bin/mm_external_volume_down'))
+            {
+                chmod(0755, '/usr/bin/mm_external_volume_down');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(/bin/echo -e "VOL -\\nEXIT" | /usr/bin/nc  
localhost $port > /dev/null 2>&1\n);
+                close(FILE);
+            }
+            else
+            {
+                 
$minimyth->message_output('err', "MM_EXTERNAL_AQUOS_VOLUME_ENABLED could  
not write '/usr/bin/mm_external_volume_down'.");
+                $success = 0;
+            }
+            if (open(FILE, '>>', '/usr/bin/mm_external_volume_up'))
+            {
+                chmod(0755, '/usr/bin/mm_external_volume_up');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(/bin/echo -e "VOL +\\nEXIT" | /usr/bin/nc  
localhost $port > /dev/null 2>&1\n);
+                close(FILE);
+            }
+            else
+            {
+                 
$minimyth->message_output('err', "MM_EXTERNAL_AQUOS_VOLUME_ENABLED could  
not write '/usr/bin/mm_external_volume_up'.");
+                $success = 0;
+            }
+            if (open(FILE, '>>', '/usr/bin/mm_external_volume_mute'))
+            {
+                chmod(0755, '/usr/bin/mm_external_volume_mute');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(/bin/echo -e "MUTE TOGGLE\\nEXIT" |  
/usr/bin/nc localhost $port > /dev/null 2>&1\n);
+                close(FILE);
+            }
+            else
+            {
+                 
$minimyth->message_output('err', "MM_EXTERNAL_AQUOS_VOLUME_ENABLED could  
not write '/usr/bin/mm_external_volume_mute'.");
+                $success = 0;
+            }
+        }
+
+        return $success;
+    }
+};
+$var_list{'MM_EXTERNAL_AQUOS_INPUT'} =
+{
+    prerequisite  =>  
['MM_EXTERNAL_AQUOS_PORT', 'MM_EXTERNAL_AQUOS_POWER_ENABLED'],
+    value_valid   => '(|\d+)',
+    extra          => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my $success = 1;
+
+        my $input = $minimyth->var_get($name);
+        if ($input)
+        {
+            if (open(FILE, '>>', '/usr/bin/mm_external_power_on'))
+            {
+                chmod(0755, '/usr/bin/mm_external_power_on');
+                my $port = $minimyth->var_get('MM_EXTERNAL_AQUOS_PORT');
+                print FILE qq(while /usr/bin/test `/bin/echo -e "CMD IAVD  
$input\\nEXIT" | /usr/bin/nc localhost $port 2> /dev/null` = 'ERR' ; do\n);
+                print FILE qq(    :\n);
+                print FILE qq(done\n);
+                close(FILE);
+            }
+            else
+            {
+                $minimyth->message_output('err', "MM_EXTERNAL_AQUOS_INPUT  
could not write '/usr/bin/mm_external_power_on'.");
+                $success = 0;
+            }
+        }
+
+        return $success;
+    }
  };

  1;

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
        
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/lirc.pm
        
Mon May 25 20:58:28 2009
@@ -241,7 +241,9 @@
                      }
                  }
                  # Add files for the volume key(s).
-                if ($minimyth->var_get('MM_EXTERNAL_VOLUME_ENABLED')  
eq 'yes')
+                if ((-e q(/usr/bin/mm_external_volume_down)) &&
+                    (-e q(/usr/bin/mm_external_volume_up)  ) &&
+                    (-e q(/usr/bin/mm_external_volume_mute)))
                  {
                      if (-f  
qq($application_path/optional/key.volume.external))
                      {

Modified:  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_external_on_ss
==============================================================================
---  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_external_on_ss
    
(original)
+++  
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/usr/bin/mm_external_on_ss
    
Mon May 25 20:58:28 2009
@@ -37,12 +37,12 @@

  sub power_off
  {
-    system(qq(/usr/bin/mm_external power_off));
+    system(qq(/usr/bin/mm_external_power_off));
  }

  sub power_on
  {
-    system(qq(/usr/bin/mm_external power_on));
+    system(qq(/usr/bin/mm_external_power_on));
  }

  my @job_queue :shared = ();

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    
 
Mon May 25 20:58:28 2009
@@ -24,7 +24,7 @@
  File::Path::mkpath("/var/lib/mm_sleep.$$", { mode => 0755 });

  # Turn off any external equipment.
-system(qq(/usr/bin/mm_external power_off));
+system(qq(/usr/bin/mm_external_power_off));

  # Stop all X applications, except mythfrontend and applications started by  
xinit.
  $minimyth->x_applications_exit(':everything');
@@ -168,7 +168,7 @@
  }

  # Turn on any external equipment.
-system(qq(/usr/bin/mm_external power_on));
+system(qq(/usr/bin/mm_external_power_on));

  # Remove the state directory for mm_sleep.
  File::Path::rmtree("/var/lib/mm_sleep.$$");

Modified: trunk/gar-minimyth/script/minimyth.conf.mk
==============================================================================
--- trunk/gar-minimyth/script/minimyth.conf.mk  (original)
+++ trunk/gar-minimyth/script/minimyth.conf.mk  Mon May 25 20:58:28 2009
@@ -18,7 +18,7 @@
                                )

  # Configuration file (minimyth.conf) version.
-mm_CONF_VERSION           ?= 44
+mm_CONF_VERSION           ?= 45

   
#-------------------------------------------------------------------------------
  # Variables that you are likely to be override based on your environment.

Added: trunk/gar-minimyth/script/perl/perl-Device-SerialPort/Makefile
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/perl/perl-Device-SerialPort/Makefile      Mon May 
 
25 20:58:28 2009
@@ -0,0 +1,9 @@
+GARNAME             = perl-Device-SerialPort
+GARVERSION          = 1.04
+MASTER_SITES        = http://www.cpan.org/authors/id/C/CO/COOK/
+PERL_MODULE_PATCHES = configure_args.patch
+PERL_MODULE_SO      = true
+
+include ../../perl/perl/perl-module.mk
+
+CONFIGURE_ARGS += CONFIGURE_ARGS="$(DIRPATHS) --build=$(GARBUILD)  
--host=$(GARHOST)"

Added: trunk/gar-minimyth/script/perl/perl-Device-SerialPort/checksums
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/perl/perl-Device-SerialPort/checksums     Mon May 
 
25 20:58:28 2009
@@ -0,0 +1,2 @@
+82c698151f934eb28c65d1838cee7d9e  download/Device-SerialPort-1.04.tar.gz
+da28dcfad581f9c38c0ec62aa7066800   
download/Device-SerialPort-1.04-configure_args.patch

Added:  
trunk/gar-minimyth/script/perl/perl-Device-SerialPort/files/Device-SerialPort-1.04-configure_args.patch
==============================================================================
--- (empty file)
+++  
trunk/gar-minimyth/script/perl/perl-Device-SerialPort/files/Device-SerialPort-1.04-configure_args.patch
  
Mon May 25 20:58:28 2009
@@ -0,0 +1,30 @@
+diff -Naur Device-SerialPort-1.04-old/Makefile.PL  
Device-SerialPort-1.04-new/Makefile.PL
+--- Device-SerialPort-1.04-old/Makefile.PL     2007-07-20 10:27:38.000000000  
-0700
++++ Device-SerialPort-1.04-new/Makefile.PL     2009-05-24 19:37:21.000000000  
-0700
+@@ -3,6 +3,7 @@
+ use warnings;
+ use ExtUtils::MakeMaker;
+
++my $CONFIGURE_ARGS;
+ my @SERIALS;
+
+ # Scan for argument we know about
+@@ -13,6 +14,9 @@
+               if ($key eq "TESTPORT") {
+                       push(@SERIALS,$value);
+               }
++              elsif ($key eq "CONFIGURE_ARGS") {
++                      $CONFIGURE_ARGS=$value;
++              }
+               else {
+                       push(@passargs,$arg);
+               }
+@@ -134,7 +138,7 @@
+
+ # Prepare config.h
+ print "Running ./configure ...\n";
+-system("./configure");
++system("./configure $CONFIGURE_ARGS");
+ if ($? != 0) {
+         die <<EOM;
+ The 'configure' script didn't like something.  It should have told you

Added: trunk/gar-minimyth/script/perl/perl-RFLibs/Makefile
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/perl/perl-RFLibs/Makefile Mon May 25 20:58:28  
2009
@@ -0,0 +1,30 @@
+GARNAME      = perl-RFLibs
+GARVERSION   = v2
+CATEGORIES   = perl
+MASTER_SITES = http://www.ronfrazier.net/mythtv/downloads/
+DISTFILES    = RFLibs_$(GARVERSION).tar.gz
+PATCHFILES   = RFLibs-$(GARVERSION)-aquos_flush_fix.patch
+LICENSE      =
+
+DESCRIPTION =
+define BLURB
+endef
+
+DEPENDS = perl/perl perl/perl-Device-SerialPort
+
+WORKSRC = $(WORKDIR)/mnt/mythfe-livingroom/setup-files/scripts
+
+INSTALL_SCRIPTS = RFLibs
+
+GAR_EXTRA_CONF += perl/perl/package-api.mk
+include ../../gar.mk
+
+install-RFLibs:
+       @mkdir -p $(DESTDIR)$(PERL_sitelib)
+       @rm -rf $(DESTDIR)$(PERL_sitelib)/RFLibs
+       @mkdir -p $(DESTDIR)$(PERL_sitelib)/RFLibs
+       @cp $(WORKSRC)/RFLibs/Aquos.pm $(DESTDIR)$(PERL_sitelib)/RFLibs/Aquos.pm
+       @cp $(WORKSRC)/RFLibs/IOSelectBuffered.pm  
$(DESTDIR)$(PERL_sitelib)/RFLibs/IOSelectBuffered.pm
+       @chmod 755 $(DESTDIR)$(PERL_sitelib)/RFLibs
+       @chmod 644 $(DESTDIR)$(PERL_sitelib)/RFLibs/*
+       @$(MAKECOOKIE)

Added: trunk/gar-minimyth/script/perl/perl-RFLibs/aquosserver
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/perl/perl-RFLibs/aquosserver      Mon May 25  
20:58:28 2009
@@ -0,0 +1,197 @@
+#!/usr/bin/perl
+
+################################################################################
+#
+#       Created by Ronald Frazier
+#       http://www.ronfrazier.net
+#
+#       Feel free to do anything you want with this, as long as you
+#       include the above attribution.
+#
+################################################################################
+
+use strict;
+use IO::Socket::INET;
+use RFLibs::IOSelectBuffered;
+use RFLibs::Aquos;
+
+my $listenport = 4684;
+my $serialport_device = '/dev/ttyS2';
+
+$|=1;
+
+my $aquos = new RFLibs::Aquos($serialport_device);
+
+my $listensocket = new IO::Socket::INET (
+       LocalPort => $listenport,
+       Proto => 'tcp',
+       Listen => 1,
+       Reuse => 1,
+       Blocking => 1
+       );
+die ("Could not create socket: $!") unless $listensocket;
+
+
+my $select = new RFLibs::IOSelectBuffered($listensocket);
+
+while(my @ready = $select->can_read())
+{
+       return unless scalar(@ready);
+       foreach my $handle (@ready)
+       {
+               #open a socket for the newly connected client
+               if ($handle == $listensocket)
+               {
+                       my $client = $listensocket->accept();
+                       $client->autoflush(1);
+                       $select->add($client);
+
+                       next;
+               };
+
+               #read the next line and test for error, EOF, socket disconnect, 
or just  
partial lines
+               my $line = $select->getline($handle);
+               if (!defined($line))
+               {
+                       $select->remove($handle);
+                       $handle->close();
+                       next;
+               };
+               next if $line eq '';
+
+               $line =~ s/[\n\r\f]+$//ms;
+
+               if ($line eq 'EXIT')
+               {
+                       $select->remove($handle);
+                       $handle->close();
+                       next;
+               };
+
+               my $result = processLine($line);
+               syswrite($handle, "$result\n");
+       };
+};
+print "EXITING\n";
+exit;
+       
+sub processLine
+{
+       my ($line) = @_;
+
+       if ($line =~ /^VOL[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq '+')
+               {
+                       return $aquos->adjust_volume(1);
+               }
+               elsif ($param eq '-')
+               {
+                       return $aquos->adjust_volume(-1);
+               }
+               elsif ($param =~ /^\d+$/)
+               {
+                       return $aquos->volume($param);
+               }
+               else
+               {
+                       return $aquos->volume();
+               };
+       }
+       elsif ($line =~ /^MUTE[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ON')
+               {
+                       return $aquos->mute(1);
+               }
+               elsif ($param eq 'OFF')
+               {
+                       return $aquos->mute(0);
+               }
+               elsif ($param eq 'TOGGLE')
+               {
+                       return $aquos->toggle_mute();
+               }
+               else
+               {
+                       return $aquos->mute();
+               };
+       }
+       elsif ($line =~ /^POWER[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ON')
+               {
+                       return $aquos->power(1);
+               }
+               elsif ($param eq 'OFF')
+               {
+                       return $aquos->power(0);
+               }
+               elsif ($param eq 'TOGGLE')
+               {
+                       my $state = $aquos->power() ? 0 : 1;
+                       return $aquos->power($state);
+               }
+               else
+               {
+                       return $aquos->power();
+               };
+       }
+       elsif ($line =~ /^INPUT[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param =~ /^\d+$/)
+               {
+                       return $aquos->input($param);
+               }
+               else
+               {
+                       return $aquos->input();
+               };
+       }
+       elsif ($line =~ /^SERIALPOWERUP[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ENABLE')
+               {
+                       return $aquos->enable_serial_powerup(1);
+               }
+               elsif ($param eq 'DISABLE')
+               {
+                       return $aquos->enable_serial_powerup(0);
+               }
+               else
+               {
+                       #this doesn't seem to work
+                       return $aquos->enable_serial_powerup();
+               };
+       }
+       elsif ($line =~ /^DEBUG[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param ne '')
+               {
+                       return $aquos->debug($param);
+               }
+               else
+               {
+                       return $aquos->debug();
+               };
+       }
+       elsif ($line =~ /^CMD[_ ]?(.{4})\s*(.*)/)
+       {
+               my $code = $1;
+               my $param = $2;
+               if ($param ne '')
+               {
+                       return $aquos->set($code, $param);
+               }
+               else
+               {
+                       return $aquos->get($code);
+               };
+       };
+};

Added: trunk/gar-minimyth/script/perl/perl-RFLibs/checksums
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/perl/perl-RFLibs/checksums        Mon May 25  
20:58:28 2009
@@ -0,0 +1,2 @@
+270f481f8a162a668d24a882d1684097  download/RFLibs_v2.tar.gz
+07cb2e692a558e5cb2ddfba82acebd1a  download/RFLibs-v2-aquos_flush_fix.patch

Added:  
trunk/gar-minimyth/script/perl/perl-RFLibs/files/RFLibs-v2-aquos_flush_fix.patch
==============================================================================
--- (empty file)
+++  
trunk/gar-minimyth/script/perl/perl-RFLibs/files/RFLibs-v2-aquos_flush_fix.patch
         
Mon May 25 20:58:28 2009
@@ -0,0 +1,14 @@
+diff -Naur RFLibs-v2-old/RFLibs/Aquos.pm RFLibs-v2-new/RFLibs/Aquos.pm
+--- RFLibs-v2-old/RFLibs/Aquos.pm      2009-05-25 15:11:07.000000000 -0700
++++ RFLibs-v2-new/RFLibs/Aquos.pm      2009-05-25 15:10:54.000000000 -0700
+@@ -191,8 +191,8 @@
+       while(1)
+       {
+               my ($bytes, $read) = $self->{port}->read(1);
+-              last if $read == 0;
+-              $self->debugprint('WARN', "$read byte(s) -->$bytes<-- cleared 
from  
buffer\n");
++              last if $bytes == 0;
++              $self->debugprint('WARN', "$bytes byte(s) -->$read<-- cleared 
from  
buffer\n");
+       };
+
+

Added: trunk/gar-minimyth/script/system/aquosserver/Makefile
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/system/aquosserver/Makefile       Mon May 25  
20:58:28 2009
@@ -0,0 +1,29 @@
+GARNAME = aquosserver
+GARVERSION =
+CATEGORIES = system
+#MASTER_SITES = http://www.ronfrazier.net/mythtv/downloads/
+DISTFILES = $(GARNAME)
+PATCHFILES = $(GARNAME).patch.gar
+LICENSE =
+
+DESCRIPTION =
+define BLURB
+endef
+
+DEPENDS = perl/perl perl/perl-RFLibs
+
+INSTALL_SCRIPTS = $(GARNAME)
+
+include ../../gar.mk
+
+extract-$(GARNAME):
+       @mkdir -p $(WORKSRC)
+       @rm -f $(WORKSRC)/$(GARNAME)
+       @cp $(DOWNLOADDIR)/$(GARNAME)  $(WORKSRC)/$(GARNAME)
+       @chmod 755 $(WORKSRC)/$(GARNAME)
+       @$(MAKECOOKIE)
+
+install-$(GARNAME):
+       @mkdir -p $(DESTDIR)$(sbindir)
+       @cp -f $(WORKSRC)/$(GARNAME) $(DESTDIR)$(sbindir)/$(GARNAME)
+       @$(MAKECOOKIE)

Added: trunk/gar-minimyth/script/system/aquosserver/checksums
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/system/aquosserver/checksums      Mon May 25  
20:58:28 2009
@@ -0,0 +1,2 @@
+91f16b4400a2782d2f4a18fa89463073  download/aquosserver
+c5064015eef64c6fd967623b15348d6c  download/aquosserver.patch.gar

Added: trunk/gar-minimyth/script/system/aquosserver/files/aquosserver
==============================================================================
--- (empty file)
+++ trunk/gar-minimyth/script/system/aquosserver/files/aquosserver      Mon May 
 
25 20:58:28 2009
@@ -0,0 +1,197 @@
+#!/usr/bin/perl
+
+################################################################################
+#
+#       Created by Ronald Frazier
+#       http://www.ronfrazier.net
+#
+#       Feel free to do anything you want with this, as long as you
+#       include the above attribution.
+#
+################################################################################
+
+use strict;
+use IO::Socket::INET;
+use RFLibs::IOSelectBuffered;
+use RFLibs::Aquos;
+
+my $listenport = 4684;
+my $serialport_device = '/dev/ttyS2';
+
+$|=1;
+
+my $aquos = new RFLibs::Aquos($serialport_device);
+
+my $listensocket = new IO::Socket::INET (
+       LocalPort => $listenport,
+       Proto => 'tcp',
+       Listen => 1,
+       Reuse => 1,
+       Blocking => 1
+       );
+die ("Could not create socket: $!") unless $listensocket;
+
+
+my $select = new RFLibs::IOSelectBuffered($listensocket);
+
+while(my @ready = $select->can_read())
+{
+       return unless scalar(@ready);
+       foreach my $handle (@ready)
+       {
+               #open a socket for the newly connected client
+               if ($handle == $listensocket)
+               {
+                       my $client = $listensocket->accept();
+                       $client->autoflush(1);
+                       $select->add($client);
+
+                       next;
+               };
+
+               #read the next line and test for error, EOF, socket disconnect, 
or just  
partial lines
+               my $line = $select->getline($handle);
+               if (!defined($line))
+               {
+                       $select->remove($handle);
+                       $handle->close();
+                       next;
+               };
+               next if $line eq '';
+
+               $line =~ s/[\n\r\f]+$//ms;
+
+               if ($line eq 'EXIT')
+               {
+                       $select->remove($handle);
+                       $handle->close();
+                       next;
+               };
+
+               my $result = processLine($line);
+               syswrite($handle, "$result\n");
+       };
+};
+print "EXITING\n";
+exit;
+       
+sub processLine
+{
+       my ($line) = @_;
+
+       if ($line =~ /^VOL[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq '+')
+               {
+                       return $aquos->adjust_volume(1);
+               }
+               elsif ($param eq '-')
+               {
+                       return $aquos->adjust_volume(-1);
+               }
+               elsif ($param =~ /^\d+$/)
+               {
+                       return $aquos->volume($param);
+               }
+               else
+               {
+                       return $aquos->volume();
+               };
+       }
+       elsif ($line =~ /^MUTE[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ON')
+               {
+                       return $aquos->mute(1);
+               }
+               elsif ($param eq 'OFF')
+               {
+                       return $aquos->mute(0);
+               }
+               elsif ($param eq 'TOGGLE')
+               {
+                       return $aquos->toggle_mute();
+               }
+               else
+               {
+                       return $aquos->mute();
+               };
+       }
+       elsif ($line =~ /^POWER[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ON')
+               {
+                       return $aquos->power(1);
+               }
+               elsif ($param eq 'OFF')
+               {
+                       return $aquos->power(0);
+               }
+               elsif ($param eq 'TOGGLE')
+               {
+                       my $state = $aquos->power() ? 0 : 1;
+                       return $aquos->power($state);
+               }
+               else
+               {
+                       return $aquos->power();
+               };
+       }
+       elsif ($line =~ /^INPUT[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param =~ /^\d+$/)
+               {
+                       return $aquos->input($param);
+               }
+               else
+               {
+                       return $aquos->input();
+               };
+       }
+       elsif ($line =~ /^SERIALPOWERUP[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param eq 'ENABLE')
+               {
+                       return $aquos->enable_serial_powerup(1);
+               }
+               elsif ($param eq 'DISABLE')
+               {
+                       return $aquos->enable_serial_powerup(0);
+               }
+               else
+               {
+                       #this doesn't seem to work
+                       return $aquos->enable_serial_powerup();
+               };
+       }
+       elsif ($line =~ /^DEBUG[_ ]?(.*)/)
+       {
+               my $param = $1;
+               if ($param ne '')
+               {
+                       return $aquos->debug($param);
+               }
+               else
+               {
+                       return $aquos->debug();
+               };
+       }
+       elsif ($line =~ /^CMD[_ ]?(.{4})\s*(.*)/)
+       {
+               my $code = $1;
+               my $param = $2;
+               if ($param ne '')
+               {
+                       return $aquos->set($code, $param);
+               }
+               else
+               {
+                       return $aquos->get($code);
+               };
+       };
+};

Added:  
trunk/gar-minimyth/script/system/aquosserver/files/aquosserver.patch.gar
==============================================================================
--- (empty file)
+++  
trunk/gar-minimyth/script/system/aquosserver/files/aquosserver.patch.gar        
 
Mon May 25 20:58:28 2009
@@ -0,0 +1,34 @@
+diff -Naur aquosserver-old/aquosserver aquosserver-new/aquosserver
+--- aquosserver-old/aquosserver        2009-05-04 06:46:03.000000000 -0700
++++ aquosserver-new/aquosserver        2009-05-24 20:11:06.000000000 -0700
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
+...@gar_bindir@/perl
+
+  
################################################################################
+ #
+@@ -18,11 +18,24 @@
+ my $listenport = 4684;
+ my $serialport_device = '/dev/ttyS2';
+
++if (@ARGV) {
++      foreach my $arg (@ARGV) {
++              my ($key,$value)=split /=/, $arg, 2;
++              if ($key eq "listenport") {
++                      $listenport = $value;
++              }
++              elsif ($key eq "serialport_device") {
++                      $serialport_device = $value;
++              }
++      }
++}
++
+ $|=1;
+
+ my $aquos = new RFLibs::Aquos($serialport_device);
+
+ my $listensocket = new IO::Socket::INET (
++      LocalAddr => 'localhost',
+       LocalPort => $listenport,
+       Proto => 'tcp',
+       Listen => 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