[Finished] [MP1-4795] Add keyboard support to HID handler (1 Viewer)

Stéphane Lenclud

Development Group
  • Team MediaPortal
  • April 29, 2013
    2,563
    1,288
    Germany Germany
    Country flag
    My current "Centarea HID" for the Ortek/Hama uses an AutoHotKey script to give improved usability. It may turn out to be necessary to continue using such a script to circumvent some of the Ortek/Hama weirdness. I will know more when I have used the new support for a while.
    Hopefully there should be no need for AutoHotKey anymore.
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,360
    4,986
    France - IDF
    France France
    Country flag
    I have media function on my keyboard ( play / stop / vol /... ) this rework allow this one to work?
     

    Stéphane Lenclud

    Development Group
  • Team MediaPortal
  • April 29, 2013
    2,563
    1,288
    Germany Germany
    Country flag
    I have media function on my keyboard ( play / stop / vol /... ) this rework allow this one to work?
    No, your media keys should have been working just fine before, using HID. Those changes allow normal keyboard keys to be handled through HID thus allowing the use of profiles and modifiers (shift, ctrl, alt, windows). It has also the advantage of unifying our key handling code path. Profiles could then be used to provide full WMC and thus pseudo MCE remote support.
     

    Rick164

    Super User
  • Team MediaPortal
  • Super User
  • January 7, 2006
    1,335
    1,005
    Netherlands Netherlands
    Country flag
    Will test the latest build this week and report back :) , believe I had one problem with one of my own plugins using the previous build which was with the MP1 OnNewAction function:

    Code:
    public void OnNewAction(Action action)
    {
      string keyChar = KeycodeToChar(action.m_key.KeyChar).ToLower();
      string keyCode = action.m_key.KeyCode.ToString().ToLower();
    
    // Pass the key commands to another handler
      KeyCommandHandler(keyChar, keyCode);
    }
    It would no longer report a keyChar or keyCode almost as if OnNewAction wasn't being called anymore, now with the OnNewAction it was not possible to grab modifiers (shift / control etc..) as well but believe that was a limit imposed by MP1 core.
     
    Last edited:

    Stéphane Lenclud

    Development Group
  • Team MediaPortal
  • April 29, 2013
    2,563
    1,288
    Germany Germany
    Country flag
    It would no longer report a keyChar or keyCode almost as if OnNewAction wasn't being called anymore, now with the OnNewAction it was not possible to grab modifiers (shift / control etc..) as well but believe that was a limit imposed by MP1 core.
    Interesting, you would indeed not get such a Key object in your action when using HID keyboard handler.
    May I ask why you need such a Key?
    To me the whole point is that keys are mapped to actions. From an action point of view it should not matter which key did trigger it.
     

    Rick164

    Super User
  • Team MediaPortal
  • Super User
  • January 7, 2006
    1,335
    1,005
    Netherlands Netherlands
    Country flag
    For that plugin use it to do list actions for instance like:

    Toggle cover
    Reload view
    Load categories

    Some other plugins use it as well like MyAnime I believe and copied it off another a while back but can't remember which one.
    With HID mapping to actions you get limited to a certain set which you need to setup within Mediaportal as well while with keyboard actions you get a bit more choices / freedom as you can just read out the keys without having the user setup anything :) , couple of downsides are that Mediaportal can't read the modifiers and that it passes thru as you can't set something like e.handled = true to cancel other actions used by that key.
    Other than that it's pretty nice to have so hope it's possible to keep it in :)
     

    Stéphane Lenclud

    Development Group
  • Team MediaPortal
  • April 29, 2013
    2,563
    1,288
    Germany Germany
    Country flag
    With HID mapping to actions you get limited to a certain set which you need to setup within Mediaportal as well while with keyboard actions you get a bit more choices / freedom as you can just read out the keys without having the user setup anything :) , couple of downsides are that Mediaportal can't read the modifiers and that it passes thru as you can't set something like e.handled = true to cancel other actions used by that key.
    You are indeed limited to the actions defined by MediaPortal. Ideally plug-ins should be able to publish their own actions so that they can be mapped to shortcuts, thus each plug-in would not need to implement its own key mapping system, they could just use the MP1 system. For now and until actions can be published, if your plug-in is interested in the keys it should not use the action handler. It should instead get the keys from the system (WM_INPUT) and possibly use SharpLibHid to parse the message much like Auto3DPlugin does.

    Hard coding shortcuts in plug-in is bad practice :)
     

    Rick164

    Super User
  • Team MediaPortal
  • Super User
  • January 7, 2006
    1,335
    1,005
    Netherlands Netherlands
    Country flag
    For now and until actions can be published, if your plug-in is interested in the keys it should not use the action handler. It should instead get the keys from the system (WM_INPUT) and possibly use SharpLibHid to parse the message much like Auto3DPlugin does.
    Thanks will check that one out, used on previously but that slowed down keyboard input and had to unhook every time the plugin wasn't in focus so hopefully that library will be better.

    Hard coding shortcuts in plug-in is bad practice :)
    It's optionally configurable in the plugin though but agree it's far from perfect, like you said best solution
    would be published actions by plugins so that the HID handler can read those out and map :)
     
    Last edited:

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    ajs MP2Web - MP1 compatibility MediaPortal 1 20
    T MadVR + LAV Filters, Perfect in MPC-BE, Bad in MP1 MediaPortal 1 Talk 12
    P MP2: US user, OTA - can NOT get SchedulesDirect plugin to work on MP1 or MP2 --> how do I get OTA schedule? General 5
    framug [solved] Some changes/fix in MP1 configuration client and server Submit: code patches (MediaPortal/TV-Server/etc.) 14
    S TV-Server MP1 - Automatic search doesn't work Installation, configuration support 2
    C Streaming/transcoding MP2 vs MP1? General 1
    ajs [fixed] 5015: Improving the MP1 installer, providing nicer GUI :) MediaPortal 1 138
    C Streaming to clients over Wifi. MP1 or MP2? Newcomers Forum 0
    S Shortcuts MP1 My Recorded & TV Guide General 10
    azzuro [WiP] MP1-4999 - Big changes with many related change at once by Sebastiii MediaPortal 1 12
    ajs [Help Us!] MP1 X64 Version MediaPortal 1 20
    joecrow How about a Launcher plugin for MP1? MediaPortal 1 6
    wizard123 [solved] MP1 Build help MediaPortal 1 21
    ajs [News] MediaPortal 1 - 1.24 Released! News and Announcements 3
    CyberSimian [fixed] MP1-4990 : Improve horizontal scrolling in the EPG MediaPortal 1 10
    azzuro [WiP] MP1-5019: Replace MySQL with MariaDB MediaPortal 1 40
    catalpa Umsteiger von MP1: Schwierigkeiten Allgemeines Support- und Diskussionsforum 17
    CyberSimian [solved] MP1-4976 Built-in skin variables for current date MediaPortal 1 8
    rbo [solved] Umsteiger MP1 zu MP2 Allgemeines Support- und Diskussionsforum 67
    azzuro [Info] MP2 TVE inside MP1 repo MediaPortal 2 12
    G MP1 TV Server "failed to upgrade the database" using MS Sql Server Installation, configuration support 3
    lisag Can I get MP1 to open in the Recorded TV screen? MediaPortal 1 Talk 2
    M MP1 stops responding after Starting Plugins General Support 14
    R Problem with MP1 and WifiRemote Skins and Plugins Installer (MPEI) 8
    M.Hulot [solved] Netflix und amazon Prime in MP1 möglich? TV / Streaming 6
    Similar threads

























    Top Bottom