[Finished] - [MP1-4795] Add keyboard support to HID handler | Page 3

Discussion in 'Area 51 - Testing Area' started by Stéphane Lenclud, April 29, 2016.

  1. Stéphane Lenclud
    • Team MediaPortal

    Stéphane Lenclud Development Group

    Joined:
    April 29, 2013
    Messages:
    2,560
    Likes Received:
    653
    Gender:
    Male
    Ratings:
    +1,266 / 8
    Home Country:
    Germany Germany
    Show System Specs
    Hopefully there should be no need for AutoHotKey anymore.


     
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. azzuro
    • Team MediaPortal

    azzuro Test Group

    Joined:
    May 10, 2007
    Messages:
    8,284
    Likes Received:
    2,358
    Occupation:
    technician HVAC
    Location:
    France - IDF
    Ratings:
    +3,991 / 13
    Home Country:
    France France
    Show System Specs
  4. Stéphane Lenclud
    • Team MediaPortal

    Stéphane Lenclud Development Group

    Joined:
    April 29, 2013
    Messages:
    2,560
    Likes Received:
    653
    Gender:
    Male
    Ratings:
    +1,266 / 8
    Home Country:
    Germany Germany
    Show System Specs
    Not sure what you mean by that, could you be more specific?
     
  5. azzuro
    • Team MediaPortal

    azzuro Test Group

    Joined:
    May 10, 2007
    Messages:
    8,284
    Likes Received:
    2,358
    Occupation:
    technician HVAC
    Location:
    France - IDF
    Ratings:
    +3,991 / 13
    Home Country:
    France France
    Show System Specs
    I have media function on my keyboard ( play / stop / vol /... ) this rework allow this one to work?
     
  6. Stéphane Lenclud
    • Team MediaPortal

    Stéphane Lenclud Development Group

    Joined:
    April 29, 2013
    Messages:
    2,560
    Likes Received:
    653
    Gender:
    Male
    Ratings:
    +1,266 / 8
    Home Country:
    Germany Germany
    Show System Specs
    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.
     
    • Like Like x 2
  7. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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 (Text):
    1.  
    2. public void OnNewAction(Action action)
    3. {
    4.   string keyChar = KeycodeToChar(action.m_key.KeyChar).ToLower();
    5.   string keyCode = action.m_key.KeyCode.ToString().ToLower();
    6.  
    7. // Pass the key commands to another handler
    8.   KeyCommandHandler(keyChar, keyCode);
    9. }
    10.  
    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: June 29, 2016
    • Like Like x 1
  8. Stéphane Lenclud
    • Team MediaPortal

    Stéphane Lenclud Development Group

    Joined:
    April 29, 2013
    Messages:
    2,560
    Likes Received:
    653
    Gender:
    Male
    Ratings:
    +1,266 / 8
    Home Country:
    Germany Germany
    Show System Specs
    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.
     
  9. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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 :)
     
  10. Stéphane Lenclud
    • Team MediaPortal

    Stéphane Lenclud Development Group

    Joined:
    April 29, 2013
    Messages:
    2,560
    Likes Received:
    653
    Gender:
    Male
    Ratings:
    +1,266 / 8
    Home Country:
    Germany Germany
    Show System Specs
    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 :)
     
    • Like Like x 1
  11. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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.

    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: June 30, 2016
    • Agree Agree x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!