ControllerManager::~ControllerManager() { #if defined(__APPLE__) HIDReleaseAllDeviceQueues(); HIDReleaseDeviceList(); #endif }
/* PsychHIDCleanup() Cleanup before flushing the mex file. */ PsychError PsychHIDCleanup(void) { long error; error=PsychHIDReceiveReportsCleanup(); // PsychHIDReceiveReport.c if(HIDHaveDeviceList())HIDReleaseDeviceList(); return(PsychError_none); }
void releaseHIDDevices () { if (gTimer) { RemoveEventLoopTimer(gTimer); gTimer = NULL; } HIDReleaseAllDeviceQueues(); HIDReleaseDeviceList(); gNumberOfHIDDevices = 0; }
void EndHIDInput (void) { // remove timer if (gHIDTimer) RemoveEventLoopTimer (gHIDTimer); gHIDTimer = NULL; // dump array InitHIDInputArray (); // dump devices if (HIDHaveDeviceList()) HIDReleaseDeviceList (); }
/* PsychHIDCleanup() Cleanup before flushing the mex file. */ PsychError PsychHIDCleanup(void) { long error; pRecDevice curdev = NULL; // Disable online help system: PsychClearGiveHelp(); // Disable any kind of low-level stdin<->tty magic for character reception // or suppression in console mode (for octave and matlab -nojvm): ConsoleInputHelper(-10); // Shutdown USB-HID report low-level functions, e.g., for DAQ toolbox on OS/X: error = PsychHIDReceiveReportsCleanup(); // PsychHIDReceiveReport.c // Shutdown os specific interfaces and routines: PsychHIDShutdownHIDStandardInterfaces(); // Release all other HID device data structures: #if PSYCH_SYSTEM == PSYCH_OSX // Via Apple HIDUtils: #if (PSYCH_SYSTEM == PSYCH_OSX) && defined(__LP64__) int i; for (i = 0; i < MAXDEVICEINDEXS; i++) { if (deviceInterfaces[i]) { IOHIDDeviceInterface** interface = (IOHIDDeviceInterface**) deviceInterfaces[i]; (*interface)->close(interface); (*interface)->Release(interface); deviceInterfaces[i] = NULL; } } #endif if(HIDHaveDeviceList()) HIDReleaseDeviceList(); #else // Then our high-level list: while (hid_devices) { // Get current device record to release: curdev = hid_devices; // Advance to the next one for next loop iteration: hid_devices = hid_devices->pNext; // Interface attached aka device opened? If so we need to close the device handle: if (curdev->interface) hid_close((hid_device*) curdev->interface); // Release: free(curdev); } // Reset last hid device for error handling: last_hid_device = NULL; // Release the HIDLIB low-level device list: if (hidlib_devices) hid_free_enumeration(hidlib_devices); hidlib_devices = NULL; // Shutdown HIDAPI: hid_exit(); #endif // Close and release all open generic USB devices: PsychHIDCloseAllUSBDevices(); return(PsychError_none); }