summaryrefslogtreecommitdiff
path: root/sys/dvb/camtransport.c
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2012-05-22 18:51:34 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-05-23 09:40:25 +0200
commit3d588134d8b05ec9285ab1fc424f4c1970c39341 (patch)
tree35e02ab036b0649963ae578f9b735888e5161554 /sys/dvb/camtransport.c
parentec8c15fafe2808ed2cecd7709b27a62a6ea7f2e6 (diff)
downloadgstreamer-plugins-bad-3d588134d8b05ec9285ab1fc424f4c1970c39341.tar.gz
camtransport: Allow delay when setting up cam device
Some CA devices take a long time to set themselves up, therefore retry every 250ms (for a maximum of 2.5s)
Diffstat (limited to 'sys/dvb/camtransport.c')
-rw-r--r--sys/dvb/camtransport.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/dvb/camtransport.c b/sys/dvb/camtransport.c
index 30780db72..f47585ecc 100644
--- a/sys/dvb/camtransport.c
+++ b/sys/dvb/camtransport.c
@@ -296,16 +296,28 @@ cam_tl_create_connection (CamTL * tl, guint8 slot,
{
CamReturn ret;
CamTLConnection *conn = NULL;
+ guint count = 10;
if (tl->connection_ids == 255)
return CAM_RETURN_TRANSPORT_TOO_MANY_CONNECTIONS;
conn = cam_tl_connection_new (tl, ++tl->connection_ids);
- /* send a TAG_CREATE_T_C TPDU */
- ret = cam_tl_connection_write_control_tpdu (conn, TAG_CREATE_T_C);
- if (CAM_FAILED (ret))
- goto error;
+ /* Some CA devices take a long time to set themselves up,
+ * therefore retry every 250ms (for a maximum of 2.5s)
+ */
+ while (TRUE) {
+ /* send a TAG_CREATE_T_C TPDU */
+ ret = cam_tl_connection_write_control_tpdu (conn, TAG_CREATE_T_C);
+ if (!CAM_FAILED (ret))
+ break;
+ if (!count)
+ goto error;
+ GST_DEBUG ("Failed sending initial connection message .. but retrying");
+ count--;
+ /* Wait 250ms */
+ g_usleep (G_USEC_PER_SEC / 4);
+ }
g_hash_table_insert (tl->connections, GINT_TO_POINTER (conn->id), conn);