satip-client: add patch for proper lock-handling
[opendreambox.git] / meta-opendreambox / recipes-dreambox / satip-client / satip-client / 0002-enable-proper-lock-handling.patch
1 From e7a35462705e3dc51500df99fc618d582e712813 Mon Sep 17 00:00:00 2001
2 From: Stephan Reichholf <reichi@opendreambox.org>
3 Date: Thu, 9 Feb 2017 21:53:52 +0100
4 Subject: [PATCH 2/2] enable proper lock handling
5
6 ---
7  rtp.cpp    |  2 +-
8  vtuner.cpp | 18 ++++++++++--------
9  vtuner.h   | 12 +++++++++++-
10  3 files changed, 22 insertions(+), 10 deletions(-)
11
12 diff --git a/rtp.cpp b/rtp.cpp
13 index a80f1ae..5b2fe75 100644
14 --- a/rtp.cpp
15 +++ b/rtp.cpp
16 @@ -43,7 +43,7 @@ satipRTP::satipRTP(int vtuner_fd)
17                                                 m_rtcp_socket(-1),
18                                                 m_thread(0),
19                                                 m_running(false),
20 -                                               m_hasLock(true),
21 +                                               m_hasLock(false),
22                                                 m_signalStrength(0),
23                                                 m_signalQuality(0),
24                                                 m_openok(false)
25 diff --git a/vtuner.cpp b/vtuner.cpp
26 index 1a21288..6ee70c4 100644
27 --- a/vtuner.cpp
28 +++ b/vtuner.cpp
29 @@ -497,14 +497,10 @@ void satipVtuner::vtunerEvent()
30  
31                 case MSG_READ_STATUS:
32                         //INFO(MSG_MAIN,"MSG_READ_STATUS\n");
33 -//                             if (m_satip_rtp)
34 -//                             {
35 -//                                     if (m_satip_rtp->getHasLock())
36 -//                                             msg.body.status = FE_HAS_LOCK;
37 -//                                     else
38 -//                                             msg.body.status = 0;
39 -//                             }
40 -                       msg.body.status = FE_HAS_LOCK;
41 +                       if (m_satip_rtp && m_satip_rtp->getHasLock())
42 +                               msg.body.status = FE_HAS_LOCK;
43 +                       else
44 +                               msg.body.status = 0;
45                         break;
46                 case MSG_READ_BER:
47                         //INFO(MSG_MAIN,"MSG_READ_BER\n");
48 @@ -559,6 +555,12 @@ void satipVtuner::vtunerEvent()
49                         DEBUG(MSG_MAIN,"MSG_GET_PROPERTY\n");
50                         break;
51  
52 +               case MSG_GET_TUNE_SETTINGS:
53 +                       msg.body.tune_settings.min_delay_ms = 50; // let linux-tv api ask every 50ms for locked/unlocked state...
54 +                       msg.body.tune_settings.step_size = 0;
55 +                       msg.body.tune_settings.max_drift = 0;
56 +                       break;
57 +
58                 default:
59                         DEBUG(MSG_MAIN,"MSG_UNKNOWN: %d\n", msg.type);
60                         break;
61 diff --git a/vtuner.h b/vtuner.h
62 index 33db6c5..990dec4 100644
63 --- a/vtuner.h
64 +++ b/vtuner.h
65 @@ -45,6 +45,7 @@
66  #define MSG_TYPE_CHANGED                       15
67  #define MSG_SET_PROPERTY                       16
68  #define MSG_GET_PROPERTY                       17
69 +#define MSG_GET_TUNE_SETTINGS          18
70  
71  #define MSG_NULL                               1024
72  #define MSG_DISCOVER                   1025
73 @@ -54,12 +55,20 @@ typedef unsigned int   u32;
74  typedef unsigned short u16;
75  typedef unsigned char  u8;
76  
77 +struct dvb_frontend_tune_settings
78 +{
79 +       int min_delay_ms;
80 +       int step_size;
81 +       int max_drift;
82 +};
83 +
84  #if VMSG_TYPE1
85  struct vtuner_message {
86         __u32 type;
87         union 
88         {
89 -        struct dvb_frontend_parameters fe_params;
90 +               struct dvb_frontend_parameters fe_params;
91 +               struct dvb_frontend_tune_settings tune_settings;
92  
93  #if DVB_API_VERSION >= 5
94                 struct dtv_property prop;
95 @@ -117,6 +126,7 @@ struct vtuner_message
96                  } vsb;
97              } u;
98          } fe_params;
99 +               struct dvb_frontend_tune_settings tune_settings;
100          struct dtv_property prop;
101          u32 status;
102          __u32 ber;
103 -- 
104 2.7.4
105