Jump to content


Photo

Issue with filtering on demux device DM500+


  • Please log in to reply
13 replies to this topic

#1 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 1 June 2008 - 20:57

Hi
I use PLI on my DM500+. I have created a development environment and was able to build a DM500+ image successfully. Now I tried to run some Linux DVB API test code. However every time the ioctl command with parameter DMX_SET_FILTER fails with the message: Invalid Argument. I have copy/pasted example code from the internet but every time get the same message! Any idea what is wrong? I suspect maybe issues with the demux device or the wrong dmx.h file?!?!

#include <fcntl.h>
#include "/data/dreambox/tuxbox-bb/build/tmp/work/linux-dm500plus-2.6.12-r1/linux-2.6.12/include/linux/dvb/dmx.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/poll.h>

int main(int argc,char* argv[])
{
  	int fd,ca,program_number,tfd;

  	if ((fd = open("/dev/dvb/card0/demux0",O_RDWR|O_NONBLOCK)) < 0)
  	{
    	perror("DEMUX DEVICE");
    	return -1;
  	}

	printf("DMX Filter size: %d\n", DMX_FILTER_SIZE);

	//Filter for the PAT
	struct dmx_sct_filter_params flt;
	memset(&flt,0,sizeof(flt));
	flt.filter.filter[0]=0;
	flt.filter.mask[0]=0xff;
	flt.timeout=1000;
        flt.pid=0;
	flt.flags=DMX_IMMEDIATE_START;
	if (ioctl(fd, DMX_SET_FILTER, &flt) < 0) 
		perror("Error in filter");
}

DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #2 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 1 June 2008 - 22:02

Hmmm, looks like I found it....
Can anyone from the PLi dev team confirm that the DVB API version 1 is used and not the DVB API version 3? I found some code on the internet that checked on the availability of devlce /dev/dvb/cardn/demuxn. If it exists its apparently API release 1, if the device /dev/dvb/devicen/demuxn is used it should be API release 3. When I compile the release 1 code then it seems to work.
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #3 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 2 June 2008 - 22:07

thats correct, it implements a subset of dvb api 1 (linuxtv)

Re: Issue with filtering on demux device DM500+ #4 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 8 June 2008 - 22:49

ok, thanks.

Would you happen to know how I can retrieve the currently selected program_number or PID from the API on the Dreambox? Somehow I can only find the API version 3, and also its not documented how this should be done.
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #5 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 8 June 2008 - 23:12

that's not possible, even with api 3
You know it's not just one pid which is selected?
Multiple filters are running (pes and section) on different pids, when enigma is tuned into a channel.

Re: Issue with filtering on demux device DM500+ #6 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 14 June 2008 - 12:20

I am not sure we are talking about the same issue here....

When I am writing code for the Dreambox (OE), how can I find out on what channel the box is tuned at this moment?

I found some old code from MGCAMD but this does not seem to make sense at all, as it looks like the program number is being received from the command line (argv[..]).
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #7 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 14 June 2008 - 13:04

you could connect to enigma's capmt socket (/tmp/.listen.camd.socket) and receive capmt objects, in which you'll find the serviceid.

Re: Issue with filtering on demux device DM500+ #8 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 14 June 2008 - 13:44

Thanks, will try it!!!!!!
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #9 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 19 June 2008 - 15:29

Works!!! Thanks a lot.
Now I have another issue, which you might possibly help me with. When I have set a filter with the code above, (ioctl(fd, DMX_SET_FILTER, &sFP)) every next ioctl on the fd results in a "Illegal Seek" error. The Illegal Seek should be referring to the ioctl command and does not seem to come from the DVB API. Even when I close fd and reopen it again its everytime the illegal seek error.
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #10 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 19 June 2008 - 15:42

But DMX_SET_FILTER itself succeeds?
what are you trying to do after DMX_SET_FILTER?
Probably the only valid actions on a configured filter are START and STOP

Re: Issue with filtering on demux device DM500+ #11 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 19 June 2008 - 15:47

yes, it itself succeeds (see code above). Then I read the PAT so I use read to read 4096 bytes from fd.
When I then try to do an ioctl(fd, DMX_STOP) I get the famous seek error
DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #12 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 19 June 2008 - 15:49

perhaps you started it as a oneshot filter?

EDIT: looking at your code, you're not. But perhaps the timeout is causing problems.
Note that the 500 implements a very limited subset of the DVB api, don't be surprised if things don't work as expected.
In case of problems, look at how enigma uses the demux devices, cause that way they do work.

Re: Issue with filtering on demux device DM500+ #13 Dirktator

  • Senior Member
  • 52 posts

0
Neutral

Posted 19 June 2008 - 16:13

Works now.....

I checked if the ioctl returns a -1, if so it shows a
perror("Status");
if not -1 I also used a
perror ("status")
to show it was successfull

Stupidly enough this perror message creates the illegal seek message (no clue how).
if (ioctl(fd, DMX_SET_FILTER, &sFP) < 0)  
  	{
    	perror("\tStatus");
    	return 0;
  	}
	perror("\tStatus: success!\n");     <====== this creates the Illegal Seek!!!!
	return 1;


DM500+, DM8000HD, rotor, 88cm dish Mac and MacBook

Re: Issue with filtering on demux device DM500+ #14 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 19 June 2008 - 16:57

that would be normal, errno is only valid till the next systemcall, after that it's not defined (unless the systemcall returned an error)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users