I was debugging a small program of mine and found that:

- when I do a poll after opening the device, and not doing a read first, 
it would always give me a POLLERR instead of a POLLIN.

Example:

    videofd=open("/dev/video0",  O_RDONLY);

    // Add video device
    poll_item.fd = videofd;
    poll_item.events = POLLIN;
    poll_item.revents = 0;

    // poll infinite
    retvalue = poll(&poll_item, 1, -1);

poll_item.revents is allways POLLERR.

When I do a read(videofd, buffer, 0); directly after the open and then 
do the poll I get POLLIN.

I can trace this back to the fact that the bit IVTV_F_S_STREAMING is 
only set, in function ivtv_v4l2_read in file ivtv-fileops.c, when at 
least one read is done. Even if the request is to read 0 (zero) bytes.

I do not know if this is by design.
But I would think that it should be possible to first do a poll to see 
if data is available to read before I even do any reading. So probably 
the IVTV_F_S_STREAMING bit should be set in the function ivtv_v4l2_open 
in file ivtv-fileops.c.

This problem is in ivtv 0.10.0RC1 and I would think even in the earlier 
versions.

I did not yet spend time to find a fix because I would first like to 
know if this is by design or not.

When I use cat /dev/video0 | xine stdin://mpeg2 I get audio and picture 
so the device is allright.

Regards,

Michel.




_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to