diff --git a/src/ieee1394-ioctl.h b/src/ieee1394-ioctl.h index 1091bdf..24ef3b3 100644 --- a/src/ieee1394-ioctl.h +++ b/src/ieee1394-ioctl.h @@ -100,6 +100,8 @@ _IOW ('#', 0x27, struct raw1394_iso_packets) #define RAW1394_IOC_ISO_XMIT_SYNC \ _IO ('#', 0x28) +#define RAW1394_IOC_ISO_RECV_FLUSH \ + _IO ('#', 0x29) #endif /* __IEEE1394_IOCTL_H */ diff --git a/src/iso.c b/src/iso.c index 32c0fa5..f6f18c7 100644 --- a/src/iso.c +++ b/src/iso.c @@ -256,7 +256,7 @@ int raw1394_iso_multichannel_recv_init(raw1394handle_t handle, **/ int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channel) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; } @@ -269,7 +269,7 @@ int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channe **/ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char channel) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; } @@ -277,6 +277,26 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char chan return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL, channel); } +/** + * raw1394_iso_recv_flush - if you specified an irq_interval > 1 in + * iso_recv_init, you won't be notified for every single iso packet, but + * for groups of them. Now e.g. if irq_interval is 100, and you were just + * notified about iso packets and after them only 20 more packets arrived, + * no notification will be generated (20 < 100). In the case that you know + * that there should be more packets at this moment, you can call this + * function and all iso packets which are already received by the kernel + * will be flushed out to user space. + */ +int raw1394_iso_recv_flush(raw1394handle_t handle) +{ + if (handle->iso_mode != ISO_RECV) { + errno = EINVAL; + return -1; + } + + return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_FLUSH, 0); +} + /** * raw1394_iso_recv_set_channel_mask - listen or unlisten to a whole bunch of channels at once * @mask: 64-bit mask of channels, 1 means listen, 0 means unlisten, @@ -286,7 +306,7 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char chan **/ int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; }