// releases all device queues for quit or rebuild (must be called) // does not release device interfaces, application must call ReleaseHIDDeviceList on exit IOReturn HIDReleaseAllDeviceQueues( void ) { IOReturn result = kIOReturnSuccess; IOHIDDeviceRef tIOHIDDeviceRef = HIDGetFirstDevice(); while ( tIOHIDDeviceRef ) { result = HIDDequeueDevice( tIOHIDDeviceRef ); if ( kIOReturnSuccess != result ) { HIDReportErrorNum( "Could not dequeue device.", result ); } tIOHIDDeviceRef = HIDGetNextDevice( tIOHIDDeviceRef ); } return result; } /* HIDReleaseAllDeviceQueues */
int prHIDDequeueDevice(VMGlobals *g, int numArgsPushed) { PyrSlot *a = g->sp - 1; //class PyrSlot *b = g->sp; //locID device int locID; int err = slotIntVal(b, &locID); if (err) return err; //look for the right device: pRecDevice pCurrentHIDDevice = HIDGetFirstDevice (); while (pCurrentHIDDevice && (pCurrentHIDDevice->locID !=locID)) pCurrentHIDDevice = HIDGetNextDevice (pCurrentHIDDevice); if(!pCurrentHIDDevice) return errFailed; HIDDequeueDevice(pCurrentHIDDevice); return errNone; }