int main(int, char **) { AhiInit(0); AhiTerm(); return 0; }
bool QAhiScreen::connect(const QString &displaySpec) { Q_UNUSED(displaySpec); AhiSts_t status; status = AhiInit(0); if (status != AhiStsOk) { qCritical("QAhiScreen::connect(): AhiInit failed: %x", status); return false; } AhiDev_t device; AhiDevInfo_t info; status = AhiDevEnum(&device, &info, 0); if (status != AhiStsOk) { qCritical("QAhiScreen::connect(): AhiDevEnum failed: %x", status); return false; } #ifdef QAHISCREEN_DEBUG { int displayNo = 0; AhiDevInfo_t dispInfo = info; qDebug("AHI supported devices:"); do { qDebug(" %2i: %s, sw version: %s (rev %u)\n" " chip: 0x%x (rev %u), mem: %i (%i/%i), bus: 0x%x", displayNo, dispInfo.name, dispInfo.swVersion, uint(dispInfo.swRevision), uint(dispInfo.chipId), uint(dispInfo.revisionId), uint(dispInfo.totalMemory), uint(dispInfo.internalMemSize), uint(dispInfo.externalMemSize), uint(dispInfo.cpuBusInterfaceMode)); status = AhiDevEnum(&device, &info, ++displayNo); } while (status == AhiStsOk); } #endif status = AhiDevOpen(&d_ptr->context, device, "qscreenahi", AHIFLAG_USERLEVEL); if (status != AhiStsOk) { qCritical("QAhiScreen::connect(): AhiDevOpen failed: %x", status); return false; } AhiDispMode_t mode; status = AhiDispModeEnum(d_ptr->context, &mode, 0); if (status != AhiStsOk) { qCritical("QAhiScreen::connect(): AhiDispModeEnum failed: %x", status); return false; } #ifdef QAHISCREEN_DEBUG { int modeNo = 0; AhiDispMode_t modeInfo = mode; qDebug("AHI supported modes:"); do { qDebug(" %2i: %ux%u, fmt: %i, %u Hz, rot: %i, mirror: %i", modeNo, uint(modeInfo.size.cx), uint(modeInfo.size.cy), modeInfo.pixFmt, uint(modeInfo.frequency), modeInfo.rotation, modeInfo.mirror); status = AhiDispModeEnum(d_ptr->context, &modeInfo, ++modeNo); } while (status == AhiStsOk); } #endif if (QApplication::type() == QApplication::GuiServer) { if (!d_ptr->setMode(mode)) return false; } else { status = AhiDispSurfGet(d_ptr->context, &d_ptr->surface); if (status != AhiStsOk) { qCritical("QAhiScreen::connect(): AhiDispSurfGet failed: %x", status); return false; } status = AhiDispModeGet(d_ptr->context, &mode); if (status != AhiStsOk) { qCritical("QAhiScreen::context(): AhiDispModeGet failed: %x", status); return false; } } return configure(); }