ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/sys_darwin.cpp
(Generate patch)

Comparing BasiliskII/src/MacOSX/sys_darwin.cpp (file contents):
Revision 1.4 by nigel, 2004-01-26T11:11:33Z vs.
Revision 1.7 by gbeauche, 2005-01-30T21:42:13Z

# Line 7 | Line 7
7   *
8   *      Based on Apple's CDROMSample.c and Evan Jones' cd-discid.c patches
9   *
10 < *  Basilisk II (C) 1997-2004 Christian Bauer
10 > *  Basilisk II (C) 1997-2005 Christian Bauer
11   *
12   *  This program is free software; you can redistribute it and/or modify
13   *  it under the terms of the GNU General Public License as published by
# Line 31 | Line 31
31   #import <IOKit/serial/IOSerialKeys.h>
32   #import <IOKit/storage/IOMedia.h>
33   #import <IOKit/storage/IOMediaBSDClient.h>
34 < #import <IOKit/storage/IOBlockStorageDevice.h>
34 > #ifdef MAC_OS_X_VERSION_10_2
35 >        #import <IOKit/storage/IOBlockStorageDevice.h>
36 > #endif
37   #import <IOKit/storage/IOCDMedia.h>
38   #import <IOKit/storage/IOCDMediaBSDClient.h>
39   #import <CoreFoundation/CoreFoundation.h>
# Line 128 | Line 130 | void DarwinAddCDROMPrefs(void)
130   void DarwinAddFloppyPrefs(void)
131   {
132          mach_port_t                             masterPort;             // The way to talk to the kernel
133 <        io_iterator_t                   allFloppies;    // List of CD drives on the system
133 >        io_iterator_t                   allFloppies;    // List of possible floppys
134          CFMutableDictionaryRef  classesToMatch;
135          io_object_t                             nextFloppy;
136  
# Line 137 | Line 139 | void DarwinAddFloppyPrefs(void)
139                  bug("IOMasterPort failed. Won't be able to do anything with floppy drives\n");
140  
141  
142 +        // This selects all partitions of all disks
143          classesToMatch = IOServiceMatching(kIOMediaClass);
144          if ( classesToMatch )
145          {
146 <                // We acually want removables that are _not_ CDs,
144 <                // but I don't know how to do that yet.
146 >                // Skip drivers and partitions
147                  CFDictionarySetValue(classesToMatch,
148 <                                                         CFSTR(kIOMediaRemovableKey), kCFBooleanTrue);
148 >                                                         CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
149 >        
150 >                // Skip fixed drives (hard disks?)
151 >                CFDictionarySetValue(classesToMatch,
152 >                                                         CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
153          }
154  
155          if ( IOServiceGetMatchingServices(masterPort,
# Line 162 | Line 168 | void DarwinAddFloppyPrefs(void)
168                                                  IORegistryEntryCreateCFProperty(nextFloppy,
169                                                                                                                  CFSTR(kIOBSDNameKey),
170                                                                                                                  kCFAllocatorDefault, 0);
171 +                long            size;
172 +                CFTypeRef       sizeAsCFNumber =
173 +                                                IORegistryEntryCreateCFProperty(nextFloppy,
174 +                                                                                                                CFSTR(kIOMediaSizeKey),
175 +                                                                                                                kCFAllocatorDefault, 0);
176 +
177 +                if ( CFNumberGetValue((CFNumberRef)sizeAsCFNumber,
178 +                                                                kCFNumberSInt32Type, &size) )
179 +                {
180 +                        D(bug("Got size of %ld\n", size));
181 +                        if ( size < 800 * 1024 || size > 1440 * 1024 )
182 +                        {
183 +                                D(puts("Device does not appear to be 800k or 1440k"));
184 +                                continue;
185 +                        }
186 +                }
187 +                else
188 +                        bug("Couldn't get kIOMediaSizeKey of device");
189 +                
190 +                
191                  *bsdPath = '\0';
192                  if ( bsdPathAsCFString )
193                  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines