1/* 2cc -g -o /tmp/isagp isagp.c -framework ApplicationServices -framework IOKit -Wall 3*/ 4 5#include <CoreFoundation/CoreFoundation.h> 6#include <ApplicationServices/ApplicationServices.h> 7#include <IOKit/graphics/IOGraphicsLib.h> 8#include <stdlib.h> 9#include <stdio.h> 10 11 12int main(int argc, char * argv[]) 13{ 14 io_service_t device; 15 io_service_t framebuffer; 16 io_service_t accelerator; 17 UInt32 framebufferIndex; 18 CGError err; 19 int i; 20 CGDisplayCount max; 21 CGDirectDisplayID displayIDs[8]; 22 23 err = CGGetOnlineDisplayList(8, displayIDs, &max); 24 if(err != kCGErrorSuccess) 25 exit(1); 26 if(max > 8) 27 max = 8; 28 29 for(i = 0; i < max; i++ ) { 30 31 framebuffer = CGDisplayIOServicePort(displayIDs[i]); 32 33 err = IOAccelFindAccelerator(framebuffer, &accelerator, &framebufferIndex); 34 if(kIOReturnSuccess != err) 35 continue; 36 37 err = IORegistryEntryGetParentEntry(accelerator, kIOServicePlane, &device); 38 IOObjectRelease(accelerator); 39 if(kIOReturnSuccess != err) 40 continue; 41 42 printf("Display ID %p ", displayIDs[i]); 43 if(IOObjectConformsTo(device, "IOAGPDevice")) 44 printf("is"); 45 else 46 printf("isn't"); 47 printf(" agp\n"); 48 49 IOObjectRelease(device); 50 } 51 52 exit(0); 53 return(0); 54} 55 56