[Qt-interest] QFile.waitForReadyRead() not working on dev file

Linus Casassa linus at lin.cl
Wed Mar 18 07:15:51 CET 2009


Hi

waitForReadyRead() always returns 0 without waiting 1 second. It prints
thousands of "looping"s.

The reading works grate if I take waitForReadyRead() out but it gets blocked
until data arrives so I can't do other things in the meanwhile..

QFile device("/dev/input/js0");
if ( !device.open( QIODevice::ReadOnly ) )
{
    qWarning( "Failed opening device." );
    return FALSE;
}

while(1) {
    if ( device.waitForReadyRead(1000))
        if ( device.read( (char*)&data, data_sz ) == data_sz )
            ...
    qWarning("looping");
}

Thank you very much in advance.


-- 
Linus Casassa
Estudiante Ingeniería Civil Electrónica
Fono: 56-9-97776941
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090318/1c7fafee/attachment.html 


More information about the Qt-interest-old mailing list