bool QBBVirtualKeyboard::connect() { close(); mEncoder = new pps_encoder_t; mDecoder = new pps_decoder_t; pps_encoder_initialize(mEncoder, false); pps_decoder_initialize(mDecoder, NULL); errno = 0; mFd = ::open(sPPSPath, O_RDWR); if (mFd == -1) { qCritical("QBBVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).", sPPSPath, strerror(errno), errno); close(); return false; } mBuffer = new char[sBufferSize]; if (!mBuffer) { qCritical("QBBVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", sBufferSize); return false; } if (!queryPPSInfo()) return false; start(); return true; }
bool QQnxVirtualKeyboardPps::connect() { close(); m_encoder = new pps_encoder_t; m_decoder = new pps_decoder_t; pps_encoder_initialize(m_encoder, false); pps_decoder_initialize(m_decoder, 0); errno = 0; m_fd = ::open(ms_PPSPath, O_RDWR); if (m_fd == -1) { qCritical("QQnxVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).", ms_PPSPath, strerror(errno), errno); close(); return false; } m_buffer = new char[ms_bufferSize]; if (!m_buffer) { qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", ms_bufferSize); return false; } if (!queryPPSInfo()) return false; m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read); QObject::connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(ppsDataReady())); return true; }