Leatherface75 / vtuner

Automatically exported from code.google.com/p/vtuner
0 stars 0 forks source link

FE_GET_FRONTEND failed - Operation not supported #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Set up the current vtunerd (hg:54657d0f37c8), vtunerc(hg:54657d0f37c8), and 
vtuner kernel ext (hg:ace6c943cc40). Then try to share a dvb-S2 card and do a 
channel scan. The Scan hangs while vtunerd displays the following warning code:
vtunerd: [26000 ../../vtuner-dvb-3.c:138]  warn: FE_GET_FRONTEND failed - 
Operation not supported

What version of the product are you using? On what operating system?
vtunerd (hg:54657d0f37c8), vtunerc(hg:54657d0f37c8), and vtuner kernel ext 
(hg:ace6c943cc40)
Server (vtunerd):
    Debian squeeze i686 with kernel 2.6.32-5-686
Client (vtunerc):

Please provide any additional information below.

Original issue reported on code.google.com by hbwint...@gmail.com on 5 Jan 2012 at 9:03

GoogleCodeExporter commented 9 years ago
Sorry, my stupid computer posted the issue before I was able to complete it. So 
here goes the rest:

What version of the product are you using? On what operating system?
vtunerd (hg:54657d0f37c8), vtunerc(hg:54657d0f37c8), and vtuner kernel ext 
(hg:ace6c943cc40)
Server (vtunerd):
    Debian squeeze i686 with kernel 2.6.32-5-686
    the dvb-S2 device is a Philips Semiconductors SAA7146 (rev 01)
Client (vtunerc):
    Debian squeeze amd64 with kernel 2.6.32-5-amd64

Please provide any additional information below.
I appended the vtunerd log.

Original comment by hbwint...@gmail.com on 5 Jan 2012 at 9:08

Attachments:

GoogleCodeExporter commented 9 years ago
Checking the bug I just realized that no every tuner frontend driver implements 
GET_FRONTEND operation, so the bug is driver specific.

Let me check if I can get similar information using v5 api calls.

Original comment by jpetrous on 6 Jan 2012 at 9:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i had identical problem - i compiled vtunerd for mips architecture - i have 
DVB-S2 card connected via USB to Netgear 3700v2 with OpenWRT. 

After succesfull client-server connection when i try to use szap-s2 on the 
server i got in logs:
vtunerd: [13724 ../../vtuner-dmm-3.c:152]  info: FE_SET_FRONTEND parameters: fr
eq:1142000 inversion:2 SR:27500000 FEC:3

vtunerd: [13724 ../../vtuner-dmm-3.c:144]  warn: FE_GET_FRONTEND failed

szap-s2 on the openwrt works well (locally). And the second thin is if i kill 
vtunerd on client on server vtunerd dies with "segmentation fault"

my client is Ubuntu 10.04.3 32bit.

Maybe you can see there what to use v5 api:
http://mercurial.intuxication.org/hg/szap-s2
http://mercurial.intuxication.org/hg/scan-s2

Original comment by ary...@radiowy.net on 6 Jan 2012 at 12:41

GoogleCodeExporter commented 9 years ago
I'm working together with the issue reporter and wanted to add which card and 
driver we are using:

$ lspci -k
[...]
02:07.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01)
    Subsystem: Technotrend Systemtechnik GmbH Device 101c
    Kernel driver in use: budget dvb

Original comment by moschlar@metalabs.de on 6 Jan 2012 at 1:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Im using this usb card:

http://www.tbsdtv.com/english/product/QBoxS2.html 

connected to openwrt.

My drivers:

dvb_usb_tbsqboxs2 6320 0 - Live 0x82e96000
dvb_usb 15984 1 dvb_usb_tbsqboxs2, Live 0x82dec000
dvb_core 68240 1 dvb_usb, Live 0x82e60000
usbcore 98048 6 dvb_usb_tbsqboxs2,dvb_usb,ledtrig_usbdev,usb_storage,ehci_hcd, 
Live 0x83020000
cx24116 12176 1 - Live 0x82dac000

Original comment by ary...@radiowy.net on 6 Jan 2012 at 1:37

GoogleCodeExporter commented 9 years ago
Guys, can you check with the following patch:

diff -r 54657d0f37c8 vtuner-dvb-3.c
--- a/vtuner-dvb-3.c    Wed Jan 04 13:44:36 2012 +0100
+++ b/vtuner-dvb-3.c    Fri Jan 06 21:55:22 2012 +0100
@@ -135,7 +135,10 @@ int hw_get_frontend(vtuner_hw_t* hw, str
 int hw_get_frontend(vtuner_hw_t* hw, struct dvb_frontend_parameters* fe_params) {
   int ret;
   ret = ioctl(hw->frontend_fd, FE_GET_FRONTEND, fe_params);
-  if( ret != 0 ) WARN(MSG_NET, "FE_GET_FRONTEND failed - %m\n");
+  if( ret != 0 ) {
+        WARN(MSG_NET, "FE_GET_FRONTEND failed - %m");
+   memset(fe_params, 0, sizeof(struct dvb_frontend_parameters));
+  }
   return ret;
 }

I don't know if it can help, but it looks like nice workaround (if works)

Honza

Original comment by jpetrous on 6 Jan 2012 at 8:59

GoogleCodeExporter commented 9 years ago
Sorry, one line was missing in my previous patch.
Here is correct one:

diff -r 54657d0f37c8 vtuner-dvb-3.c
--- a/vtuner-dvb-3.c    Wed Jan 04 13:44:36 2012 +0100
+++ b/vtuner-dvb-3.c    Fri Jan 06 23:34:01 2012 +0100
@@ -135,7 +135,11 @@ int hw_get_frontend(vtuner_hw_t* hw, str
 int hw_get_frontend(vtuner_hw_t* hw, struct dvb_frontend_parameters* fe_params) {
   int ret;
   ret = ioctl(hw->frontend_fd, FE_GET_FRONTEND, fe_params);
-  if( ret != 0 ) WARN(MSG_NET, "FE_GET_FRONTEND failed - %m\n");
+  if( ret != 0 ) {
+        WARN(MSG_NET, "FE_GET_FRONTEND failed - %m");
+   memset(fe_params, 0, sizeof(struct dvb_frontend_parameters));
+   ret = 0;
+  }
   return ret;
 }

Honza

Original comment by jpetrous on 6 Jan 2012 at 10:35

GoogleCodeExporter commented 9 years ago
No, this patch not helps...

On server side:
vtunerd: [13735 ../../vtunerd.c:87]  info: S2API tuning support.
vtunerd: [13735 ../../vtuner-dmm-3.c:60]  info: FE_GET_INFO dvb-type:0 
vtuner-type:1
vtunerd: [13735 ../../vtuner-dmm-3.c:71] error: DMX_SET_SOURCE failed for 
/dev/dvb/adapter0/demux0 - Invalid argument
vtunerd: [13735 ../../vtunerd.c:97]  info: adapter:0, frontend:0, demux,0, 
dvr:0 is type:1
vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
vtunerd: [13735 ../../vtunerd.c:111]  info: received discover request proto2, 
vtuner_type:9 group:0xFFFFFFFF
vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
vtunerd: [13735 ../../vtunerd.c:111]  info: received discover request proto2, 
vtuner_type:9 group:0xFFFFFFFF
vtunerd: [13735 ../../vtunerd.c:125]  info: No idle device found
vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
vtunerd: [13735 ../../vtuner-dmm-3.c:60]  info: FE_GET_INFO dvb-type:0 
vtuner-type:1
vtunerd: [13735 ../../vtuner-dmm-3.c:71] error: DMX_SET_SOURCE failed for 
/dev/dvb/adapter0/demux0 - Invalid argument
vtunerd: [13735 ../../vtunerd-service.c:68]  info: anon stream socket prepared 7
vtunerd: [13735 ../../vtunerd-service.c:313]  info: control socket bound to 
40125
vtunerd: [13735 ../../vtunerd-service.c:68]  info: anon stream socket prepared 8
vtunerd: [13735 ../../vtunerd-service.c:326]  info: session prepared 
control:40125 data:50977
vtunerd: [13735 ../../vtunerd-service.c:356]  info: session running
vtunerd: [13735 ../../vtuner-dmm-3.c:152]  info: FE_SET_FRONTEND parameters: 
freq:1699000 inversion:34 SR:27500000 FEC:21
vtunerd: [13735 ../../vtuner-dmm-3.c:144]  warn: FE_GET_FRONTEND failed
vtunerd: [13735 ../../vtunerd-service.c:449]  warn: vtuner call failed, type:2 
reason:-1

What means "no idle device found" maybe this is problem?

On client szap hangs:

mcenter@mpc:~/src/szap-s2-d65015db2778$ ./szap-s2 -c /var/lib/vdr/channels.conf 
-n 3
reading channels from file '/var/lib/vdr/channels.conf'
zapping to 3 'TVP 1 HD;ITI':
delivery DVB-S2, modulation 8PSK
sat 0, frequency 11449 MHz H, symbolrate 27500000, coderate 3/4, rolloff 0.35
vpid 0x0216, apid 0x027a, sid 0x0000
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'

Log from client:
vtunerc: vtuner client (vtunerc), part of vtuner project
Visit http://code.google.com/p/vtuner/ for more information
Copyright (C) 2009-11 Roland Mieslinger
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
vtunerc: Revision:63f73de8b63c/tip DVB:5.1 allow:5.x NetProto:2 MsgSize:96, 
Debug:3
vtunerc: [1175 ../../vtunerc.c:452]  info: added frontend mode DVB-S2 as mode 
0, searching for tuner types 9
vtunerc: [1175 ../../vtunerc.c:533]  info: Created pidfile /var/run/vtunerc0.pid
vtunerc: [1175 ../../vtunerc.c:586]  info: no server connected. discover thread 
is 0 (DWS_IDLE:0, DWS_RUNNING:1)
vtunerc: [1175 ../../vtunerc.c:588]  info: changing frontend mode to DVB-S2
vtunerc: [1175 ../../vtunerc.c:617]  info: Start discover worker for device 
type 9 groups 1
vtunerc: [1175 ../../vtunerc.c:214]  info: starting discover thread
vtunerc: [1175 ../../vtunerc.c:258]  info: Sending discover message for device 
types 9
vtunerc: [1175 ../../vtunerc.c:258]  info: Sending discover message for device 
types 9
vtunerc: [1175 ../../vtunerc.c:272]  info: Received discover message from 
192.168.1.1 proto2 control 40125 data 50977
vtunerc: [1175 ../../vtunerc.c:637]  info: connect control socket to 
192.168.1.1:40125
vtunerc: [1175 ../../vtunerc.c:654]  info: connected data socket to 
192.168.1.1:50977
vtunerc: [1175 ../../vtunerc.c:801] error: Server disconncted
vtunerc: [1175 ../../vtunerc.c:586]  info: no server connected. discover thread 
is 0 (DWS_IDLE:0, DWS_RUNNING:1)
vtunerc: [1175 ../../vtunerc.c:588]  info: changing frontend mode to DVB-S2
vtunerc: [1175 ../../vtunerc.c:617]  info: Start discover worker for device 
type 9 groups 1
vtunerc: [1175 ../../vtunerc.c:214]  info: starting discover thread
vtunerc: [1175 ../../vtunerc.c:258]  info: Sending discover message for device 
types 9
vtunerc: [1175 ../../vtunerc.c:86] error: TS data socket closed.
vtunerc: [1175 ../../vtunerc.c:190] error: TS data copy thread terminated.
vtunerc: [1175 ../../vtunerc.c:258]  info: Sending discover message for device 
types 9

Original comment by ary...@radiowy.net on 7 Jan 2012 at 8:02

GoogleCodeExporter commented 9 years ago
> No, this patch not helps...

> On server side:
> vtunerd: [13735 ../../vtunerd.c:87]  info: S2API tuning support.
> vtunerd: [13735 ../../vtuner-dmm-3.c:60]  info: FE_GET_INFO dvb-type:0 
vtuner-type:1
> vtunerd: [13735 ../../vtuner-dmm-3.c:71] error: DMX_SET_SOURCE failed for 
/dev/dvb/adapter0/demux0 - Invalid argument
> vtunerd: [13735 ../../vtunerd.c:97]  info: adapter:0, frontend:0, demux,0, 
dvr:0 is type:1
> vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
> vtunerd: [13735 ../../vtunerd.c:111]  info: received discover request proto2, 
vtuner_type:9 group:0xFFFFFFFF
> vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
> vtunerd: [13735 ../../vtunerd.c:111]  info: received discover request proto2, 
vtuner_type:9 group:0xFFFFFFFF
> vtunerd: [13735 ../../vtunerd.c:125]  info: No idle device found
> vtunerd: [13735 ../../vtunerd-service.c:263]  info: waiting for autodiscover 
packet (groups 0xFFFFFFFF) ...
> vtunerd: [13735 ../../vtuner-dmm-3.c:60]  info: FE_GET_INFO dvb-type:0 
vtuner-type:1
> vtunerd: [13735 ../../vtuner-dmm-3.c:71] error: DMX_SET_SOURCE failed for 
/dev/dvb/adapter0/demux0 - Invalid argument
> vtunerd: [13735 ../../vtunerd-service.c:68]  info: anon stream socket 
prepared 7
> vtunerd: [13735 ../../vtunerd-service.c:313]  info: control socket bound to 
40125
> vtunerd: [13735 ../../vtunerd-service.c:68]  info: anon stream socket 
prepared 8
> vtunerd: [13735 ../../vtunerd-service.c:326]  info: session prepared 
control:40125 data:50977
> vtunerd: [13735 ../../vtunerd-service.c:356]  info: session running
> vtunerd: [13735 ../../vtuner-dmm-3.c:152]  info: FE_SET_FRONTEND parameters: 
freq:1699000 inversion:34 SR:27500000 FEC:21
> vtunerd: [13735 ../../vtuner-dmm-3.c:144]  warn: FE_GET_FRONTEND failed
> vtunerd: [13735 ../../vtunerd-service.c:449]  warn: vtuner call failed, 
type:2 reason:-1

This last line show me that you have applied my wrong patch (without line "ret 
= 0"), otherwise such warning should not be shown.

Please recheck, that you have applied correct patch.

Honza

Original comment by jpetrous on 7 Jan 2012 at 7:07

GoogleCodeExporter commented 9 years ago
honza: my compilation was wrong - with patch works.

But now i have another problem... 

I start new bug.

Original comment by ary...@radiowy.net on 8 Jan 2012 at 8:56

GoogleCodeExporter commented 9 years ago
Great, so I'm treating your report like "BUG SOLVED".

Only FYI, in meantime, I did some emulation of missing FE_GET_FRONTEND
ioctl call. But it make code too much complex. I don't like
to add such big workaround to the vtuner only because driver developers
did theirs job not fully (implementing of FE_GET_FRONTEND is usually
only matter of few lines of code).

Honza

Here is the code which emulate FE_GET_FRONTEND by using cache values:

diff -r 54657d0f37c8 vtuner-dvb-3.c
--- a/vtuner-dvb-3.c    Wed Jan 04 13:44:36 2012 +0100
+++ b/vtuner-dvb-3.c    Sun Jan 08 14:47:29 2012 +0100
@@ -132,10 +132,89 @@ void print_frontend_parameters(vtuner_hw
   }
 }

+#if DVB_API_VERSION >= 5 
+static int set_fe_param(int cmd, int *valptr) {
+  struct dtv_property* prop;
+
+  prop.cmd = cmd;
+  prop.u.data = 0;
+  if(hw_get_property(hw, &prop)) {
+    *valptr = prop.u.data;
+    return 0;
+  }
+  return -1;
+}
+
+static int emulate_get_frontend(vtuner_hw_t* hw, struct 
dvb_frontend_parameters* fe_params) {
+    int i, cnt, **params;
+    int cnt_S = 4;
+    int param_S[cnt_S*2] = {
+      DTV_FREQUENCY, &fe_params->frequency,
+      DTV_INVERSION, &fe_params->inversion,
+      DTV_SYMBOL_RATE, &fe_params->u.qpsk.symbol_rate,
+      DTV_INNER_FEC, &fe_params->u.qpsk.fec_inner,
+    };
+    int cnt_C = 5;
+    int param_C[cnt_C*2] = {
+      DTV_FREQUENCY, &fe_params->frequency,
+      DTV_INVERSION, &fe_params->inversion,
+      DTV_SYMBOL_RATE, &fe_params->u.qpsk.symbol_rate,
+      DTV_INNER_FEC, &fe_params->u.qpsk.fec_inner,
+      DTV_MODULATION, &fe_params->u.qam.modulation,
+    };
+    int cnt_T = 5;
+    int param_T[cnt_T*2] = {
+      DTV_FREQUENCY, &fe_params->frequency,
+      DTV_INVERSION, &fe_params->inversion,
+      DTV_BANDWIDTH_HZ, &fe_params->u.ofdm.bandwidth,
+      DTV_CODE_RATE_HP, &fe_params->u.ofdm.code_rate_HP,
+      DTV_CODE_RATE_LP, &fe_params->u.ofdm.code_rate_LP,
+    };
+
+  if(hw->fe_params_last.frequency) {
+    INFO(MSG_NET, "FE_GET_FRONTEND emulated by v3 data\n");
+    memcpy(fe_params, &hw->fe_params_last, sizeof(struct 
dvb_frontend_parameters));
+    return 0;
+  }
+
+  switch(hw->type) {
+    case VT_S:
+    case VT_S2:
+      cnt = cnt_S;
+      params = ¶m_S;
+      break;
+    case VT_C:
+      cnt = cnt_C;
+      params = ¶m_C;
+      break;
+    case VT_T:
+      cnt = cnt_T;
+      params = ¶m_T;
+      break;
+    default:
+      cnt = 0;
+      break;
+  }
+
+  for(i = 0; i < cnt; i++)
+    set_fe_param(params[i*2], params[(i*2)+1]);
+
+  return 0;
+}
+#endif
+
 int hw_get_frontend(vtuner_hw_t* hw, struct dvb_frontend_parameters* fe_params) {
   int ret;
   ret = ioctl(hw->frontend_fd, FE_GET_FRONTEND, fe_params);
-  if( ret != 0 ) WARN(MSG_NET, "FE_GET_FRONTEND failed - %m\n");
+  if( 1 /*ret != 0*/ ) {
+    WARN(MSG_NET, "FE_GET_FRONTEND failed - %m\n");
+  #if DVB_API_VERSION < 5 
+    memset(fe_params, 0, sizeof(struct dvb_frontend_parameters));
+    ret = 0;
+  #else
+    emulate_get_frontend(hw, fe_params);
+  #endif
+  }
   return ret;
 }

@@ -143,7 +222,7 @@ int hw_set_frontend(vtuner_hw_t* hw, str
   int ret;
   char msg[1024];
   print_frontend_parameters(hw, fe_params, msg, sizeof(msg));
-  INFO(MSG_NET, "FE_SET_FRONTEND parameters: %s", msg);
+  INFO(MSG_NET, "FE_SET_FRONTEND parameters: %s\n", msg);
   #if DVB_API_VERSION < 5 
     ret = ioctl(hw->frontend_fd, FE_SET_FRONTEND, fe_params);
   #else
@@ -227,11 +306,28 @@ int hw_set_frontend(vtuner_hw_t* hw, str
     }
   #endif
   if( ret != 0 ) WARN(MSG_NET, "FE_SET_FRONTEND failed %s - %m\n", msg);
+  else memcpy(&hw->fe_params_last, fe_params, sizeof(struct 
dvb_frontend_parameters));
   return ret;
 }

 int hw_get_property(vtuner_hw_t* hw, struct dtv_property* prop) {
+#if DVB_API_VERSION < 5
   WARN(MSG_NET, "FE_GET_PROPERTY: not implemented %d\n", prop->cmd);
+#else
+  //FIXME: do online check?
+  #if DVB_API_VERSION_MINOR < 5 // get_prop implemented in v5.5api only
+  for(i = 0; i < hw->num_props; i++)
+    if(hw->props[i].cmd == prop->cmd) {
+      prop->u.data = hw->props[prop->cmd].u.data
+      WARN(MSG_NET, "FE_GET_PROPERTY: emulated %d = %d\n", prop->cmd, 
prop->u.data);
+      return 0;
+    }
+  WARN(MSG_NET, "FE_GET_PROPERTY: emulated %d not found in cache\n", 
prop->cmd);
+  #else
+  //FIXME: add real v5.5 call here
+  WARN(MSG_NET, "FE_GET_PROPERTY: not implemented %d (TODO)\n", prop->cmd);
+  #endif
+#endif
   return 0;
 }

Original comment by jpetrous on 8 Jan 2012 at 1:53

GoogleCodeExporter commented 9 years ago
So fixed by reseting required values to zero (will commit
it to the repository asap).

The only real solution should be to add missing FE_GET_FRONTEND
ioctl callback to the device driver. 

>!!< I recommend to use only the devices which have properly >!!<
>!!< implemented such callback >!!<

You can check that by looking in the source and see
if dvb_frontend_ops member .get_frontend is set
(compare with stv0900_core.c or zl10353.c)

Honza

Original comment by jpetrous on 8 Jan 2012 at 2:04

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 2340b9c037ea.

Original comment by jpetrous on 8 Jan 2012 at 7:45

GoogleCodeExporter commented 9 years ago
Sorry for the delay, I just wanted to note, that it works here now, too!
Thank you for your quick help!

Original comment by moschlar@metalabs.de on 8 Jan 2012 at 9:17