Switching from livetv to sleep takes about 1 min

Help with using MiniMyth (except Booting)

Moderator: Pablo

Switching from livetv to sleep takes about 1 min

Postby bam » Wed Nov 04, 2009 2:54 pm

Hi Pablo!
There is a problem in MiniMyth.pm's mythfrontend_networkcontrol() function:
Code: Select all
sub mythfrontend_networkcontrol {
my $self    = shift;
my $command = shift;

my @lines = ();

my $port = $self->mythdb_settings_get('NetworkControlPort');

my $prompt = '/\# $/';
my $telnet = new Net::Telnet(
                             'Timeout' => '10',
                             'Errmode' => 'return',
                             'Host'    => 'localhost',
                             'Port'    => $port,
                             'Prompt'  => $prompt);
if (($telnet) && ($telnet->open())) {
$telnet->waitfor($prompt);
@lines = $telnet->cmd($command);
$telnet->cmd('exit');
$telnet->close;
chomp @lines;
}

The problem line is:
Code: Select all
if (($telnet) && ($telnet->open())) {

It tries to open the socket twice and it leads to falling the function to timeout every time we run mm_sleep command while watching live tv, witch lead to huge delay about 30 seconds or more before system goes to sleep.
I find out that following works instead of that line:
Code: Select all
if ($telnet)  {

PS:
This is a excerpt from the CPAN Net::Telnet's description of the new method:
$obj = new Net::Telnet ([$host]);
..SKIPPED..
If the $host argument is given then the object is opened by connecting to TCP $port on $host.
bam
Contributor
 
Posts: 64
Joined: Sat May 23, 2009 9:02 pm
Location: Russia, Moscow

Re: Switching from livetv to sleep takes about 1 min

Postby Pablo » Thu Nov 05, 2009 12:27 am

Thank you. I have committed your fix.
MiniMyth running on an ASUS M3N78-VM and an Acer ApireRevo 3610. Find out more at my MythTV page.
Pablo
Site Admin
 
Posts: 3699
Joined: Tue Dec 14, 2004 1:13 am
Location: La Jolla


Return to General Help

Who is online

Users browsing this forum: No registered users and 2 guests