Author: pebender
Date: Sun Dec 28 09:44:40 2008
New Revision: 4137
Modified:
trunk/gar-minimyth/html/minimyth/document-changelog.txt
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d.sh/init.d/wiimote
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
Log:
- Improved checking for whether or not a Wiimote is in use before
initializing during init.
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 Sun Dec 28
09:44:40 2008
@@ -30,6 +30,10 @@
- Updated MPlayer VDPAU support.
- Updated Xine VDPAU support.
+Modified Wiimote
+ - Improved checking for whether or not a Wiimote is in use before
+ initializing during init.
+
Modified persistent device links
- Prepended kernel device name (without instance). This is needed for
hardware that creates multiple device types (e.g. the Wiimote).
Modified:
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d.sh/init.d/wiimote
==============================================================================
---
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d.sh/init.d/wiimote
(original)
+++
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d.sh/init.d/wiimote
Sun Dec 28 09:44:40 2008
@@ -39,11 +39,6 @@
mm_message_output info 'starting wminput ...'
- # wminput is already running, so return.
- if /usr/bin/test -n "`/bin/pidof wminput`" ; then
- return
- fi
-
# Start
if /usr/bin/test ! -e '/dev/uinput' ; then
if ! /sbin/modprobe uinput > /dev/null 2>&1 ; then
@@ -67,7 +62,11 @@
mm_message_output err "error: no 'wminput' config file
found."
exit 1
fi
- /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_0} >
/dev/null 2>&1 &
+ if /usr/bin/hcitool con 2> /dev/null | /bin/grep -q
-e "[[:cntrl:]]*< ACL ${MM_WIIMOTE_ADDRESS_0}" ; then
+ mm_message_output info "Wiimote 0 (address:
${MM_WIIMOTE_ADDRESS_0}) not started because it is already running"
+ else
+ /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_0} >
/dev/null 2>&1 &
+ fi
fi
if /usr/bin/test -n "${MM_WIIMOTE_ADDRESS_1}" ; then
config=''
@@ -81,7 +80,11 @@
mm_message_output err "error: no 'wminput' config file
found."
exit 1
fi
- /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_1} >
/dev/null 2>&1 &
+ if /usr/bin/hcitool con 2> /dev/null | /bin/grep -q
-e "[[:cntrl:]]*< ACL ${MM_WIIMOTE_ADDRESS_1}" ; then
+ mm_message_output info "Wiimote 1 (address:
${MM_WIIMOTE_ADDRESS_1}) not started because it is already running"
+ else
+ /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_1} >
/dev/null 2>&1 &
+ fi
fi
if /usr/bin/test -n "${MM_WIIMOTE_ADDRESS_2}" ; then
config=''
@@ -95,7 +98,11 @@
mm_message_output err "error: no 'wminput' config file
found."
exit 1
fi
- /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_2} >
/dev/null 2>&1 &
+ if /usr/bin/hcitool con 2> /dev/null | /bin/grep -q
-e "[[:cntrl:]]*< ACL ${MM_WIIMOTE_ADDRESS_2}" ; then
+ mm_message_output info "Wiimote 2 (address:
${MM_WIIMOTE_ADDRESS_2}) not started because it is already running"
+ else
+ /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_2} >
/dev/null 2>&1 &
+ fi
fi
if /usr/bin/test -n "${MM_WIIMOTE_ADDRESS_3}" ; then
config=''
@@ -109,7 +116,11 @@
mm_message_output err "error: no 'wminput' config file
found."
exit 1
fi
- /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_3} >
/dev/null 2>&1 &
+ if /usr/bin/hcitool con 2> /dev/null | /bin/grep -q
-e "[[:cntrl:]]*< ACL ${MM_WIIMOTE_ADDRESS_3}" ; then
+ mm_message_output info "Wiimote 3 (address:
${MM_WIIMOTE_ADDRESS_3}) not started because it is already running"
+ else
+ /usr/bin/wminput -d -c ${config} ${MM_WIIMOTE_ADDRESS_3} >
/dev/null 2>&1 &
+ fi
fi
fi
Modified:
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
==============================================================================
---
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
(original)
+++
trunk/gar-minimyth/script/meta/minimyth/files/source/rootfs/etc/rc.d/init/wiimote.pm
Sun Dec 28 09:44:40 2008
@@ -60,12 +60,6 @@
$minimyth->message_output('info', "starting wminput ...");
- # wminput is already running, so return.
- if ($minimyth->application_running('wminput'))
- {
- return 1;
- }
-
# Load uinput driver as needed.
if (! -e q(/dev/uinput))
{
@@ -96,7 +90,28 @@
$minimyth->message_output('err', "error: no 'wminput'
config file found.");
return 0;
}
- system(qq(/usr/bin/wminput -d -c $config $address_0 > $devnull
2>&1 &));
+ my $running = 0;
+ if (open(FILE, '-|', q(/usr/bin/hcitool con 2> /dev/null)))
+ {
+ while (<FILE>)
+ {
+ chomp;
+ if (/^[[:cntrl:]]*< ACL $address_0/)
+ {
+ $running = 1;
+ last;
+ }
+ }
+ close(FILE);
+ }
+ if (! $running)
+ {
+ system(qq(/usr/bin/wminput -d -c $config $address_0 >
$devnull 2>&1 &));
+ }
+ else
+ {
+ $minimyth->message_log('info', qq(Wiimote 0 \(address:
$address_0\) not started because it is already running));
+ }
}
if ($address_1)
{
@@ -114,7 +129,28 @@
$minimyth->message_output('err', "error: no 'wminput'
config file found.");
return 0;
}
- system(qq(/usr/bin/wminput -d -c $config $address_1 > $devnull
2>&1 &));
+ my $running = 0;
+ if (open(FILE, '-|', q(/usr/bin/hcitool con 2> /dev/null)))
+ {
+ while (<FILE>)
+ {
+ chomp;
+ if (/^[[:cntrl:]]*< ACL $address_1/)
+ {
+ $running = 1;
+ last;
+ }
+ }
+ close(FILE);
+ }
+ if (! $running)
+ {
+ system(qq(/usr/bin/wminput -d -c $config $address_1 >
$devnull 2>&1 &));
+ }
+ else
+ {
+ $minimyth->message_log('info', qq(Wiimote 1 \(address:
$address_1\) not started because it is already running));
+ }
}
if ($address_2)
{
@@ -132,7 +168,28 @@
$minimyth->message_output('err', "error: no 'wminput'
config file found.");
return 0;
}
- system(qq(/usr/bin/wminput -d -c $config $address_2 > $devnull
2>&1 &));
+ my $running = 0;
+ if (open(FILE, '-|', q(/usr/bin/hcitool con 2> /dev/null)))
+ {
+ while (<FILE>)
+ {
+ chomp;
+ if (/^[[:cntrl:]]*< ACL $address_2/)
+ {
+ $running = 1;
+ last;
+ }
+ }
+ close(FILE);
+ }
+ if (! $running)
+ {
+ system(qq(/usr/bin/wminput -d -c $config $address_2 >
$devnull 2>&1 &));
+ }
+ else
+ {
+ $minimyth->message_log('info', qq(Wiimote 2 \(address:
$address_2\) not started because it is already running));
+ }
}
if ($address_3)
{
@@ -150,7 +207,28 @@
$minimyth->message_output('err', "error: no 'wminput'
config file found.");
return 0;
}
- system(qq(/usr/bin/wminput -d -c $config $address_3 > $devnull
2>&1 &));
+ my $running = 0;
+ if (open(FILE, '-|', q(/usr/bin/hcitool con 2> /dev/null)))
+ {
+ while (<FILE>)
+ {
+ chomp;
+ if (/^[[:cntrl:]]*< ACL $address_3/)
+ {
+ $running = 1;
+ last;
+ }
+ }
+ close(FILE);
+ }
+ if (! $running)
+ {
+ system(qq(/usr/bin/wminput -d -c $config $address_3 >
$devnull 2>&1 &));
+ }
+ else
+ {
+ $minimyth->message_log('info', qq(Wiimote 3 \(address:
$address_3\) not started because it is already running));
+ }
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---