1.14.0 - ACTION_EJECTCD doesn't work

Discussion in 'Archive' started by tony72, May 20, 2016.

  1. tony72
    • Premium Supporter

    tony72 MP Donator

    Joined:
    August 15, 2009
    Messages:
    169
    Likes Received:
    15
    Ratings:
    +56 / 0
    Home Country:
    England England
    Show System Specs
    MediaPortal 1.14 Final. I have an HP MCE remote, and have the Use generic HID device" option ticked. Via the remote->HID->Mapping GUI, I mapped the "Eject" button on the remote to the "Ejectcd" action. It does not work, as in I cannot eject a disc or open the drive tray by pressing the eject button.



    I know the button works, because I can map it to other actions, and they work.

    I know that the drive works, and can be ejected by software, because in MediaPortal I can go to Videos, select the disc, and eject it via the context menu.

    So by elimination, there seems to be a problem with the Ejectcd action itself, or the way it is handled.

    As I recall, this was discussed in the forums, and the general consensus was that this action used to work, but stopped working in some previous version, so it is probably not a new bug.

    In the period of the attached logs, I started MediaPortal, pressed the Eject button a few times to try to open the drive, then manually opened the drive, inserted a disc, played and then stopped it, then pressed eject a few more times, then exited MediaPortal with the disc still inserted.
     

    Attached Files:

  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,729
    Ratings:
    +8,195 / 17
    Home Country:
    New Zealand New Zealand
    Hi

    First, thanks for the report.
    Could you please collect log files again, but this time enable the "extended logging" option in MP Configuration -> remotes and input devices section -> HID tab. Without that option enabled, the log files don't show which buttons you press.

    Regards,
    mm
     
  4. tony72
    • Premium Supporter

    tony72 MP Donator

    Joined:
    August 15, 2009
    Messages:
    169
    Likes Received:
    15
    Ratings:
    +56 / 0
    Home Country:
    England England
    Show System Specs
    Thanks for the reply. Sure thing, sorry I didn't notice that option before; new log files are attached with HID extended logging enabled. I had mad a mistake in the mapping yesterday which would have muddied the waters anyway, so I've attached today's mappings also. The logs were collected with the same sequence of events as before.
     

    Attached Files:

  5. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,729
    Ratings:
    +8,195 / 17
    Home Country:
    New Zealand New Zealand
    Right, so according to the log files your eject button is generating the following entries:
    [2016-05-21 12:11:43,181] [Log ] [MPMain ] [INFO ] - HID: try mapping usage 0034

    0034 is the code, which can also be written as 0x34.
    Based on this the name of the code is Ext2:
    https://sharplibhid.codeplex.com/SourceControl/latest#Hid/HidUsageTables.cs
    Code (Text):
    1.  
    2.             /// <summary>
    3.             /// First press action: Generates EXTn HID message in the Media Center Vendor Specific
    4.             /// Collection (page 0xFFBC, usage 0x88).
    5.             /// <para />
    6.             /// Second press action: Repeats message.
    7.             /// <para />
    8.             /// Auto-repeat: No
    9.             /// <para />
    10.             /// Notably sent by the 'Eject' button of HP Windows Media Center Remote (TSGH-IR08).
    11.             /// Also interpreted as 'Eject' action by SoundGraph iMON Manager in MCE mode (OrigenAE VF310).
    12.             /// </summary>
    13.             Ext2 = 0x34,
    In MediaPortal's HID mapping it's known as "HpEject":
    https://github.com/MediaPortal/Medi...ults/InputDeviceMappings/Generic-HID.xml#L281
    Code (Text):
    1. <button name="HpEject" code="Ext2" />
    ...not the standard eject as you might expect. I think that's due to the type of remote you have.
    If you map "HpEject" to the eject action then your remote eject button should start working.
     
    • Thank You! Thank You! x 1
  6. tony72
    • Premium Supporter

    tony72 MP Donator

    Joined:
    August 15, 2009
    Messages:
    169
    Likes Received:
    15
    Ratings:
    +56 / 0
    Home Country:
    England England
    Show System Specs
    Thanks, but unfortunately that's not the case. I had already figured out that I should be using HpEject (that was the mapping error I alluded to with yesterday's test, I should have spelled that out), and that's the button I mapped the Ejectcd action to today, but it still doesn't work. I also subsequently tried mapping Ejectcd to other unambiguous buttons, and it still doesn't work. So there definitely seems to be a problem with the action itself.
     
  7. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,579
    Likes Received:
    519
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +935 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
  8. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,729
    Ratings:
    +8,195 / 17
    Home Country:
    New Zealand New Zealand
    Okay, thanks guys. Looking at the code, this may have been broken since 2013. :eek::oops::whistle:
    Please try the attached patch with both your remote and the eject/load context menu entries.
     

    Attached Files:

    • Thank You! Thank You! x 1
  9. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,579
    Likes Received:
    519
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +935 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    I have downloaded the fix and tested it, but I am not sure how relevant my results are. I used my WMC RC6 remote, with the "Aspect Ratio" button defined to perform the EJECTCD function.

    My production system is MP 1.12, and as only one DLL is affected, I thought that I would try the fix on MP 1.12. Unfortunately, MP refused to start (the log file shows a missing reference).

    My test partition currently has MP 1.15 pre with Stéphane's changes for the consolidated HID. I installed the modified DLL on that. These are the results:

    (1) MP would not display my "Videos" folders -- the panel was empty. Since that is where I expected to see the entry for the CD/DVD drive, that was a non-starter. :(

    (2) I then tried the "Music" section, and that did list both the CD/DVD drive and my "Music" folder. So I tested there. :)

    (3) With an empty CD drive, the EJECT button on my remote would open the CD drawer :), but not close it. :(

    (4) With an empty CD drive, the context menu item would close the CD drawer :), but not open it. :(

    (5) With a CD loaded but not playing, the context menu item would open the CD drawer and close it. :) However, it resulted in the list of entries on the panel being duplicated, so that I ended up with the following (where "O:" is my optical drive):

    (O: ) CD/DVD
    Music
    (O: ) CD/DVD
    Music

    So, some success, but the incorrect behaviour might be due to some mismatch between the fix (for MP 1.14) and my test system (MP 1.15). :unsure:

    -- from CyberSimian in the UK
     
  10. tony72
    • Premium Supporter

    tony72 MP Donator

    Joined:
    August 15, 2009
    Messages:
    169
    Likes Received:
    15
    Ratings:
    +56 / 0
    Home Country:
    England England
    Show System Specs
    I just tested the patch; on my system it seems to work, as in both the eject button on the remote and the "Eject" context menu item in Videos now eject the drive tray (y). Thanks!

    I didn't recall that the Ejectcd action ever did close the tray if it's open, I think I could only ever eject the tray via the remote, so it didn't cross my mind to test that until I saw the post above. It doesn't, if that's an issue. There does seem to be a slight inconsistency with the context menus; as CyberSimian says, in Music, the Eject context menu item will indeed close the tray if its open, but in Videos it does not.
     
  11. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,729
    Ratings:
    +8,195 / 17
    Home Country:
    New Zealand New Zealand
    Thanks for testing guys, and for your detailed reports - much appreciated. (y)

    Let me try to cover off all of the points you've raised. Apologies in advance for the length. Please bear with me.

    That's fine.

    Yeah, that DLL won't work with 1.12 - sorry. I knew choosing the right version to build would be a bit of a trick. For myself, I still have MP 1.7.1 so I currently can't test anything I build either.

    I think this may well be a side-effect of the mismatching builds. 1.15 PR would be close enough to 1.14 in most cases, though some things may not work. The addition of Stéphane's changes throws an extra spanner in the works. I'll see if I can build a 1.12 version for your production system, and maybe throw in a 1.15 PR version as optional. I won't be able to include Stéphane's changes - too time consuming.

    From the code, this is expected:
    https://github.com/MediaPortal/Medi.../MediaPortal.Application/MediaPortal.cs#L4170

    Please be aware that it's difficult if not impossible to detect the difference between empty drive and open tray. Thus writing logic to always open and close the tray appropriately with only one button is tricky... and that's not even considering drives that don't even have a tray. It may be possible to implement some kind of improvement in future but for me and for now I'm strictly limiting scope to fixing bugs without causing any regressions.

    I confirm that I can reproduce with MP 1.7.1. <sigh> :(
    The relevant code:
    Code (Text):
    1.  
    2. case 654: // Eject
    3.   if (item != null && Util.Utils.getDriveType(item.Path) != 5)
    4.   {
    5.     Util.Utils.EjectCDROM();
    6.   }
    7.   else
    8.   {
    9.     if (item != null && item.Path != null)
    10.     {
    11.       var driveInfo = new DriveInfo(Path.GetPathRoot(item.Path));
    12.  
    13.       if (!driveInfo.IsReady)
    14.       {
    15.         Util.Utils.CloseCDROM(Path.GetPathRoot(item.Path));
    16.       }
    17.       else
    18.       {
    19.         Util.Utils.EjectCDROM(Path.GetPathRoot(item.Path));
    20.       }
    21.     }
    22.   }
    23.   LoadDirectory(string.Empty);
    First clause says if the drive is not a CD/DVD/BR drive (removable USB???), just eject [the first/default CD/DVD/BR drive]. To be honest this makes no sense to me, but what the hey. Maybe's it's catch-all code.
    The second clause is the relevant clause. It says: if a disc is not loaded in the drive (ie. tray is open OR tray is closed with no disc), close the tray... but if a disc is loaded, eject it.

    Obviously the first part of the second clause is the problem. Once again it comes down to the fact that it's difficult/impossible to distinguish between those two scenarios. Quite frankly though, I don't understand why there needs to be any logic there in the first place. The person has selected the "eject" menu item. Therefore shouldn't MP just open the tray? Any objections or flaws in my logic?

    P.S.: the same bug applies to the pictures plugin/section, but the video plugin/section does exactly what I have proposed. Yay for code duplication and people that don't check all the similar code when they fix bugs! :(

    This is the expected result given the dissection above. However as previously indicated, due to the difficulty in distinguishing closed empty tray from open tray, I think we should modify this so that eject only ejects and load only loads. It would be nice to be smart, but functional is the ultimate priority.

    Hmmm, I can't reproduce with 1.7.1.
    Using either the load or eject ( :rolleyes: ) menu items to close the tray containing an audio CD does not give me duplicates. Furthermore, when the tray is closed, my item text changes from "(Z:) CD/DVD" to "(Z:) Audio CD". That's with shares view in the music section.
    Can you reproduce this @tony72 ?

    You're very welcome, but really it should be me thanking you and CyberSimian for bringing this to our attention and taking the time to test the fix. Again, it's very much appreciated. :notworthy:

    I think my comments above should cover both of these points. Briefly:
    1. Your memory is correct. The eject button has never closed the tray, and I don't intend to change that.
    2. I think we should fix the inconsistency with the context menu by having the "eject" item only eject/open... and that would solve the problem of not being able to open an empty drive using the context menu.

    Hopefully I've answered all the questions. All that remains to be mentioned are the attached patches for 1.12, 1.14 and 1.15 PR. Please test as you're able, and be sure to cover the videos, music and pictures sections. As far as I can tell those are all the places that use the same eject/load functions.
     

    Attached Files:

    • Thank You! Thank You! x 2
    • 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!