This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: libdvbv5: Add a function to fill the per-delsys properties
Author:  Mauro Carvalho Chehab <[email protected]>
Date:    Mon Jun 4 14:50:53 2012 -0300

This function were currently part of the dvb_set_sys() logic. Move it into
a separate function, in order to allow it to be re-used by the DVB scan
tools.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 lib/include/dvb-fe.h  |    3 ++
 lib/libdvbv5/dvb-fe.c |   79 +++++++++++++++++++++++++++++-------------------
 2 files changed, 51 insertions(+), 31 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=4c42d7cfdad7f9a4b02a24b35614a6275b0f32b1

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index 46404fb..8877356 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -125,6 +125,9 @@ int dvb_fe_store_parm(struct dvb_v5_fe_parms *parms,
                      unsigned cmd, uint32_t value);
 int dvb_set_sys(struct dvb_v5_fe_parms *parms,
                   fe_delivery_system_t sys);
+int dvb_add_parms_for_sys(struct dtv_property *dvb_prop,
+                         unsigned max_size,
+                         fe_delivery_system_t sys);
 int dvb_set_compat_delivery_system(struct dvb_v5_fe_parms *parms,
                                   uint32_t desired_system);
 const char *dvb_cmd_name(int cmd);
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 982fe89..b46d83b 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -278,52 +278,69 @@ void dvb_fe_close(struct dvb_v5_fe_parms *parms)
        dvb_v5_free(parms);
 }
 
-int dvb_set_sys(struct dvb_v5_fe_parms *parms,
+
+int dvb_add_parms_for_sys(struct dtv_property *dvb_prop,
+                         unsigned max_size,
                          fe_delivery_system_t sys)
 {
-       struct dtv_property dvb_prop[1];
-       struct dtv_properties prop;
        const unsigned int *sys_props;
        int n;
 
-       if (sys != parms->current_sys) {
-               /* Disable LNBf power */
-               if (is_satellite(parms->current_sys) &&
-                   !is_satellite(sys))
-                       dvb_fe_sec_voltage(parms, 0, 0);
-
-               /* Can't change standard with the legacy FE support */
-               if (parms->legacy_fe)
-                       return EINVAL;
-
-               dvb_prop[0].cmd = DTV_DELIVERY_SYSTEM;
-               dvb_prop[0].u.data = sys;
-               prop.num = 1;
-               prop.props = dvb_prop;
-
-               if (ioctl(parms->fd, FE_SET_PROPERTY, &prop) == -1) {
-                       dvb_perror("Set delivery system");
-                       return errno;
-               }
-               parms->current_sys = sys;
-       }
-
        /* Make dvb properties reflect the current standard */
 
-       sys_props = dvb_v5_delivery_system[parms->current_sys];
+       sys_props = dvb_v5_delivery_system[sys];
        if (!sys_props)
                return EINVAL;
 
        n = 0;
        while (sys_props[n]) {
-               parms->dvb_prop[n].cmd = sys_props[n];
-               parms->dvb_prop[n].u.data = 0;
+               dvb_prop[n].cmd = sys_props[n];
+               dvb_prop[n].u.data = 0;
                n++;
        }
-       parms->dvb_prop[n].cmd = DTV_DELIVERY_SYSTEM;
-       parms->dvb_prop[n].u.data = sys;
+       dvb_prop[n].cmd = DTV_DELIVERY_SYSTEM;
+       dvb_prop[n].u.data = sys;
        n++;
-       parms->n_props = n;
+
+       return n;
+}
+
+int dvb_set_sys(struct dvb_v5_fe_parms *parms,
+                         fe_delivery_system_t sys)
+{
+       struct dtv_property dvb_prop[1];
+       struct dtv_properties prop;
+       int rc;
+
+       if (sys == parms->current_sys)
+               return 0;
+
+       /* Disable LNBf power */
+       if (is_satellite(parms->current_sys) &&
+           !is_satellite(sys))
+               dvb_fe_sec_voltage(parms, 0, 0);
+
+       /* Can't change standard with the legacy FE support */
+       if (parms->legacy_fe)
+               return EINVAL;
+
+       dvb_prop[0].cmd = DTV_DELIVERY_SYSTEM;
+       dvb_prop[0].u.data = sys;
+       prop.num = 1;
+       prop.props = dvb_prop;
+
+       if (ioctl(parms->fd, FE_SET_PROPERTY, &prop) == -1) {
+               dvb_perror("Set delivery system");
+               return errno;
+       }
+
+       rc = dvb_add_parms_for_sys(parms->dvb_prop,
+                                  ARRAY_SIZE(parms->dvb_prop), sys);
+       if (rc < 0)
+               return EINVAL;
+
+       parms->current_sys = sys;
+       parms->n_props = rc;
 
        return 0;
 }

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to