/* File: SCSIFindDevicesMain.c Contains: This sample shows how to locate all attached SCSI devices. Written by: Martin Minow. Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved. You may incorporate this Apple sample source code into your program(s) without restriction. This Apple sample source code has been provided "AS IS" and the responsibility for its operation is yours. You are not permitted to redistribute this Apple sample source code as "Apple sample source code" after having made changes. If you're going to re-distribute the source, we require that you make it clear in the source that the code was descended from Apple sample source code, but that you've made changes. Change History (most recent first): 7/14/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 */ #include #include #include #ifdef THINK_C #include #endif #include "SCSIFindDevices.h" SCSIFindDevicesRec gSCSIFindDevicesRec; void main( #ifdef THINK_C int argc, char **argv #endif ) { OSErr status; int devicesFound; #ifdef THINK_C argc = ccommand(&argv); #endif /* * Initialize the Find "global" area. If deviceID.bus is 0xFF, the * find subroutine will initialize and return the first device. * Set the maxLUN field to zero to prevent multiple LUN recognition * or set it to seven to enable all LUNs. */ gSCSIFindDevicesRec.deviceID.bus = 0xFF; gSCSIFindDevicesRec.maxLUN = 7; devicesFound = 0; while ((status = SCSIFindNextDevice(&gSCSIFindDevicesRec)) == noErr) { ++devicesFound; if (gSCSIFindDevicesRec.isAsyncSCSIPresent) { printf("%d.%d.%d \"%.8s\" \"%.16s\"\n", (int) gSCSIFindDevicesRec.deviceID.bus, (int) gSCSIFindDevicesRec.deviceID.targetID, (int) gSCSIFindDevicesRec.deviceID.LUN, gSCSIFindDevicesRec.inquiry.vendor, gSCSIFindDevicesRec.inquiry.product ); } else { printf("%d.%d \"%.8s\" \"%.16s\"\n", (int) gSCSIFindDevicesRec.deviceID.targetID, (int) gSCSIFindDevicesRec.deviceID.LUN, gSCSIFindDevicesRec.inquiry.vendor, gSCSIFindDevicesRec.inquiry.product ); } } if (status == eofErr) printf("Normal completion, %d devices found\n", devicesFound); else { printf("Failure: system error %d after finding %d devices\n", (int) status, devicesFound ); } if (gSCSIFindDevicesRec.isAsyncSCSIPresent) printf("Using asynchronous SCSI Manager\n"); else { printf("Using original SCSI Manager only\n"); } }