[mythtv-commits] Ticket #2462: Eject media button fails if tray is empt
MythTV
mythtv at cvs.mythtv.org
Tue Mar 20 07:00:24 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:
------------------------------------------+---------------------------------
Changes (by nigel):
* owner: stuartm => nigel
* status: new => assigned
Comment:
Slightly tested patch to allow opening empty CD/DVD drive's tray:
{{{
% svn diff libs/libmyth
Index: libs/libmyth/mythcdrom-linux.cpp
===================================================================
--- libs/libmyth/mythcdrom-linux.cpp (revision 13047)
+++ libs/libmyth/mythcdrom-linux.cpp (working copy)
@@ -10,6 +10,9 @@
MediaError MythCDROMLinux::eject(bool open_close)
{
+ if (!isDeviceOpen())
+ openDevice()
+
if (open_close)
return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK
:
MEDIAERR_FAILED;
@@ -96,11 +99,15 @@
// If the disk is ok but not yet mounted we'll test it
further down after this switch exits.
break;
case CDS_TRAY_OPEN:
- case CDS_NO_DISC:
- //cout << "Tray open or no disc" << endl;
+ //cout << "Tray open" << endl;
m_MediaType = MEDIATYPE_UNKNOWN;
return setStatus(MEDIASTAT_OPEN, OpenedHere);
break;
+ case CDS_NO_DISC:
+ //cout << "No disc" << endl;
+ m_MediaType = MEDIATYPE_UNKNOWN;
+ return setStatus(MEDIASTAT_NODISK, OpenedHere);
+ break;
case CDS_NO_INFO:
case CDS_DRIVE_NOT_READY:
//cout << "No info or drive not ready" << endl;
Index: libs/libmyth/mythmedia.h
===================================================================
--- libs/libmyth/mythmedia.h (revision 13047)
+++ libs/libmyth/mythmedia.h (working copy)
@@ -9,7 +9,8 @@
MEDIASTAT_ERROR,
MEDIASTAT_UNKNOWN,
MEDIASTAT_UNPLUGGED,
- MEDIASTAT_OPEN,
+ MEDIASTAT_OPEN, /**< CD/DVD tray open. Meaningless for other
types */
+ MEDIASTAT_NODISK, /**< CD/DVD tray closed, SCSI drive
unformatted? */
MEDIASTAT_USEABLE,
MEDIASTAT_NOTMOUNTED,
MEDIASTAT_MOUNTED
}}}
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/2462#comment:9>
MythTV <http://svn.mythtv.org/trac>
MythTV
More information about the mythtv-commits
mailing list