updatelee
28th October 2012, 05:34
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.
dmx_fd = new QFile("/dev/dvb/adapter0/demux0");
if (!dmx_fd->open(QIODevice::ReadWrite))
cout << "open() failed" << endl;
struct dmx_sct_filter_params sctfilter;
memset(&sctfilter, 0, sizeof(struct dmx_sct_filter_params));
sctfilter.pid = 0x11;
sctfilter.timeout = 5000;
sctfilter.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC;
if (ioctl(dmx_fd->handle(), DMX_SET_FILTER, &sctfilter) == -1)
cout << "DEMUX: DMX_SET_FILTER" << endl;
cout << "isSequential() = " << dmx_fd->isSequential() << endl;
cout << "isReadable() = " << dmx_fd->isReadable() << endl;
cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
dmx_fd->waitForReadyRead(5000);
sleep(5);
cout << "isReadable() = " << dmx_fd->isReadable() << endl;
cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
buffer.clear();
buffer = dmx_fd->read(dmx_fd->bytesAvailable());
cout << "Length read: " << buffer.size() << endl;
ioctl(dmx_fd->handle(), DMX_STOP);
dmx_fd->close();
outputs
Starting /home/updatelee/src/untitled/untitled...
isSequential() = 1
isReadable() = 1
bytesAvailable() = 0
isReadable() = 1
bytesAvailable() = 0
Length read: 0
/home/updatelee/src/untitled/untitled exited with code 0
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 ::open() 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 ?
dmx_fd = new QFile("/dev/dvb/adapter0/demux0");
if (!dmx_fd->open(QIODevice::ReadWrite))
cout << "open() failed" << endl;
struct dmx_sct_filter_params sctfilter;
memset(&sctfilter, 0, sizeof(struct dmx_sct_filter_params));
sctfilter.pid = 0x11;
sctfilter.timeout = 5000;
sctfilter.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC;
if (ioctl(dmx_fd->handle(), DMX_SET_FILTER, &sctfilter) == -1)
cout << "DEMUX: DMX_SET_FILTER" << endl;
cout << "isSequential() = " << dmx_fd->isSequential() << endl;
cout << "isReadable() = " << dmx_fd->isReadable() << endl;
cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
dmx_fd->waitForReadyRead(5000);
sleep(5);
cout << "isReadable() = " << dmx_fd->isReadable() << endl;
cout << "bytesAvailable() = " << dmx_fd->bytesAvailable() << endl;
buffer.clear();
buffer = dmx_fd->read(dmx_fd->bytesAvailable());
cout << "Length read: " << buffer.size() << endl;
ioctl(dmx_fd->handle(), DMX_STOP);
dmx_fd->close();
outputs
Starting /home/updatelee/src/untitled/untitled...
isSequential() = 1
isReadable() = 1
bytesAvailable() = 0
isReadable() = 1
bytesAvailable() = 0
Length read: 0
/home/updatelee/src/untitled/untitled exited with code 0
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 ::open() 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 ?