summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
diff options
context:
space:
mode:
authorAlex Woods <devnull@localhost>2003-07-12 15:01:38 +0000
committerAlex Woods <devnull@localhost>2003-07-12 15:01:38 +0000
commit66cf003d9e81bf8743ca26eaf3c1dcf8d268666e (patch)
tree5ca4228dc7a75f97acd4eb1b95402e14f199d90b /linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
parentfc196213aec7b9712463ad219d409c5206b7df63 (diff)
downloadmediapointer-dvb-s2-66cf003d9e81bf8743ca26eaf3c1dcf8d268666e.tar.gz
mediapointer-dvb-s2-66cf003d9e81bf8743ca26eaf3c1dcf8d268666e.tar.bz2
Resolve problem with first tuning under kernel 2.5
Prevent urbs being resubmitted if streaming isn't running under kernel 2.5
Diffstat (limited to 'linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c')
-rw-r--r--linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index cf4a8dc8d..663cce947 100644
--- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -388,7 +388,8 @@ static void ttusb_dec_process_urb(struct urb *urb, struct pt_regs *ptregs)
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- usb_submit_urb(urb URB_MEM_FLAG);
+ if (dec->iso_stream_count)
+ usb_submit_urb(urb URB_MEM_FLAG);
#endif
}
@@ -447,6 +448,18 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec)
up(&dec->iso_sem);
}
+/* Setting the interface of the DEC tends to take down the USB communications
+ * for a short period, so it's important not to call this function just before
+ * trying to talk to it.
+ */
+static void ttusb_dec_set_streaming_interface(struct ttusb_dec *dec)
+{
+ if (!dec->interface) {
+ usb_set_interface(dec->udev, 0, 8);
+ dec->interface = 8;
+ }
+}
+
static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
{
int i, result;
@@ -456,16 +469,6 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
if (down_interruptible(&dec->iso_sem))
return -EAGAIN;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- if (!dec->interface) {
- /* Can't do this at mod init time - weird.
- * Seems to work up here for 2.5
- */
- usb_set_interface(dec->udev, 0, 8);
- dec->interface = 8;
- }
-#endif
-
if (!dec->iso_stream_count) {
u8 b0[] = { 0x05 };
@@ -498,15 +501,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec)
up(&dec->iso_sem);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- if (!dec->interface) {
- /* Can't do this at mod init time - weird.
- * Don't stick this at the top of this function either -
- * it will cause the send_command to time out trying to get
- * a result
- */
- usb_set_interface(dec->udev, 0, 8);
- dec->interface = 8;
- }
+ ttusb_dec_set_streaming_interface(dec);
#endif
return 0;
@@ -867,6 +862,8 @@ static void ttusb_dec_exit_usb(struct ttusb_dec *dec)
dprintk("%s\n", __FUNCTION__);
+ dec->iso_stream_count = 0;
+
for (i = 0; i < ISO_BUF_COUNT; i++)
usb_unlink_urb(dec->iso_urb[i]);
@@ -926,6 +923,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
ttusb_dec_init_v_pes(dec);
usb_set_intfdata(intf, (void *)dec);
+ ttusb_dec_set_streaming_interface(dec);
return 0;
}