236 |
|
return; |
237 |
|
} |
238 |
|
|
239 |
– |
|
239 |
|
// Iterate through each floppy |
240 |
|
while ( nextFloppy = IOIteratorNext(allFloppies)) |
241 |
|
{ |
242 |
|
char bsdPath[MAXPATHLEN]; |
244 |
– |
CFTypeRef bsdPathAsCFString = |
245 |
– |
IORegistryEntryCreateCFProperty(nextFloppy, |
246 |
– |
CFSTR(kIOBSDNameKey), |
247 |
– |
kCFAllocatorDefault, 0); |
243 |
|
long size; |
244 |
|
CFTypeRef sizeAsCFNumber = |
245 |
|
IORegistryEntryCreateCFProperty(nextFloppy, |
252 |
|
D(bug("Got size of %ld\n", size)); |
253 |
|
if ( size < 800 * 1024 || size > 1440 * 1024 ) |
254 |
|
{ |
255 |
< |
D(puts("Device does not appear to be 800k or 1440k\n")); |
255 |
> |
D(puts("Device does not appear to be 800k or 1440k")); |
256 |
|
continue; |
257 |
|
} |
258 |
|
} |
259 |
< |
else |
260 |
< |
bug("Couldn't get kIOMediaSizeKey of device\n"); |
261 |
< |
|
262 |
< |
|
268 |
< |
*bsdPath = '\0'; |
269 |
< |
if ( bsdPathAsCFString ) |
270 |
< |
{ |
271 |
< |
size_t devPathLength; |
272 |
< |
|
273 |
< |
strcpy(bsdPath, "/dev/"); |
274 |
< |
devPathLength = strlen(bsdPath); |
275 |
< |
|
276 |
< |
if ( CFStringGetCString((const __CFString *)bsdPathAsCFString, |
277 |
< |
bsdPath + devPathLength, |
278 |
< |
MAXPATHLEN - devPathLength, |
279 |
< |
kCFStringEncodingASCII) ) |
280 |
< |
{ |
281 |
< |
D(bug("Floppy BSD path: %s\n", bsdPath)); |
282 |
< |
PrefsAddString("floppy", bsdPath); |
283 |
< |
} |
284 |
< |
else |
285 |
< |
D(bug("Could not get BSD device path for floppy\n")); |
259 |
> |
else { |
260 |
> |
D(puts("Couldn't get kIOMediaSizeKey of device")); |
261 |
> |
continue; // if kIOMediaSizeKey is unavailable, we shouldn't use it anyway |
262 |
> |
} |
263 |
|
|
264 |
< |
CFRelease(bsdPathAsCFString); |
264 |
> |
if (get_device_path(nextFloppy, bsdPath, sizeof(bsdPath)) == KERN_SUCCESS) { |
265 |
> |
PrefsAddString("floppy", bsdPath); |
266 |
> |
} else { |
267 |
> |
D(bug("Could not get BSD device path for floppy\n")); |
268 |
|
} |
289 |
– |
else |
290 |
– |
D(bug("Cannot determine bsdPath for floppy\n")); |
269 |
|
} |
270 |
|
|
271 |
|
IOObjectRelease(nextFloppy); |