[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210702133326.654ac68d@coco.lan>
Date: Fri, 2 Jul 2021 13:33:26 +0200
From: Mauro Carvalho Chehab <mchehab@...nel.org>
To: YP WU <yp.wu@...iatek.com>
Cc: <leo.hsiao@...iatek.com>, <Lecopzer.Chen@...iatek.com>,
<gustavoars@...nel.org>, <hverkuil-cisco@...all.nl>,
<linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<Jason-BF.Huang@...iatek.com>, <francis.lee@...iatek.com>
Subject: Re: DVBS Blind scan implementation of Linux DVB
Hi YP,
Em Fri, 2 Jul 2021 18:16:49 +0800
YP WU <yp.wu@...iatek.com> escreveu:
> Hello, dvb frontend maintainer:
> We have an internal discussion about how to implement DVBS blind scan.
> Currently, we can't see any structs and IOCTL commands related to DVBS blind scan in Linux-dvb framework.
> So we want to confirm if Linux-dvb framework have inherent flow of DVBS blind scan or not.
> If the answer is yes, could you tell us how to work in Linux-dvb.
> If the answer is no, do you have any suggestions or design scenario for DVBS blind scan?
Right now, the DVB core lacks support for doing blind scan, basically
because no driver currently implements it.
Right now, a couple of userspace programs implement blind scan, but
at the hard way.
I discussed that in the past with another developer that wanted to
implement blind scans, but he ended working with something else.
-
There is an API on V4L2 that it is somewhat similar to blind
scan. It is meant to auto-tune FM radio channels:
https://linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/vidioc-s-hw-freq-seek.html
The way it works there is that the tuning parameters are set
at the ioctl, together with the scan direction. When this ioctl
is called, the tuner starts seeking the next channel on a given
frequency range.
I suspect that a similar way could be implemented at DTV side,
using dvbv5 API. This would work by adding a new DTV command
that would start to blind scan a single channel. Something like:
DTV_BLIND_SCAN_UP
Subsequent calls would find the next channels.
On other words, userspace would send a series of properties to setup
the initial frequency and the digital TV standard, and, instead of
using DTV_TUNE, the parameters will end with DTV_BLIND_SCAN_UP.
So, a blind scan properties would be something like:
DTV_FREQUENCY = 573000000
DTV_DELIVERY_SYSTEM = SYS_DVBC
... # other properties if needed
DTV_BLIND_SCAN_UP
ioctl(FE_SET_PROPERTY)
The frontend will then seek for valid frequency >= DTV_FREQUENCY.
While a new channel is found and the frequency is below to the
highest FE frequency, it would keep doing:
DTV_FREQUENCY = <previous freq> + <previous_channel_bandwidth)
DTV_DELIVERY_SYSTEM = SYS_DVBC
... # other properties if needed
DTV_BLIND_SCAN_UP
ioctl(FE_SET_PROPERTY)
-
Now, the userspace application needs to know when the blind
scan finds the next channel, or if it finished without finding
anything.
The normal way the DVB subsystem works is that FE_SET_PROPERTY
is an async operation: it shouldn't block until a command is
completed.
So, making userspace to simply wait for it to complete is not
a good idea.
So, the best is to use the poll() ioctl, E.g.:
Userspace (or userspace thread) can call poll() system call, which is
meant to make userspace to sleep until an async event
(read/write/error) happens.
Right now, the core already implements poll() support: it returns
EPOLLIN | EPOLLRDNORM | EPOLLPRI if the frontend status changes.
As we have empty flags, all the DVB core need is to add some
flags that are specific to the blind scan.
So, let's say we add two new flags at fe_status:
FE_SCAN_FOUND_CHANNEL
FE_SCAN_DONE
The userspace will then call poll() waiting for the
Once userspace gets aware that a blind scan happened, as a
call to poll() waiting for a POLLIN event. it will then
read the FE status. If it returns FE_SCAN_DONE, the blind
scan finished. Otherwise, it can call FE_GET_PROPERTY in order to
get the tuned frequencies and the the modulation parameters for
the detected channel.
-
So, in summary, I guess we just need to add a new DTV property,
and two flags to fe_status to make such functionality supported
by the DVB core.
Thanks,
Mauro
Powered by blists - more mailing lists