Index: Slim/Hardware/IR.pm =================================================================== --- Slim/Hardware/IR.pm (revision 9062) +++ Slim/Hardware/IR.pm (working copy) @@ -534,7 +534,7 @@ my $timediff = $irTime - $client->lastirtime(); if ($timediff < 0) {$timediff += (0xffffffff / $client->ticspersec());} - if (($timediff < $Slim::Hardware::IR::IRMINTIME) && ($irCodeBytes ne $client->lastircodebytes)) { + if (($code !~ /(.*?)\.(up|down)$/) && ($timediff < $Slim::Hardware::IR::IRMINTIME) && ($irCodeBytes ne $client->lastircodebytes)) { #received oddball code in middle of repeat sequence, drop it $::d_ir && msg("Received $irCodeBytes while expecting " . $client->lastircodebytes . ", dropping code\n"); return; @@ -553,8 +553,13 @@ msg("$irCodeBytes\t$irTime\t".Time::HiRes::time()."\n"); } - - if (($irCodeBytes eq ($client->lastircodebytes())) #same button press as last one + if ($code =~ /(.*?)\.(up|down)$/) { + $::d_ir && msg("Front panel code detected, processing $code\n"); + $client->startirhold($irTime); + $client->lastircodebytes($irCodeBytes); + $client->irrepeattime(0); + processFrontPanel($client, $1, $2, $irTime); + } elsif (($irCodeBytes eq ($client->lastircodebytes())) #same button press as last one && ( ($client->irtimediff < $Slim::Hardware::IR::IRMINTIME) #within the minimum time to be considered a repeat || (($client->irtimediff < $client->irrepeattime * 2.02) #or within 2% of twice the repeat time && ($client->irtimediff > $client->irrepeattime * 1.98))) #indicating that a repeat code was missed @@ -581,6 +586,45 @@ } } +sub processFrontPanel { + my $client = shift; + my $code = shift; + my $dir = shift; + my $irTime = shift; + + if ($dir eq 'down') { + $::d_ir && msg("IR: Front panel button press: $code\n"); + my $irCode = lookupFunction($client,$code); + $client->lastirbutton($code); + processCode($client,$irCode,$irTime); + Slim::Utils::Timers::setTimer($client,Time::HiRes::time()+($Slim::Hardware::IR::IRHOLDTIME), \&fireHold, $1.'.hold', $client->lastirtime); + } else { + $::d_ir && msg("IR: Front panel button release: $code\n"); + + my $irCode; + if ($irTime - $client->lastirtime() > $Slim::Hardware::IR::IRHOLDTIME) { + $irCode = lookupFunction($client,$code.'.hold_release'); + $client->lastirbutton($code.'.hold_release'); + processCode( $client,$irCode, $client->lastirtime); + } else { + $irCode = lookupFunction($client,$code.'.single'); + $client->lastirbutton($code.'.single'); + processCode($client,$irCode,$irTime); + } + } +} + +sub fireHold { + my $client = shift; + my $irCode = shift; + my $irTime = shift; + + my $last = lookupCodeBytes($client,$client->lastircodebytes); + return if ($last =~ /\.up$/); + $::d_ir && msg("IR: Hold Time Expired - irCode = [$irCode] timer = [$irTime] timediff = [" . $client->irtimediff . "] last = [".$last."]\n"); + processCode($client, $irCode, $irTime); +} + # utility functions used externally sub resetHoldStart { my $client = shift; Index: IR/Front_Panel.ir =================================================================== --- IR/Front_Panel.ir (revision 9062) +++ IR/Front_Panel.ir (working copy) @@ -3,36 +3,36 @@ ################################################################################## # Button names to IR code mappings ################################################################################## -0 = 00010000 -1 = 00010001 -2 = 00010002 -3 = 00010003 -4 = 00010004 -5 = 00010005 -6 = 00010006 -7 = 00010007 -8 = 00010008 -9 = 00010009 -power = 0001000a -arrow_up = 0001000b -arrow_down = 0001000c -arrow_left = 0001000d -arrow_right = 0001000e -search = 0001000f -rew = 00010010 -fwd = 00010011 -play = 00010012 -add = 00010013 -brightness = 00010014 -now_playing = 00010015 +0.down = 00010000 +1.down = 00010001 +2.down = 00010002 +3.down = 00010003 +4.down = 00010004 +5.down = 00010005 +6.down = 00010006 +7.down = 00010007 +8.down = 00010008 +9.down = 00010009 +power.down = 0001000a +arrow_up.down = 0001000b +arrow_down.down = 0001000c +arrow_left.down = 0001000d +arrow_right.down = 0001000e +search.down = 0001000f +rew.down = 00010010 +fwd.down = 00010011 +play.down = 00010012 +add.down = 00010013 +brightness.down = 00010014 +now_playing.down = 00010015 -pause = 00010017 -browse = 00010018 -volup = 00010019 -voldown = 0001001a -size = 0001001b -visual = 0001001c -volumemode = 0001001d +pause.down = 00010017 +browse.down = 00010018 +volup.down = 00010019 +voldown.down = 0001001a +size.down = 0001001b +visual.down = 0001001c +volumemode.down = 0001001d 0.up = 00020000 1.up = 00020001 @@ -63,4 +63,4 @@ voldown.up = 0002001a size.up = 0002001b visual.up = 0002001c -volumego.up = 0002001d +volumemode.up = 0002001d