Results 1 to 3 of 3

Thread: bytesAvailable() allways returning 0

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    2
    Platforms
    MacOS X Unix/X11

    Default bytesAvailable() allways returning 0

    ok here is the background, Im trying to open /dev/dvb/adapter0/demux0 for read/write. I know the write (ioctl) is successful as I can see it setup in my kernel logs. but no matter what I try bytesAvailable() always returns 0.

    Qt Code:
    1. dmx_fd = new QFile("/dev/dvb/adapter0/demux0");
    2. if (!dmx_fd->open(QIODevice::ReadWrite))
    3. cout << "open() failed" << endl;
    4.  
    5. struct dmx_sct_filter_params sctfilter;
    6. memset(&sctfilter, 0, sizeof(struct dmx_sct_filter_params));
    7. sctfilter.pid = 0x11;
    8. sctfilter.timeout = 5000;
    9. sctfilter.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC;
    10.  
    11. if (ioctl(dmx_fd->handle(), DMX_SET_FILTER, &sctfilter) == -1)
    12. cout << "DEMUX: DMX_SET_FILTER" << endl;
    13.  
    14. cout << "isSequential() = " << dmx_fd->isSequential() << endl;
    15. cout << "isReadable() = " << dmx_fd->isReadable() << endl;
    16. cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
    17.  
    18. dmx_fd->waitForReadyRead(5000);
    19. sleep(5);
    20.  
    21. cout << "isReadable() = " << dmx_fd->isReadable() << endl;
    22. cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
    23.  
    24. buffer.clear();
    25. buffer = dmx_fd->read(dmx_fd->bytesAvailable());
    26. cout << "Length read: " << buffer.size() << endl;
    27.  
    28. ioctl(dmx_fd->handle(), DMX_STOP);
    29. dmx_fd->close();
    To copy to clipboard, switch view to plain text mode 

    outputs

    Qt Code:
    1. Starting /home/updatelee/src/untitled/untitled...
    2. isSequential() = 1
    3. isReadable() = 1
    4. bytesAvailable() = 0
    5. isReadable() = 1
    6. bytesAvailable() = 0
    7. Length read: 0
    8. /home/updatelee/src/untitled/untitled exited with code 0
    To copy to clipboard, switch view to plain text mode 

    Ive got the adapter tuned by another app if anyone was wondering. The demux is ready to accept pids as I can use my C app on it just fine, as well as my b*stardized qt app with :pen() calls.

    QMake version 2.01a
    Using Qt version 4.8.3 in /usr/lib/x86_64-linux-gnu
    Qt Creator 2.5.2

    Any idea's ?
    Attached Files Attached Files

Similar Threads

  1. QTreView::isExpanded ( index ) allways false ?
    By jpujolf in forum Qt Programming
    Replies: 3
    Last Post: 24th September 2010, 10:23
  2. Does bytesAvailable() decrease when read() is called?
    By ShaChris23 in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2010, 21:16
  3. QUdpSocket and bytesAvailable
    By babu198649 in forum Newbie
    Replies: 0
    Last Post: 10th December 2008, 10:49
  4. Replies: 9
    Last Post: 4th June 2008, 12:29
  5. QIODevice::bytesAvailable() always returning 0
    By quickNitin in forum Newbie
    Replies: 6
    Last Post: 14th June 2006, 13:04

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
  •  
Qt is a trademark of The Qt Company.