From f1cc4e29d3b8b02a4239242f8c4365c6eedfcdcc Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 29 Apr 2012 16:26:01 +0100 Subject: [PATCH] Changed Mac OS X SDK check so it detects correct path for 10.3 and 10.4, not only >=10.5. Tested it compiles and works on 10.3, 10.4, 10.5, 10.6 and 10.7. If Mac OS X SDK is 10.5, include bluray headers, if not manually define the BD media class for IOKit travelling. When searching for an optical drive, search also for BD media class, so if drive is a BD with a BD disc it will be found (BD with CD or DVD discs were found before). --- lib/driver/osx.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/driver/osx.c b/lib/driver/osx.c index 839e0771..28bdd86e 100644 --- a/lib/driver/osx.c +++ b/lib/driver/osx.c @@ -70,7 +70,7 @@ typedef enum { #include #include -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1040 +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1030 # include #else # include @@ -92,7 +92,7 @@ typedef enum { #include #include #include -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1040 +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1030 # include #else # include @@ -106,6 +106,14 @@ typedef enum { #include #include +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +#include +#include +#include +#else +#define kIOBDMediaClass "IOBDMedia" // It does not hurt, simplyfies rest of code +#endif + #ifdef HAVE_DISKARBITRATION #include #endif @@ -309,10 +317,11 @@ init_osx(_img_private_t *p_env) { p_env->MediaClass_service = IOIteratorNext( iterator ); IOObjectRelease( iterator ); - /* search for kIOCDMediaClass or kIOCDVDMediaClass */ + /* search for kIOCDMediaClass or kIODVDMediaClass or kIOBDMediaClass */ while( p_env->MediaClass_service && (!IOObjectConformsTo(p_env->MediaClass_service, kIOCDMediaClass)) && - (!IOObjectConformsTo(p_env->MediaClass_service, kIODVDMediaClass)) ) + (!IOObjectConformsTo(p_env->MediaClass_service, kIODVDMediaClass)) && + (!IOObjectConformsTo(p_env->MediaClass_service, kIOBDMediaClass)) ) { ret = IORegistryEntryGetParentIterator( p_env->MediaClass_service, @@ -326,12 +335,13 @@ init_osx(_img_private_t *p_env) { } IOObjectRelease( p_env->MediaClass_service ); + p_env->MediaClass_service = IOIteratorNext( iterator ); IOObjectRelease( iterator ); } if ( 0 == p_env->MediaClass_service ) { - cdio_warn( "search for kIOCDMediaClass/kIODVDMediaClass came up empty" ); + cdio_warn( "search for kIOCDMediaClass/kIODVDMediaClass/kIOBDMediaClass came up empty" ); return false; } @@ -1835,7 +1845,8 @@ cdio_get_default_device_osx(void) { /* Skip other removable media, like USB flash memory keys: */ if (!IOObjectConformsTo(next_media, kIODVDMediaClass) && - !IOObjectConformsTo(next_media, kIOCDMediaClass)) + !IOObjectConformsTo(next_media, kIOCDMediaClass) && + !IOObjectConformsTo(next_media, kIOBDMediaClass)) continue; str_bsd_path = IORegistryEntryCreateCFProperty( next_media, @@ -1868,7 +1879,7 @@ cdio_get_default_device_osx(void) } while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 ); } IOObjectRelease( media_iterator ); - cdio_warn ("cdio_get_default_device() - No CD/DVD media - returning NULL"); + cdio_warn ("cdio_get_default_device() - No CD/DVD/BD media - returning NULL"); return NULL; #endif /* HAVE_DARWIN_CDROM */ }