Index: ./libs/libmyth/mythcdrom.cpp =================================================================== RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcdrom.cpp,v retrieving revision 1.5 diff -u -r1.5 mythcdrom.cpp --- ./libs/libmyth/mythcdrom.cpp 24 Feb 2004 07:31:08 -0000 1.5 +++ ./libs/libmyth/mythcdrom.cpp 4 Jun 2004 00:06:36 -0000 @@ -1,6 +1,10 @@ #include "mythcdrom.h" #include // ioctls +#ifdef __FreeBSD__ +#include +#else #include // old ioctls for cdrom +#endif #include #include "mythcontext.h" @@ -37,7 +41,11 @@ { // If allow eject is on, unlock the door. if (m_AllowEject) +#ifdef __FreeBSD__ + (void) ioctl (m_DeviceHandle, CDIOCALLOW); +#else ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 0); +#endif return true; } @@ -47,19 +55,32 @@ MediaError MythCDROM::eject() { +#ifdef __FreeBSD__ + return (ioctl(m_DeviceHandle, CDIOCEJECT) == 0) ? MEDIAERR_OK : + MEDIAERR_FAILED; +#else return (ioctl(m_DeviceHandle, CDROMEJECT) == 0) ? MEDIAERR_OK : MEDIAERR_FAILED; +#endif } bool MythCDROM::mediaChanged() { +#ifdef __FreeBSD__ + return (0); // no support for detecting media change +#else return (ioctl(m_DeviceHandle, CDROM_MEDIA_CHANGED, CDSL_CURRENT) > 0); +#endif } bool MythCDROM::checkOK() { +#ifdef __FreeBSD__ + return(1); +#else return (ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK); +#endif } // Helper function, perform a sanity check on the device @@ -88,7 +109,11 @@ } // Since the device was is/was open we can get it's status... +#ifdef __FreeBSD__ + int Stat = 1; +#else int Stat = ioctl(m_DeviceHandle, CDROM_DRIVE_STATUS, CDSL_CURRENT); +#endif // Be nice and close the device if we opened it, otherwise it might be locked when the user doesn't want it to be. if (OpenedHere) @@ -114,6 +139,7 @@ if (!isDeviceOpen()) OpenedHere = openDevice(); +#ifndef __FreeBSD__ if (isDeviceOpen()) { //cout << "device is open - "; @@ -210,6 +236,7 @@ }// mediaChanged() } // isDeviceOpen(); else +#endif // __FreeBSD__ { //cout << "device not open returning unknown" << endl; m_MediaType = MEDIATYPE_UNKNOWN; @@ -227,7 +254,11 @@ { MediaError ret = MythMediaDevice::lock(); if (ret == MEDIAERR_OK) +#ifdef __FreeBSD__ + ioctl(m_DeviceHandle, CDIOCPREVENT); +#else ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 1); +#endif return ret; } @@ -238,7 +269,11 @@ { // The call to the base unlock will close it if needed. VERBOSE( VB_ALL, "Unlocking CDROM door"); +#ifdef __FreeBSD__ + ioctl(m_DeviceHandle, CDIOCALLOW); +#else ioctl(m_DeviceHandle, CDROM_LOCKDOOR, 0); +#endif } else {