From: Mauro Carvalho Chehab Date: Fri, 29 May 2015 12:39:51 +0000 (-0300) Subject: [media] DocBook: Add an example for using FE_SET_PROPERTY X-Git-Tag: v4.2-rc8~12^2~219 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3dae8623d934611c57bc060c5d588de0fccafa5;p=platform%2Fkernel%2Flinux-exynos.git [media] DocBook: Add an example for using FE_SET_PROPERTY In order to make it clearer about how to use the DVBv5 calls, add an example of its usage. That should make it clearer about what's actually required for the DVBv5 calls to work. While here, also mentions the libdvbv5 library. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index b91210d..00ba1a9 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -15,11 +15,13 @@ approach, in favor of a properties set approach. By using a properties set, it is now possible to extend and support any digital TV without needing to redesign the API + Example: with the properties based approach, in order to set the tuner to a DVB-C channel at 651 kHz, modulated with 256-QAM, FEC 3/4 and symbol rate of 5.217 Mbauds, those properties should be sent to FE_SET_PROPERTY ioctl: + &DTV-DELIVERY-SYSTEM; = SYS_DVBC_ANNEX_A &DTV-FREQUENCY; = 651000000 &DTV-MODULATION; = QAM_256 &DTV-INVERSION; = INVERSION_AUTO @@ -27,6 +29,44 @@ &DTV-INNER-FEC; = FEC_3_4 &DTV-TUNE; + +The code that would do the above is: + +#include <stdio.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/dvb/frontend.h> + +static struct dtv_property props[] = { + { .cmd = DTV_DELIVERY_SYSTEM, .u.data = SYS_DVBC_ANNEX_A }, + { .cmd = DTV_FREQUENCY, .u.data = 651000000 }, + { .cmd = DTV_MODULATION, .u.data = QAM_256 }, + { .cmd = DTV_INVERSION, .u.data = INVERSION_AUTO }, + { .cmd = DTV_SYMBOL_RATE, .u.data = 5217000 }, + { .cmd = DTV_INNER_FEC, .u.data = FEC_3_4 }, + { .cmd = DTV_TUNE } +}; + +static struct dtv_properties dtv_prop = { + .num = 6, .props = props +}; + +int main(void) +{ + int fd = open("/dev/dvb/adapter0/frontend0", O_RDWR); + + if (!fd) { + perror ("open"); + return -1; + } + if (ioctl(fd, FE_SET_PROPERTY, &dtv_prop) == -1) { + perror("ioctl"); + return -1; + } + printf("Frontend set\n"); + return 0; +} + NOTE: This section describes the DVB version 5 extension of the DVB-API, also called "S2API", as this API were added to provide support for DVB-S2. It was designed to be able to replace the old frontend API. Yet, the DISEQC and