/* Can be called directly from ide.c. */ int __init ali14xx_init(void) { /* auto-detect IDE controller port */ if (findPort()) { if (ali14xx_probe()) return -ENODEV; return 0; } printk(KERN_ERR "ali14xx: not found.\n"); return -ENODEV; }
pthread_t daemonStart(unsigned int window, unsigned short basePort, char *logName) { pthread_t thread; ViewerWindow = window; initLog(logName); daemonPort = findPort(basePort,DEFAULT_END); srvSock = listenOnPort(daemonPort); fprintf(logfd, "\nSet GLSTUB var in guest to point to port %hu\n", daemonPort); if (pthread_create(&thread,NULL,acceptLoop,NULL)) fail("couldn't create thread"); return thread; }
static int __init ali14xx_init(void) { if (probe_ali14xx == 0) goto out; /* auto-detect IDE controller port */ if (findPort()) { if (ali14xx_probe()) return -ENODEV; return 0; } printk(KERN_ERR "ali14xx: not found.\n"); out: return -ENODEV; }
bool CMMDVMController::start() { findPort(); bool ret = openModem(); if (!ret) return false; findPath(); Create(); SetPriority(100U); Run(); return true; }
bool CDVRPTRControllerV2::open() { findPort(); bool ret = openModem(); if (!ret) return false; findPath(); Create(); SetPriority(100U); Run(); return true; }
void QX11VideoSurface::setWinId(WId id) { //qDebug() << "setWinID:" << id; if (id == m_winId) return; if (m_image) XFree(m_image); if (m_gc) { XFreeGC(QX11Info::display(), m_gc); m_gc = 0; } if (m_portId != 0) XvUngrabPort(QX11Info::display(), m_portId, 0); m_supportedPixelFormats.clear(); m_formatIds.clear(); m_winId = id; if (m_winId && findPort()) { querySupportedFormats(); m_gc = XCreateGC(QX11Info::display(), m_winId, 0, 0); if (m_image) { m_image = 0; if (!start(surfaceFormat())) { QAbstractVideoSurface::stop(); qWarning() << "Failed to start video surface with format" << surfaceFormat(); } } } else { qWarning() << "Failed to find XVideo port"; if (m_image) { m_image = 0; QAbstractVideoSurface::stop(); } } emit supportedFormatsChanged(); }
const Port *PortManager::getPort(const int moduleID, const std::string & name) { if (const Port *p = PortTracker::getPort(moduleID, name)) return p; std::string::size_type p = name.find('['); if (p != std::string::npos) { Port *parent = findPort(moduleID, name.substr(0, p-1)); if (parent && (parent->flags() & Port::MULTI)) { size_t idx=boost::lexical_cast<size_t>(name.substr(p+1)); const Port *port = parent->child(idx); m_clusterManager->sendMessage(moduleID, message::AddPort(*port)); return port; } } return NULL; }
bool CDVRPTRControllerV2::findModem() { m_serial.close(); // Tell the repeater that the signal has gone away if (m_rx) { purgeRX(); m_mutex.Lock(); unsigned char data[2U]; data[0U] = DQT_EOT; data[1U] = 0U; m_rxData.addData(data, 2U); m_mutex.Unlock(); m_rx = false; } unsigned int count = 0U; // Purge the transmit buffer every 500ms to avoid overflow, but only try and reopen the modem every 2s while (!m_stopped) { purgeTX(); count++; if (count >= 4U) { wxLogMessage(wxT("Trying to reopen the modem")); bool ret = findPort(); if (ret) { ret = openModem(); if (ret) return true; } count = 0U; } Sleep(500UL); } return false; }
void init_ali14xx (void) { /* auto-detect IDE controller port */ if (!findPort()) { printk("ali14xx: not found\n"); return; } printk("ali14xx: base= 0x%03x, regOn = 0x%02x\n", basePort, regOn); ide_hwifs[0].chipset = ide_ali14xx; ide_hwifs[1].chipset = ide_ali14xx; ide_hwifs[0].tuneproc = &ali14xx_tune_drive; ide_hwifs[1].tuneproc = &ali14xx_tune_drive; /* initialize controller registers */ if (!initRegisters()) { printk("ali14xx: Chip initialization failed\n"); return; } }
static void *acceptLoop(void *blah) { unsigned int tmp; int sock; char *glStubArgs[8]; unsigned short firstPort, secondPort, writeBuf[2]; pid_t pid; size_t writeLen = sizeof(unsigned short) * 2; signal(SIGCHLD, reaper); glStubArgs[0] = "glstub"; glStubArgs[1] = "-port"; if (ViewerWindow) { glStubArgs[3] = "-v"; glStubArgs[4] = (char *) malloc(sizeof(char)*32); sprintf(glStubArgs[4], "%u", ViewerWindow); glStubArgs[5] = "-q"; glStubArgs[7] = (char *) NULL; } else glStubArgs[3]= (char *) NULL; for(;;) { if ((sock = accept(srvSock, (struct sockaddr *) NULL, &tmp)) <= 0) fail("accept on socket"); if (!(firstPort = findPort(daemonPort+1,DEFAULT_END))) { close(sock); fail("couldn't find any available open ports"); } writeBuf[0] = htons(firstPort); glStubArgs[2] = (char *) malloc(sizeof(char)*8); sprintf(glStubArgs[2], "%d", firstPort); if (ViewerWindow) { if (!(secondPort = findPort(firstPort+1,DEFAULT_END))) { close(sock); fail("couldn't find any available open ports"); } writeBuf[1] = htons(secondPort); glStubArgs[6] = (char *) malloc(sizeof(char)*8); sprintf(glStubArgs[6], "%d", secondPort); } /* Found all ports, glStubArgs and writeBuf are ready. First fork, then send */ if ((pid = fork()) < 0) { /* Fork failed */ close(sock); fail("couldn't fork"); } if (!pid) { /* Fork succesful, child */ execvp("glstub", glStubArgs); /* We're still executing here, means fork failed */ fail("exec for child failed"); } /* Fork succesful, parent: send writeBuf */ usleep(1000*250); if (write(sock, (void *) writeBuf, writeLen) != (ssize_t) writeLen) { /* Failure, kill the newborn */ kill(pid, SIGINT); close(sock); fail("write on socket"); } /* All done, finish */ free(glStubArgs[2]); if (ViewerWindow) free(glStubArgs[6]); if (close(sock)) fail("close on socket"); } /* Should never get here */ if (close(srvSock)) fail("close on socket"); return blah; }