Revision: 5785
Author: pebender
Date: Thu Nov  5 18:59:16 2009
Log: - Separate Bluetooth init from Wiimote init.
- Added MM_BLUETOOTH_DEVICE_LIST for specifying the Bluetooth devices to  
init.


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

Added:
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/bluetooth.pm
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_BLUETOOTH.pm
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/files/configure.mk
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_HARDWARE.pm
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_WIIMOTE.pm
   
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm

=======================================
--- /dev/null
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/bluetooth.pm
  
Thu Nov  5 18:59:16 2009
@@ -0,0 +1,49 @@
+################################################################################
+# bluetooth
+################################################################################
+package init::bluetooth;
+
+use strict;
+use warnings;
+
+use File::Spec ();
+use MiniMyth ();
+
+sub start
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    if ($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST'))
+    {
+        $minimyth->message_output('info', "starting bluetooth ...");
+
+        my $devnull = File::Spec->devnull;
+
+        my @devices = split(/ +/,  
$minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST'));
+
+        foreach my $device (@devices)
+        {
+            if (system(qq(/usr/sbin/hciconfig $device up > $devnull  
2>&1)) != 0)
+            {
+                $minimyth->message_output('err', "configuration of  
bluetooth device '$device' failed.");
+                return 0;
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+sub stop
+{
+    my $self     = shift;
+    my $minimyth = shift;
+
+    $minimyth->application_stop('hciconfg', "stopping hciconfig ...");
+
+    return 1;
+}
+
+1;
=======================================
--- /dev/null
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_BLUETOOTH.pm
  
Thu Nov  5 18:59:16 2009
@@ -0,0 +1,67 @@
+################################################################################
+# MM_BLUETOOTH configuration variable handlers.
+################################################################################
+package init::conf::MM_BLUETOOTH;
+
+use strict;
+use warnings;
+
+my %var_list;
+
+sub var_list
+{
+    return \%var_list;
+}
+
+$var_list{'MM_BLUETOOTH_DEVICE_LIST'} =
+{
+    value_default  => 'auto',
+    value_valid    => 'auto|none|.+',
+    value_auto     => sub
+    {
+        my @devices = ();
+        if ((-e '/sys/class/bluetooth') &&  
(opendir(DIR, '/sys/class/bluetooth')))
+        {
+            foreach (grep(! /\./, (readdir(DIR))))
+            {
+
+                push(@devices, $_);
+            }
+            closedir(DIR);
+        }
+
+        return join(' ', @devices);
+    },
+    value_none     => ''
+};
+$var_list{'MM_BLUETOOTH_KERNEL_MODULE_LIST'} =
+{
+    prerequisite   => ['MM_BLUETOOTH_DEVICE_LIST'],
+    value_clean    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        $minimyth->var_set($name, 'auto');
+
+        return 1;
+    },
+    value_default  => 'auto',
+    value_valid    => 'auto',
+    value_auto     => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        my @kernel_modules = ();
+
+        if ($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST'))
+        {
+            push(@kernel_modules, 'uinput');
+        }
+
+        return join(' ', @kernel_modules);
+    }
+};
+
+1;
=======================================
--- /trunk/gar-minimyth/html/minimyth/conf/minimyth.conf        Thu Oct 22  
15:58:03 2009
+++ /trunk/gar-minimyth/html/minimyth/conf/minimyth.conf        Thu Nov  5  
18:59:16 2009
@@ -251,6 +251,12 @@
  # MM_GAME_GAME_ROOT
   
################################################################################

+################################################################################
+# Bluetooth configuration variables.
+#
+# MM_BLUETOOTH_DEVICE_LIST
+################################################################################
+
   
################################################################################
  # Wii remote control configuration variables.
  #
=======================================
--- /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Wed Nov  4  
22:34:02 2009
+++ /trunk/gar-minimyth/html/minimyth/document-changelog.txt    Thu Nov  5  
18:59:16 2009
@@ -5,7 +5,7 @@
  MiniMyth release. For earlier changes see the yearly changelog files.

   
--------------------------------------------------------------------------------
-Changes since 71 (2009-11-04):
+Changes since 71 (2009-11-05):

  Current MythTV versions
      MythTV 0.20-softpad: version 0.20.2.softpad, release-0-20-fixes branch  
svn 16082 and
@@ -17,6 +17,11 @@
      MythTV 0.22:         version 0.22.0,         release-0-22-fixes branch  
svn 22659.
      MythTV trunk:        version trunk.22658     trunk svn 22658.

+Improved init
+    - Separate Bluetooth init from Wiimote init.
+    - Added MM_BLUETOOTH_DEVICE_LIST for specifying the Bluetooth devices  
to
+      init.
+
  Improved MythV slave backend support
      - Added firmware autodetection for the Hauppauge WinTV-HVR-2200 and
        WinTV-HVR-2250.
=======================================
--- /trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html       Tue Nov 
  
3 21:48:14 2009
+++ /trunk/gar-minimyth/html/minimyth/document-minimyth_conf.html       Thu Nov 
  
5 18:59:16 2009
@@ -48,6 +48,7 @@
              <li><a href="#MM_THEME">Configuration variables for:  
themes</a></li>
              <li><a href="#MM_MEDIA">Configuration variables for: media  
directories</a></li>
              <li><a href="#MM_GAME">Configuration variables for:  
games</a></li>
+            <li><a href="#MM_BLUETOOTH">Configuration variables for:  
Bluetooth</a></li>
              <li><a href="#MM_WIIMOTE">Configuration variables for: Wii  
remote control</a></li>
              <li><a href="#MM_LIRC">Configuration variables for:  
LIRC</a></li>
              <li><a href="#MM_LCDPROC">Configuration variables for:  
LCDproc</a></li>
@@ -2459,6 +2460,36 @@
                <p>
                  However, depending on the included game console emulators,  
other values may be needed.
                </p>
+            </dd>
+          </dl>
+        </div>
+        <div id="MM_BLUETOOTH" class="section">
+          <div class="heading">Configuration variables for: Bluetooth</div>
+          <ul>
+            <li><a href="#MM_BLUETOOTH-overview">Overview</a></li>
+          </ul>
+          <ul>
+            <li><a  
href="#MM_BLUETOOTH_DEVICE_LIST">MM_BLUETOOTH_DEVICE_LIST</a></li>
+          </ul>
+          <dl>
+            <dt id="MM_BLUETOOTH-overview"><strong>Overview</strong></dt>
+            <dd>
+              <p>
+                Bluetooth related configuration variables.
+              </p>
+            </dd>
+            <dt  
id="MM_BLUETOOTH_DEVICE_LIST"><strong>MM_BLUETOOTH_DEVICE_LIST</strong></dt>
+            <dd>
+              <p>
+                The list of Bluetooth host controller interface devices to  
be configured.
+                Valid values are /
+                Valid values are the Bluetooth devices in  
directory '/sys/class/bluetooth', 'none' and 'auto',
+                with 'auto' the default.
+              </p>
+              <p>
+                If the value is 'auto',
+                then MiniMyth will set MM_BLUETOOTH_DEVICE_LIST to a list  
of all devices in directory '/sys/class/bluetooth'.
+              </p>
              </dd>
            </dl>
          </div>
@@ -3443,7 +3474,7 @@
                alt="Valid CSS!"      height="31" width="88" /></a>
          </div>
          <div class="version">
-          Last Updated on 2009-11-03
+          Last Updated on 2009-11-05
            <br />
             
&lt;&nbsp;mailto&nbsp;:&nbsp;webmaster&nbsp;at&nbsp;minimyth&nbsp;dot&nbsp;org&nbsp;&gt;
          </div>
=======================================
--- /trunk/gar-minimyth/script/meta/minimyth/files/configure.mk Fri Oct  9  
13:44:36 2009
+++ /trunk/gar-minimyth/script/meta/minimyth/files/configure.mk Thu Nov  5  
18:59:16 2009
@@ -12,7 +12,6 @@
      console \
      telnet \
      ssh_server \
-    mythdb_buffer_create \
      cron \
      game \
      master \
@@ -27,6 +26,7 @@
      media \
      audio \
      video \
+    bluetooth \
      wiimote \
      irtrans \
      iguanair \
@@ -38,7 +38,6 @@
      font \
      backend \
      gtk \
-    mythdb_buffer_delete \
      x
  MM_INIT_KILL := \
      x \
@@ -49,6 +48,7 @@
      iguanair \
      irtrans \
      wiimote \
+    bluetooth \
      audio \
      media \
      web \
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_HARDWARE.pm
   
Thu Jun 11 21:31:51 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_HARDWARE.pm
   
Thu Nov  5 18:59:16 2009
@@ -15,7 +15,7 @@

  $var_list{'MM_HARDWARE_KERNEL_MODULE_LIST'} =
  {
-    prerequisite   =>  
['MM_CPU_KERNEL_MODULE_LIST', 'MM_LCDPROC_KERNEL_MODULE_LIST', 
'MM_LIRC_KERNEL_MODULE_LIST', 'MM_PLUGIN_KERNEL_MODULE_LIST', 
'MM_WIIMOTE_KERNEL_MODULE_LIST', 'MM_X_KERNEL_MODULE_LIST'],
+    prerequisite   =>  
['MM_BLUETOOTH_KERNEL_MODULE_LIST', 'MM_CPU_KERNEL_MODULE_LIST', 
'MM_LCDPROC_KERNEL_MODULE_LIST', 'MM_LIRC_KERNEL_MODULE_LIST', 
'MM_PLUGIN_KERNEL_MODULE_LIST', 'MM_WIIMOTE_KERNEL_MODULE_LIST', 
'MM_X_KERNEL_MODULE_LIST'],
      value_default  => '',
      extra          => sub
      {
@@ -24,7 +24,7 @@

          my @kernel_modules = split(/ +/, $minimyth->var_get($name));

-        foreach my $delta_name  
('CPU', 'LCDPROC', 'LIRC', 'PLUGIN', 'WIIMOTE', 'X')
+        foreach my $delta_name  
('BLUETOOTH', 'CPU', 'LCDPROC', 'LIRC', 'PLUGIN', 'WIIMOTE', 'X')
          {
              my $delta_kernel_modules = $minimyth->var_get('MM_' .  
$delta_name . '_KERNEL_MODULE_LIST');
              if ($delta_kernel_modules)
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_WIIMOTE.pm
    
Thu Jun 11 21:31:51 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/conf/MM_WIIMOTE.pm
    
Thu Nov  5 18:59:16 2009
@@ -15,19 +15,71 @@

  $var_list{'MM_WIIMOTE_ADDRESS_0'} =
  {
-    value_default  => ''
+    prerequisite   => ['MM_BLUETOOTH_DEVICE_LIST'],
+    value_default  => '',
+    value_extra    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        if (($name ne '') &&  
($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST') eq ''))
+        {
+            $minimyth->message_output('err', qq($name is non-empty while  
MM_BLUETOOTH_DEVICE_LIST is empty));
+            return 0;
+        }
+        return 1;
+    }
  };
  $var_list{'MM_WIIMOTE_ADDRESS_1'} =
  {
-    value_default  => ''
+    prerequisite   => ['MM_BLUETOOTH_DEVICE_LIST'],
+    value_default  => '',
+    value_extra    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        if (($name ne '') &&  
($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST') eq ''))
+        {
+            $minimyth->message_output('err', qq($name is non-empty while  
MM_BLUETOOTH_DEVICE_LIST is empty));
+            return 0;
+        }
+        return 1;
+    }
  };
  $var_list{'MM_WIIMOTE_ADDRESS_2'} =
  {
-    value_default  => ''
+    prerequisite   => ['MM_BLUETOOTH_DEVICE_LIST'],
+    value_default  => '',
+    value_extra    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        if (($name ne '') &&  
($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST') eq ''))
+        {
+            $minimyth->message_output('err', qq($name is non-empty while  
MM_BLUETOOTH_DEVICE_LIST is empty));
+            return 0;
+        }
+        return 1;
+    }
  };
  $var_list{'MM_WIIMOTE_ADDRESS_3'} =
  {
-    value_default  => ''
+    prerequisite   => ['MM_BLUETOOTH_DEVICE_LIST'],
+    value_default  => '',
+    value_extra    => sub
+    {
+        my $minimyth = shift;
+        my $name     = shift;
+
+        if (($name ne '') &&  
($minimyth->var_get('MM_BLUETOOTH_DEVICE_LIST') eq ''))
+        {
+            $minimyth->message_output('err', qq($name is non-empty while  
MM_BLUETOOTH_DEVICE_LIST is empty));
+            return 0;
+        }
+        return 1;
+    }
  };
  $var_list{'MM_WIIMOTE_EVENT_DEVICE_LIST'} =
  {
=======================================
---  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
    
Thu Jun 11 21:31:51 2009
+++  
/trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
    
Thu Nov  5 18:59:16 2009
@@ -21,44 +21,10 @@

      if (($address_0) || ($address_1) || ($address_2) || ($address_3))
      {
-        $minimyth->message_output('info', "starting bluetooth ...");
+        $minimyth->message_output('info', "starting wminput ...");

          my $devnull = File::Spec->devnull;

-        my @devices = ();
-        if ((-e '/sys/class/bluetooth') &&  
(opendir(DIR, '/sys/class/bluetooth')))
-        {
-            foreach (grep(! /\./, (readdir(DIR))))
-            {
-                push(@devices, $_);
-            }
-        }
-        if ($#devices < 0)
-        {
-            $minimyth->message_output('warn', "no bluetooth device  
found.");
-            return 1;
-        }
-
-        my $device_configured = 0;
-        foreach my $device (@devices)
-        {
-            if (system(qq(/usr/sbin/hciconfig $device up > $devnull 2>&1))  
== 0)
-            {
-                $device_configured = 1;
-            }
-            else
-            {
-                $minimyth->message_output('warn', "configuration of  
bluetooth device '$device' failed.");
-            }
-        }
-        if ($device_configured == 0)
-        {
-            $minimyth->message_output('err', "no bluetooth device  
configured.");
-            return 0;
-        }
-
-        $minimyth->message_output('info', "starting wminput ...");
-
          if ($address_0)
          {
              my $config = undef;

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