linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DVBS Blind scan implementation of Linux DVB
@ 2021-07-02 10:16 YP WU
  2021-07-02 11:33 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: YP WU @ 2021-07-02 10:16 UTC (permalink / raw)
  To: yp.wu, leo.hsiao, Lecopzer.Chen, mchehab, gustavoars,
	hverkuil-cisco, linux-media, linux-kernel
  Cc: Jason-BF.Huang, francis.lee

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?

Sorry to bother you and thanks for your helps.
BRs,
YP

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DVBS Blind scan implementation of Linux DVB
  2021-07-02 10:16 DVBS Blind scan implementation of Linux DVB YP WU
@ 2021-07-02 11:33 ` Mauro Carvalho Chehab
  2021-09-02 10:56   ` YP WU
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2021-07-02 11:33 UTC (permalink / raw)
  To: YP WU
  Cc: leo.hsiao, Lecopzer.Chen, gustavoars, hverkuil-cisco,
	linux-media, linux-kernel, Jason-BF.Huang, francis.lee

Hi YP,

Em Fri, 2 Jul 2021 18:16:49 +0800
YP WU <yp.wu@mediatek.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DVBS Blind scan implementation of Linux DVB
  2021-07-02 11:33 ` Mauro Carvalho Chehab
@ 2021-09-02 10:56   ` YP WU
  0 siblings, 0 replies; 3+ messages in thread
From: YP WU @ 2021-09-02 10:56 UTC (permalink / raw)
  To: mchehab
  Cc: Jason-BF.Huang, Lecopzer.Chen, francis.lee, gustavoars,
	hverkuil-cisco, leo.hsiao, linux-kernel, linux-media, yp.wu

Hello, Mr.Mauro,
      Frist of all, thanks for your reply and Sorry to reply late.

According to your comment, we found that it still miss some steps about blindscan
For example, we should get tuner's next IF frequency from demod DD during blindscan.
Also, we should get the number of founded transpoders and detail information of each transponder
To complete DVBS blindscan, we proposed to add element below:

1.Create interface between demod DD and user space
We need to add IOCTL command for user space to indicate dvb_core that this command is related to blindscan
Also, we need to add ops for dvb_core to indicate demod dd to set/get parameters related to blindscan
We propose to add code below:

(1)Add IOCTL cmd in frontend.h:
#define FE_BLINDSCAN                   _IOW('o', 84, enum blindscan_action, struct dtv_frontend_properties *p)
/* 
ioctl command which is related to DVBS blindscan
*/

(2)Add member into dvb_frontend_ops in dvb_frontend.h
int (*blindscan)(enum blindscan_action cmd, struct dtv_frontend_properties *p );
/* 
function which is related to DVBS blindscan
*/

2.Indicate demod DD what kind of blindscan command user space send
During blindscan, user space needs to get or set parameters with demod DD
Ex: User space should get next IF frequency from demod DD and set to tuner.
    If transponders are founded in this tuner step, user space should get the number of transponders and information of each transponder
    User space should start blindscan with start&end frequency

Therefore, we need add enum to indicate demod DD that user space want to get or set parameters during blindscan with demod DD 
We propose to add enum in dvb_frontend.h below:

Enum blindscan_action
{
    BLINDSCAN_SET  //Setting parameters during blindscan (set start/end frequency, continue blindscan)
    BLINDSCAN_GET  //Getting parameters during blindscan (get current tuner frequency, get total founded transponders information)
    BLINDSCAN_END  //current tuner frequency reaches end frequency or user wants to stop blindscan
}

3.Additional properties related to blindscan
(1)We should indicate demod DD the end frequency of blindscan, then demod DD would know when to end blindscan
(2)If transponders are founded in this tuner step, we should get the number of transponders and information of each transponder

We propose to add property command and struct member of dtv_frontend_properties below: 
(1)Add dtv property command in frontend.h
#define DTV_END_FREQUENCY  //Setting end IF frequency of blindscan
#define DTV_TRANSPONDER_NUMBER  //Getting number of founded transponders in this tuner step

(2)Add struct member of dtv_frontend_properties in dvb_frontend.h
u32 end_freq  //End IF frequency of blindscan
u8 TP_num  //Number of founded transponders in this tuner step

Do you have any suggestion? 
Thanks for your help.

BRs,
YP

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-02 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 10:16 DVBS Blind scan implementation of Linux DVB YP WU
2021-07-02 11:33 ` Mauro Carvalho Chehab
2021-09-02 10:56   ` YP WU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).