Add UI support for Discrete IR Codes

Issue #456 resolved
Wade Coxon created an issue

The following discrete IR codes have been added to the T series units:

   // Discrete power codes
   [ 0xFA ] = KEY_SUSPEND
   [ 0xFB ] = KEY_WAKEUP
   [ 0xFC ] = KEY_POWER2

While recognised by the T series drivers, the feature still requires the end-user to make some manual changes to keymap.xml in order for them to function.

This request is for two pieces of work:

1) incorporation of the keymap.xml changes into the standard keymap.xml

2) a new "Setup->System->Button settings->Action on short POWER" option called "Wake only".

The intent of the new "Wake only" option is to disable the action of a short press of the POWER button on the remote while the PVR is in an "on" state. (When in standby or deep standby, the POWER button will continue to operate as a "wake up" command).

The changes to make in keymap.xml are as follows: In GlobalActions:

Original:

    <map context="GlobalActions">
        <key id="KEY_VOLUMEUP" mapto="volumeUp" flags="mr"/>
        <key id="KEY_VOLUMEDOWN" mapto="volumeDown" flags="mr"/>
        <key id="KEY_MUTE" mapto="volumeMute" flags="mr"/>
        <key id="KEY_POWER" mapto="power_long" flags="l"/>
        <key id="KEY_POWER" mapto="power_down" flags="m"/>
        <key id="KEY_POWER" mapto="power_up" flags="b"/>
        <key id="KEY_KP0" mapto="discrete_off" flags="m"/>
        <device name="dreambox front panel">
            <key id="KEY_POWER" mapto="deepstandby" flags="l"/>
        </device>
    </map>

New:

Add the following two lines to "GlobalActions":

        <key id="KEY_POWER2" mapto="deepstandby" flags="m"/>
        <key id="KEY_SUSPEND" mapto="discrete_off" flags="m"/>

Change the "dreambox front panel" section to:

        <device name="dreambox front panel">
            <key id="KEY_POWER" mapto="deepstandby" flags="l"/>
        </device>

Notes:

The two lines in "GlobalActions":

        <key id="KEY_POWER" mapto="power_down" flags="m"/>
        <key id="KEY_POWER" mapto="power_up" flags="b"/>

Must be able to correctly ignore a POWER button press when the "Wake only" option is enabled.

The longpress of POWER in the "dreambox front panel" section has been removed and replaced, as the front panel appears to not recognise a physical long-press action.

In "StandbyActions":

Original:

    <map context="StandbyActions">
        <key id="KEY_POWER" mapto="power" flags="m"/>
        <key id="KEY_KP1" mapto="discrete_on" flags="m"/>
    </map>

New:

Add the following lines to "StandbyActions"

        <key id="KEY_WAKEUP" mapto="power" flags="m"/>
        <key id="KEY_POWER2" mapto="deepstandby" flags="m"/>

Comments (7)

  1. Wade Coxon reporter

    There is an implementation issue with the suggested "Wake only" setting for the setting:

    "Setup->System->Button settings->Action on short POWER"

    Such a setting would prevent the front panel POWER button from operating correctly, as it uses the same mechanisms to operate as the IR remote control POWER button.

    The "Wake only" option proposal should therefore not be implemented.

    Instead, the solution will necessitate the addition of a new setting. Proposal as follows:

    1) Implement new setting "Setup->System->Button settings->Enable discrete remote control POWER mode"

    2) Settings for the new mode are "Enable" and "Disable". As this is a on/off setting, it may be implemented as a switch.

    3) Description of the new option as follows:

    Enabling this option disables the short-press action of the remote control POWER button while the PVR is running.

    4) Modify the keymap.xml file "StandbyActions" as follows:

        <map context="StandbyActions">
            <key id="KEY_POWER" mapto="power" flags="m"/>
            <key id="KEY_KP1" mapto="discrete_on" flags="m"/>
            <key id="KEY_WAKEUP" mapto="power" flags="m"/>
            <key id="KEY_POWER2" mapto="deepstandby" flags="m"/>
        </map>
    

    5) Modify the keymap.xml "GlobalActions" as follows:

        <map context="GlobalActions">
            <key id="KEY_VOLUMEUP" mapto="volumeUp" flags="mr"/>
            <key id="KEY_VOLUMEDOWN" mapto="volumeDown" flags="mr"/>
            <key id="KEY_MUTE" mapto="volumeMute" flags="mr"/>
            <key id="KEY_POWER" mapto="power_long" flags="l"/>
            <key id="KEY_POWER" mapto="checkenablepower_down" flags="m"/>
            <key id="KEY_POWER" mapto="checkenablepower_up" flags="b"/>
            <key id="KEY_KP0" mapto="discrete_off" flags="m"/>
            <key id="KEY_POWER2" mapto="deepstandby" flags="m"/>
            <key id="KEY_SUSPEND" mapto="discrete_off" flags="m"/>
            <device name="dreambox front panel">
                <key id="KEY_POWER" mapto="deepstandby" flags="l"/>
                <key id="KEY_POWER" mapto="power_down" flags="m"/>
                <key id="KEY_POWER" mapto="power_up" flags="b"/>
            </device>
        </map>
    

    Note: The modified lines including the functions "checkenablepower_up" and "checkenablepower_down" are provided as suggested function names for handling of checking of the state of the "Enable discrete remote control POWER mode" setting.

    6) Implement new functions checkenablepower_up and checkenablepower_down.

    The purpose of these functions is to check to see if the "Enable discrete remote control POWER mode" setting is set to enabled.

    If the setting is disabled, then the functions should call power_up or power_down respectively so that the POWER button takes effect.

    If the setting is enabled, then the functions should take no action (and optionally display an "invalid command" icon on the screen.

    The result of these changes should be such that when the "Enable discrete remote control POWER mode" is enabled, the POWER button on the remote control will do nothing while the PVR is in a running state. The operation of the front panel POWER button shall ignore the "Enable discrete remote control POWER mode" setting and it shall operate as it normally would in the firmware prior to these proposed modifications.

    The changes will also allow a 3rd party remote control to send the following new commands:

       // Discrete power codes
       [ 0xFA ] = KEY_SUSPEND
       [ 0xFB ] = KEY_WAKEUP
       [ 0xFC ] = KEY_POWER2
    

    Such that:

    There are three power states, OFF, ON and STANDBY and four keys that can affect those states.
    KEY_SUSPEND
    ON -> STANDBY
    OFF -> OFF
    STANDBY -> STANDBY
    
    KEY_WAKEUP
    ON -> ON
    OFF -> OFF
    STANDBY -> ON
    
    KEY_POWER2 (aka power off key)
    ON -> OFF
    OFF -> OFF
    STANDBY -> OFF
    
    KEY_POWER (existing key, which may need reassignment when operating in "discrete" mode)
    ON -> ON
    OFF -> ON
    
  2. Peter Urbanec

    Fix issue #456: [KeyBindings] Add discrete power codes

    Add discrete power codes so that the discrete code debug info is printed in full in InfoBarUnhandledKey.actionA().

    → <<cset 9a9ee7dc40ab>>

  3. Peter Urbanec

    Fix issue #456: Add UI support for Discrete IR Codes

    [keymap.xml]

    In GlobalActions, distinguish front panel POWER make and break actions from remore POWER make and break actions so that short-POWER from the remote can be handled differently from short-POWER on the front panel.

    In GlobalActions and StandbyActions, add new mappings for POWER2, SUSPEND and WAKEUP.

    [setup.xml]

    Add an "expert" level setting to enable/disable short-POWER actions from the remote.

    Re-order the setting entries for the settings for short- and long-POWER and short- and long-REC actions so that the entry for short-POWER immediately follows the new setting that disables it from the remote.

    Use two entries for the short-POWER actions with "requires" attributes to change the setting label and description to reflect changes in the enable/disable short-POWER actions setting.

    [UsageConfig]

    Add two new config variables, config.usage.short_power_enable and config.usage.short_power_disable. The config.usage.short_power_disable config variable is marked NoSave, and is tied to alwas be the negation of config.usage.short_power_enable. These support the text switching mentioned above in keymap.xml, and are required because "requires" attributes can't contain expressions.

    [Standby]

    Add a powerKey global that is set in mytest.runScreenTest() to reference the same object as mytest.power. This is required by Standby.deepStandby().

    Add Standby.deepStandby() to allow the POWER2 key to shut down the PVR from standby, and call it on the "deepstandby" action.

    Move code to enable and disable video output into methods Standby.videoOn() and Standby.videoOff(). They are used in PowerKey.shutdown() to allow an information popup to be displayed.

    [mytest]

    Add methods PowerKey.conditional_powerdown() and PowerKey.conditional_powerdown() to only act on short-POWER from the remote if short-POWER actions are enabled for the remote. The functions return 0 if short-POWER actions are disabled for the remote so that they can fall through to the POWER actions for the front panel.

    Add an action on "deepstandby" to implement shutdown on POWER2.

    If the PVR is recording in standby when shut down, show a different message from shutdown while recording when running ("Remaining in standby ..." instead of "Entering standby...") and switch on video output so that the message can be seen on the TV screen if the TV is on. Turn off video again when te message box closes.

    Set Screens.Standby.powerKey = mytest.power do that StandbydeepStandby() can access PowerKey.shutdown().

    Import RecordTimer and use the RecordTimer.AFTEREVENT.DEEPSTANDBY symbol instead of a fixed integer.

    → <<cset 693cb0ecb215>>

  4. Peter Urbanec

    Fix bug #456: Remove code to turn video on/off on shutdown from standby

    [PowerKey]

    Remove code that turns on the video output to display the popup message when the PVR is shut down from standby when there is a recording running.

    The message is still displayed on the front panel of models that have a front panel display.

    → <<cset 730d1a86fbd2>>

  5. Log in to comment