Results 1 to 4 of 4

Thread: QFile waitForReadyReadyRead() and bytesAvailable() not working on generic USB device

  1. #1
    Join Date
    Jan 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default QFile waitForReadyReadyRead() and bytesAvailable() not working on generic USB device

    Hi all,

    I'm having a problem where QFile.read() hangs until it eventually times out (several seconds) when reading from a USB device. I wrote the USB device driver (based on the OSRFX2 sample driver).

    Neither waitForReadyRead() or bytesAvailable() work as advertised.

    QFile.write() also has a delay which is unexpected but not problematic.

    I wrote a c program using the stdlib read()/write() functions and it works perfectly as expected.

    I am calling QFile.read() from within a QThread if that matters.

    I have searched all over the WEB for answers but can't find any answers.

    What could be the problem?

    Is there any way to abort a QFile.read()?

    Thanks,
    Andrew

  2. #2
    Join Date
    Jan 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QFile waitForReadyReadyRead() and bytesAvailable() not working on generic USB dev

    I want to add that there is data available to be read by QFile read but there is a few second delay before it returns.

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFile waitForReadyReadyRead() and bytesAvailable() not working on generic USB dev

    Quote Originally Posted by apargeter View Post
    Neither waitForReadyRead() or bytesAvailable() work as advertised.
    Here is an excerpt from the documentation of QFile:
    Unlike other QIODevice implementations, such as QTcpSocket, QFile does not emit the aboutToClose(), bytesWritten(), or readyRead() signals.
    IFAIK there is nothing in Qt for asynchronous file I/O. See https://bugreports.qt.io/browse/QTBUG-19345.

  4. #4
    Join Date
    Jan 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QFile waitForReadyReadyRead() and bytesAvailable() not working on generic USB dev

    Forgot to mention that I am doing all of this on Ubuntu LTS 14.0.4

Similar Threads

  1. Replies: 0
    Last Post: 11th December 2015, 15:59
  2. QFile not working with >>
    By timmu in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2011, 13:13
  3. QFile::Seek() not working
    By derrickbj in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2011, 20:14
  4. QGalleryQueryRequest not working on the device?
    By mismael85 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 6th July 2011, 07:40
  5. Generic USB Device communication
    By Gavin Harper in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2010, 23:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.