[mythtv-commits] Ticket #2462: Eject media button fails if tray is empt
MythTV
mythtv at cvs.mythtv.org
Mon Mar 26 11:05:40 UTC 2007
#2462: Eject media button fails if tray is empt
------------------------------------------+---------------------------------
Reporter: list-mythtv at bluecamel.eml.cc | Owner: nigel
Type: defect | Status: assigned
Priority: minor | Milestone: unknown
Component: mythtv | Version: 0.20
Severity: medium | Resolution:
------------------------------------------+---------------------------------
Comment(by nigel):
The logs may not narrow it down much (unless there is an obvious error).
Adding some extra debug, something like this, may help:
{{{
% svn diff mythcdrom-linux.cpp mythmediamonitor.cpp
Index: mythcdrom-linux.cpp
===================================================================
--- mythcdrom-linux.cpp (revision 13125)
+++ mythcdrom-linux.cpp (working copy)
@@ -11,11 +11,23 @@
MediaError MythCDROMLinux::eject(bool open_close)
{
if (!isDeviceOpen())
+ {
+ cout << "MythCDROMLinux::eject(" << open_close
+ << ") Opening device for eject/closetray ioctl()";
openDevice();
+ }
if (open_close)
- return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK
- :
MEDIAERR_FAILED;
+ {
+ int stat = ioctl(m_DeviceHandle, CDROMEJECT) == 0;
+
+ if (stat)
+ return MEDIAERR_OK;
+
+ cout << "MythCDROMLinux::eject(" << open_close
+ << ") ioctl(CDROMEJECT) - error " << strerror(errno);
+ return MEDIAERR_FAILED;
+ }
else
{
// If the tray is empty, this will fail (Input/Output error)
Index: mythmediamonitor.cpp
===================================================================
--- mythmediamonitor.cpp (revision 13125)
+++ mythmediamonitor.cpp (working copy)
@@ -166,6 +166,7 @@
if (MEDIASTAT_OPEN == status)
{
+ puts("Tray is open. Trying to close it.");
selected->eject(false);
}
else if (MEDIASTAT_MOUNTED == status)
@@ -186,6 +187,7 @@
if (doEject)
{
+ puts("Unlocking device before attempting eject()");
selected->unlock();
if (selected->eject() == MEDIAERR_UNSUPPORTED)
}}}
(Note that is just typed in - untested)
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/2462#comment:14>
MythTV <http://svn.mythtv.org/trac>
MythTV
More information about the mythtv-commits
mailing list