void SC_HID_APIManager::handleElement( int joy_idx, struct hid_device_element * ele, std::atomic<bool> const & shouldBeRunning ){ int status = lockLanguageOrQuit(shouldBeRunning); if (status == EINTR) return; if (status) { postfl("error when locking language (%d)\n", status); return; } if (compiledOK) { VMGlobals* g = gMainVMGlobals; g->canCallOS = false; ++g->sp; SetObject(g->sp, s_hidapi->u.classobj ); // set the class HID_API ++g->sp; SetInt(g->sp, joy_idx ); ++g->sp; SetInt(g->sp, ele->index ); ++g->sp; SetInt(g->sp, ele->usage_page ); ++g->sp; SetInt(g->sp, ele->usage ); ++g->sp; SetInt(g->sp, ele->value ); ++g->sp; SetFloat(g->sp, hid_element_map_logical( ele ) ); ++g->sp; SetFloat(g->sp, hid_element_map_physical( ele ) ); ++g->sp; SetInt(g->sp, ele->array_value ); runInterpreter(g, s_hidElementData, 9 ); g->canCallOS = false; } gLangMutex.unlock(); }
void SC_HID_APIManager::deviceClosed( int joy_idx, struct hid_dev_desc * dd, std::atomic<bool> const & shouldBeRunning ){ int status = lockLanguageOrQuit(shouldBeRunning); if (status == EINTR) return; if (status) { trace("error when locking language (%d)\n", status); return; } if (compiledOK) { VMGlobals* g = gMainVMGlobals; g->canCallOS = false; ++g->sp; SetObject(g->sp, s_hidapi->u.classobj ); // set the class HID_API ++g->sp; SetInt(g->sp, joy_idx ); runInterpreter(g, s_hidClosed, 2); g->canCallOS = false; } gLangMutex.unlock(); }
void SerialPort::doneAction() { int status = lockLanguageOrQuit(m_dodone); if (status == EINTR) return; if (status) { postfl("error when locking language (%d)\n", status); return; } PyrSymbol *method = s_doneAction; if (m_obj) { VMGlobals *g = gMainVMGlobals; g->canCallOS = true; ++g->sp; SetObject(g->sp, m_obj); runInterpreter(g, method, 1); g->canCallOS = false; } gLangMutex.unlock(); }
void SerialPort::dataAvailable() { int status = lockLanguageOrQuit(m_running); if (status == EINTR) return; if (status) { postfl("error when locking language (%d)\n", status); return; } PyrSymbol *method = s_dataAvailable; if (m_obj) { VMGlobals *g = gMainVMGlobals; g->canCallOS = true; ++g->sp; SetObject(g->sp, m_obj); runInterpreter(g, method, 1); g->canCallOS = false; } pthread_mutex_unlock (&gLangMutex); }
void SC_HID_APIManager::handleDevice( int joy_idx, struct hid_dev_desc * devd, std::atomic<bool> const & shouldBeRunning ){ int status = lockLanguageOrQuit(shouldBeRunning); if (status == EINTR) return; if (status) { postfl("error when locking language (%d)\n", status); return; } if (compiledOK) { VMGlobals* g = gMainVMGlobals; g->canCallOS = false; ++g->sp; SetObject(g->sp, s_hidapi->u.classobj ); // set the class HID_API ++g->sp; SetInt(g->sp, joy_idx ); ++g->sp; SetInt(g->sp, devd->device_collection->num_elements ); runInterpreter(g, s_hidDeviceData, 3); g->canCallOS = false; } gLangMutex.unlock(); }