Code Monkey home page Code Monkey logo

dvbloopback's Introduction

Loopback kernel driver for DVB devices on Linux.

Use:

NB: minimum supported kernel series is 4.4.x

copy the dvbloopback dir into the drivers/media/pci dir of the kernel or v4l source tree

Add
source "drivers/media/pci/dvbloopback/Kconfig"
to drivers/media/pci/Kconfig

Add
obj-$(CONFIG_DVB_LOOPBACK_ADAPTER) += dvbloopback/
to drivers/media/pci/Makefile

Patch drivers/media/dvb-core/dvbdev.c the usual way,
example patches are in this repo.

NB: if you are going to build a kernel v4.5.x or up, you need to patch the dvbloopback module with 4.5-linux.patch (it's in the repo).

Having done this, proceed with make oldconfig, make allyesconfig or something like that.


Alternative use:

If you like it, you could use my personal configure script.
Note that it is tested with Debian only, Ubuntu 16.04 LTS seems to work too.
Do: ./configure --help to review the options

N.B.: my personal configure script has default settings for my personal situation.
Most other users should run it with at least the "--drivers=no" and probably the
"--headers=yes" switches. Again: make sure you understand the consequences of running
this script by first running "./configure --help"

Just running "./configure" without any switches (on Debian or Ubuntu 16.04 LTS) will recompile
your stock kernel with the dvbloopback kernel module intree, with an updated ABI num from 900 up to 909.
It also pulls and compiles the sources needed to install the ffdecsawrapper binary.

Note for Debian users: In order to recompile your stock kernel with the dvbloopback kernel intree, you have to temporary comment out the "backports" source in /etc/apt/sources.list and do apt-get update. If you neglect this, the script will recompile the kernel from "backports" and that is probably not what you want. This is due to a bug/feature in apt-get source. That command will allways get the newest source, even if it resides in "backports".

However, if you don't mind running a backports kernel, make sure you have both lines beginning with "deb" and "deb-src" enabled for your backports repo. By doing so, you'll risk trashing your system seriously though. You have been warned!

dvbloopback's People

Contributors

bas-t avatar hschill avatar masjerang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dvbloopback's Issues

Si2168 - Appears now as DVB-C and not DVB-T2

This messes up my terrestrial cards DVBSky T9580 and the card is recognised by the kernel as a DVB-C.... have reinstalled stock kernel and it works. I am guessing it is something to do with the full kernel recompile + non standard si2168 files in the dvbloopback folder?

Was looking for some guide on ffdecsawrapper (which works fine through 14.04LTS) to migrate to dvbloopback + descrambler as just upped to 16.04LTS with 4.4 kernel. lursen.org is down.

Currently trying the ffdescawrapper latest git clone to see if that works.

Kernel 5.8

Hi
Im on plain vanilla Debian + tbs-drivers (V4L).
Kernel 5.7 works for me (I.e. Debian Stable + 5.7 buster backports)
On kernel 5.8 (Debian testing) unencrypted channels work (mplayer/vlc plays channel), but encrypted channels fails (see below).

Note: I have one physical adapter and one loopback adapter. I use ffdecsawrapper to join them. It may be ffdecsawrapper that fail as well.
However, the log from ffdecswrapper looks normal to me - it finds the correct key and so forth.

Snip from from mplayer log:

Cannot seek backward in linear streams!
Seek failed
TS file format detected.
Cannot seek backward in linear streams!
Seek failed
VIDEO MPEG2(pid=1016) NO AUDIO! (try increasing -tsprobe) NO SUBS (yet)! PROGRAM N. 0
Cannot seek backward in linear streams!
Seek failed

I dont know how to proceed - any hint on where to start debugging? Is it ffdecsawrapper or dvbloopback that need fixing? What to look for?

TBS 6905 - saa716x Driver Problem

System Configuration:
Linux Destru: Mint
Kernel Version: 3.16
DVB-S Cards: 1 quad dvb-s 6905

Configure Command: ./configure --vanilla=3.16 --adapters=36

After Kernel download and compile system boot normally. But the system can not detect our dvb-s cards. However we can use modprobe dvbloopback adapter= 18 and it create 18 adapters. when we try install our driver again on this new kernel we got "disagree about version of symbol" message in dmesg.

Please help us to overcome thin problem and install the cards drivers.

Use Official TBS Drivers

Any chance you can add building with the official TBS drivers to the configure script?

Big thanks for all your efforts with this!

Fails to build linux-headers-xxx-common deb

Building for debian fails to build
linux-headers-4.9.0-901-common_4.9.6-3_amd64.deb which makes
linux-headers-4.9.0-901-amd64_4.9.6-3_amd64.deb uninstallable and therefore unable to build nvidia driver

Anyone experiencing proc_dir_entry 'x' already registered?

I'm on Debian testing (5.7.10-1).
When modprobing dvbloopback I get:

[ 45.192166] proc_dir_entry 'adapter1/sec' already registered

[ 45.192176] WARNING: CPU: 0 PID: 2192 at fs/proc/generic.c:362 proc_register+0x128/0x170
[ 45.192176] Modules linked in: dvbloopback(E+) ip6t_REJECT(E) nf_reject_ipv6(E) nf_log_ipv6(E) tda10021(E) xt_state(E) xt_multiport(E) ipt_REJECT(E) nf_reject_ipv4(E) xt_recent(E) xt_tcpudp(E) xt_conntrack(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) nf_log_ipv4(E) nf_log_common(E) nft_limit(E) xt_LOG(E) intel_rapl_msr(E) intel_rapl_common(E) xt_limit(E) nft_counter(E) ghash_clmulni_intel(E) xt_hashlimit(E) nft_compat(E) xfs(E) budget_av(E) saa7146_vv(E) videobuf_dma_sg(E) videobuf_core(E) budget_core(E) ttpci_eeprom(E) saa7146(E) dvb_core(E) videodev(E) mc(E) evdev(E) aesni_intel(E) libaes(E) crypto_simd(E) cryptd(E) glue_helper(E) rapl(E) pcspkr(E) xen_pcifront(E) nf_tables(E) nfnetlink(E) drm(E) ip_tables(E) x_tables(E) autofs4(E) btrfs(E) blake2b_generic(E) zstd_decompress(E) zstd_compress(E) raid10(E) raid456(E) async_raid6_recov(E) async_memcpy(E) async_pq(E) async_xor(E) async_tx(E) xor(E) raid6_pq(E) libcrc32c(E) crc32c_generic(E) raid1(E) raid0(E) multipath(E) linear(E)
[ 45.192186] md_mod(E) dm_mod(E) crct10dif_pclmul(E) crct10dif_common(E) xen_netfront(E) xen_blkfront(E) crc32_pclmul(E) crc32c_intel(E)
[ 45.192189] CPU: 0 PID: 2192 Comm: modprobe Tainted: G E 5.7.0-900-amd64 #1 Debian 5.7.10-1
[ 45.192190] RIP: e030:proc_register+0x128/0x170
[ 45.192191] Code: 25 18 36 01 00 5b 48 89 e8 5d 41 5c 41 5d c3 48 8b 95 a0 00 00 00 49 8b b4 24 a0 00 00 00 48 c7 c7 d8 51 f0 81 e8 6a e4 d3 ff <0f> 0b c6 05 f7 17 36 01 00 8b 45 5c 48 c7 c7 e0 9e 0a 82 8d b0 00
[ 45.192191] RSP: e02b:ffffc900408d7c10 EFLAGS: 00010282
[ 45.192192] RAX: 0000000000000000 RBX: ffff888036b7ebd8 RCX: 0000000000000007
[ 45.192193] RDX: 0000000000000007 RSI: 0000000000000001 RDI: ffff88803e819ac0
[ 45.192193] RBP: ffff88803c506c00 R08: 00000000000001a7 R09: 0000000000000004
[ 45.192193] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888036b7ed80
[ 45.192194] R13: ffff888036b7ee00 R14: 0000000000000004 R15: ffff88803b2158d8
[ 45.192199] FS: 00007f1f587b4540(0000) GS:ffff88803e800000(0000) knlGS:0000000000000000
[ 45.192200] CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 45.192200] CR2: 000055da16c759b0 CR3: 0000000004788000 CR4: 0000000000040660
[ 45.192202] Call Trace:
[ 45.192205] proc_create_data+0x39/0x50
[ 45.192208] dvblb_init_procfs_device+0x34/0x50 [dvbloopback]
[ 45.192210] create_lb_dev+0x172/0x238 [dvbloopback]
[ 45.192211] dvblb_init+0x1cf/0x1000 [dvbloopback]
[ 45.192212] ? 0xffffffffc08dd000
[ 45.192214] do_one_initcall+0x46/0x200
[ 45.192216] ? free_unref_page_commit+0x8b/0x110
[ 45.192218] ? _cond_resched+0x15/0x30
[ 45.192220] ? kmem_cache_alloc_trace+0x161/0x220
[ 45.192221] ? do_init_module+0x23/0x230
[ 45.192222] do_init_module+0x5c/0x230
[ 45.192223] load_module+0x234c/0x24f0
[ 45.192225] ? __do_sys_finit_module+0xaa/0x110
[ 45.192226] __do_sys_finit_module+0xaa/0x110
[ 45.192227] do_syscall_64+0x52/0x180
[ 45.192229] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 45.192230] RIP: 0033:0x7f1f588d5a79
[ 45.192231] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e7 53 0c 00 f7 d8 64 89 01 48
[ 45.192231] RSP: 002b:00007ffedc8c3ca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 45.192232] RAX: ffffffffffffffda RBX: 0000563fc50ebcc0 RCX: 00007f1f588d5a79
[ 45.192232] RDX: 0000000000000000 RSI: 0000563fc3f09358 RDI: 0000000000000003
[ 45.192232] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000000
[ 45.192233] R10: 0000000000000003 R11: 0000000000000246 R12: 0000563fc3f09358
[ 45.192233] R13: 0000000000000000 R14: 0000563fc50ebdd0 R15: 0000563fc50ebcc0
[ 45.192234] ---[ end trace 612e76cf849a80eb ]---
[ 45.192263] ------------[ cut here ]------------

and then the same for:

  • proc_dir_entry 'adapter1/frontend' already registered

Did I miss anything?

Works perfect here on Debian 4.19.67

Not detecting channel changes?

I'm running Ubuntu 18.04. I'm tuned to a channel but I don't see any activity in the ffdecsawrapper.log file.

Mar 26 06:31:44.735 : Listening on port 5456
Mar 26 06:33:43.737 CAM(core.net): idle timeout, disconnected 1.xxx.com:12345

Any idea what went wrong?

dvb_loopback.c stack corruption

When running scan-s2 with dvb-s2 card TBS 9685 the loopback module crashes hard due to stack corruption.

      KERNEL: /storage/hans/ubuntu-xenial/debian/build/build-lowlatency/vmlinux
    DUMPFILE: 201610172348/dump.201610172348  [PARTIAL DUMP]
        CPUS: 4
        DATE: Mon Oct 17 23:48:31 2016
      UPTIME: 00:34:35
LOAD AVERAGE: 0.15, 0.03, 0.01
       TASKS: 457
    NODENAME: mbe
     RELEASE: 4.4.0-43-lowlatency
     VERSION: #63 SMP PREEMPT Mon Oct 17 19:41:33 CEST 2016
     MACHINE: x86_64  (2493 Mhz)
      MEMORY: 7.9 GB
       PANIC: "BUG: unable to handle kernel NULL pointer dereference at 000000000000000d"
         PID: 3009
     COMMAND: "scan-s2"
        TASK: ffff880233192a00  [THREAD_INFO: ffff8801e7554000]
         CPU: 0
       STATE: TASK_RUNNING (PANIC)

crash> sys -i
        DMI_BIOS_VENDOR: American Megatrends Inc.
       DMI_BIOS_VERSION: 1001
          DMI_BIOS_DATE: 10/20/2011
         DMI_SYS_VENDOR: System manufacturer
       DMI_PRODUCT_NAME: System Product Name
    DMI_PRODUCT_VERSION: System Version
     DMI_PRODUCT_SERIAL: System Serial Number
       DMI_PRODUCT_UUID: 28259C00-5BCB-11D9-B024-5404A6CE0EF0
       DMI_BOARD_VENDOR: ASUSTeK Computer INC.
         DMI_BOARD_NAME: P8H61-M EVO
      DMI_BOARD_VERSION: Rev x.0x
       DMI_BOARD_SERIAL: MT701B013401018
    DMI_BOARD_ASSET_TAG: To be filled by O.E.M.
     DMI_CHASSIS_VENDOR: Chassis Manufacture
       DMI_CHASSIS_TYPE: 3
    DMI_CHASSIS_VERSION: Chassis Version
     DMI_CHASSIS_SERIAL: Chassis Serial Number
  DMI_CHASSIS_ASSET_TAG: Asset-1234567890


crash> bt
PID: 3009   TASK: ffff880233192a00  CPU: 0   COMMAND: "scan-s2"
 #0 [ffff8801e75576c0] machine_kexec at ffffffff8105d63b
 #1 [ffff8801e7557720] crash_kexec at ffffffff81111052
 #2 [ffff8801e75577f0] oops_end at ffffffff81032d49
 #3 [ffff8801e7557818] no_context at ffffffff8106b445
 #4 [ffff8801e7557878] __bad_area_nosemaphore at ffffffff8106b710
 #5 [ffff8801e75578c0] bad_area at ffffffff8106b8e3
 #6 [ffff8801e75578e8] __do_page_fault at ffffffff8106be2f
 #7 [ffff8801e7557940] do_page_fault at ffffffff8106bf02
 #8 [ffff8801e7557960] page_fault at ffffffff818410b8
    [exception RIP: __kmalloc+145]
    RIP: ffffffff811f01f1  RSP: ffff8801e7557a10  RFLAGS: 00010202
    RAX: 0000000000000000  RBX: 00000000403c6f2b  RCX: 0000000000830800
    RDX: 0000000000830700  RSI: 0000000000830700  RDI: 000000000001a160
    RBP: ffff8801e7557a48   R8: ffff880237001800   R9: ffffffffc06fe0ff
    R10: 000000000000003c  R11: 0000000000000286  R12: 00000000024000c0
    R13: 00000000000000bc  R14: ffff880237001800  R15: 000000000000000d
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #9 [ffff8801e7557a50] dvblb_ioctl at ffffffffc06fe0ff [dvbloopback]
#10 [ffff8801e7557ea0] do_vfs_ioctl at ffffffff8122621f
#11 [ffff8801e7557f10] sys_ioctl at ffffffff81226489
#12 [ffff8801e7557f50] entry_SYSCALL_64_fastpath at ffffffff8183ef32
    RIP: 00007f5ddd165687  RSP: 00007ffe54cdf558  RFLAGS: 00000286
    RAX: ffffffffffffffda  RBX: 0000000000000000  RCX: 00007f5ddd165687
    RDX: 00007ffe54cdf570  RSI: 00000000403c6f2b  RDI: 0000000000000004
    RBP: 00007ffe54cdf580   R8: 00000000ffffffff   R9: 0000000000000001
    R10: 0000000000000000  R11: 0000000000000286  R12: 00000000004011a0
    R13: 00007ffe54cdfcc0  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: 0000000000000010  CS: 0033  SS: 002b
crash> 

crash> bt -t
PID: 3009   TASK: ffff880233192a00  CPU: 0   COMMAND: "scan-s2"
              START: machine_kexec at ffffffff8105d63b
  [ffff8801e75576c0] machine_kexec at ffffffff8105d63b
  [ffff8801e7557720] crash_kexec at ffffffff81111052
  [ffff8801e7557768] dvblb_ioctl at ffffffffc06fe0ff [dvbloopback]
  [ffff8801e75577a8] __kmalloc at ffffffff811f01f1
  [ffff8801e75577f0] oops_end at ffffffff81032d49
  [ffff8801e7557818] no_context at ffffffff8106b445
  [ffff8801e7557878] __bad_area_nosemaphore at ffffffff8106b710
  [ffff8801e75578c0] bad_area at ffffffff8106b8e3
  [ffff8801e75578e8] __do_page_fault at ffffffff8106be2f
  [ffff8801e7557940] do_page_fault at ffffffff8106bf02
  [ffff8801e7557960] page_fault at ffffffff818410b8
  [ffff8801e75579a8] dvblb_ioctl at ffffffffc06fe0ff [dvbloopback]
  [ffff8801e75579e8] __kmalloc at ffffffff811f01f1
  [ffff8801e7557a18] console_unlock at ffffffff810dab5b
  [ffff8801e7557a50] dvblb_ioctl at ffffffffc06fe0ff [dvbloopback]
  [ffff8801e7557a58] vprintk_emit at ffffffff810db165
  [ffff8801e7557ac8] dvblb_looped_ioctl at ffffffffc06fd480 [dvbloopback]
  [ffff8801e7557b40] dvblb_fake_ioctl at ffffffffc06fd28a [dvbloopback]
  [ffff8801e7557b78] autoremove_wake_function at ffffffff810c55e0
  [ffff8801e7557bc8] dvblb_open at ffffffffc06fda9b [dvbloopback]
  [ffff8801e7557c30] dvb_device_open at ffffffffc0586486 [dvb_core]
  [ffff8801e7557c60] chrdev_open at ffffffff81216f2e
  [ffff8801e7557ca8] mntput_no_expire at ffffffff8123328c
  [ffff8801e7557cd0] mntput at ffffffff81233434
  [ffff8801e7557ce0] terminate_walk at ffffffff8121cc7b
  [ffff8801e7557d08] path_openat at ffffffff812204ce
  [ffff8801e7557dc8] do_filp_open at ffffffff81222f75
  [ffff8801e7557ea0] do_vfs_ioctl at ffffffff8122621f
  [ffff8801e7557eb8] putname at ffffffff81221ee4
  [ffff8801e7557ed0] do_sys_open at ffffffff812116ff
  [ffff8801e7557f10] sys_ioctl at ffffffff81226489
  [ffff8801e7557f50] entry_SYSCALL_64_fastpath at ffffffff8183ef32
    RIP: 00007f5ddd165687  RSP: 00007ffe54cdf558  RFLAGS: 00000286
    RAX: ffffffffffffffda  RBX: 0000000000000000  RCX: 00007f5ddd165687
    RDX: 00007ffe54cdf570  RSI: 00000000403c6f2b  RDI: 0000000000000004
    RBP: 00007ffe54cdf580   R8: 00000000ffffffff   R9: 0000000000000001
    R10: 0000000000000000  R11: 0000000000000286  R12: 00000000004011a0
    R13: 00007ffe54cdfcc0  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: 0000000000000010  CS: 0033  SS: 002b

The reason to this crash is the extra dtv_properties added long time ago.
in dvblb_usercopy() , case (_IOC_WRITE | _IOC_READ):

struct dtv_property is added as a pointer to parg,
whis is sbuf or ( kmalloc but normally not) actually it doesn't matter in this case.

        case (_IOC_WRITE | _IOC_READ):
                if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
                        parg = sbuf;
                } else {
                        /* too big to allocate from stack */
                        mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
                        if (NULL == mbuf)
                                return -ENOMEM;
                        parg = mbuf;
                }

                err = -EFAULT;
                if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
                        goto out;
                if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY)) {
                    tvps = (struct dtv_properties __user *)arg;
                    tvp = (struct dtv_property *) kmalloc(tvps->num *
                        sizeof(struct dtv_property), GFP_KERNEL);
                    if (!tvp){
                        err = -ENOMEM;
                        goto out;
                    }
                    if (copy_from_user(tvp, tvps->props,
                        (tvps->num) * sizeof(struct dtv_property))) {
                        err = -EFAULT;
                        goto out;
                    }
>  Here is tvp attached to parg  and parg + _IOC_SIZE(cmd)  is NOT EQ to tvps->props
>  which is assumed at many places like dvblb_read,  dvblb_fake_ioctl etc
>  where  tvps->props is calculated as  parg + _IOC_SIZE(cmd) 
>  In most cases parg is sbuf which is 128bytes and dtv_properties is much bigger.
>
                    tvps = (struct dtv_properties __user *)parg;
                    tvps->props = tvp;
                    tvp = NULL;
                }
                break;
        }

        /* call driver */
> call dvblb_fake_ioctl( parg is most likely sbuf)
        if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
                err = -ENOTTY;

Here is an example in dvblb_fake_ioctl() line 311
where tvps->props is calculated as parg + _IOC_SIZE(cmd)

       if (cmd < DVBLB_MAX_CMDS || ! (cmd & IOC_IN)){
                if ((cmd == FE_GET_PROPERTY)) {
                    tvps = (struct dtv_properties __user *)(lbdev->ioctlretdata + sizeof(int));
                    _ioctllen = lbdev->ioctllen + (tvps->num * sizeof(struct dtv_property));
                    memcpy(arg, lbdev->ioctlretdata + sizeof(int), _ioctllen);
                    tvps = (struct dtv_properties __user *)arg;
                    tvps->props = (struct dtv_property __user *)(arg + lbdev->ioctllen);
                }
                else
                    memcpy(arg, lbdev->ioctlretdata + sizeof(int), lbdev->ioctllen);
        }

Rewrite dnames

In dvbloopback.h, there is a enum referring to names of the devices, used in print/debug statements.
During a commit of #18 the patch is not correctly applied, so here is a patch to correct it.
For descrambler we probably need a similar patch. I'll look into it as well.

diff --git a/dvbloopback/dvbloopback.h b/dvbloopback/dvbloopback.h
index df004aa..645274b 100644
--- a/dvbloopback/dvbloopback.h
+++ b/dvbloopback/dvbloopback.h
@@ -6,8 +6,7 @@
 #define DVBLB_MAXFD 96
 
 static const char * const dnames[] = {
-        "video", "audio", "sec", "frontend", "demux", "dvr", "ca",
-         "sec", "frontend", "demux", "dvr", "ca", "net", "video", "audio", "osd" "sec", "frontend", "demux", "dvr", "ca", "net", "video", "audio", "osd"
+        "sec", "frontend", "demux", "dvr", "ca", "net", "video", "audio", "osd"
 };
 
 typedef enum dvblb_type {


See dvbdev.h, the enum dvb_device_type for reference.

Build failure on kernels >= 5.6.0

Hi,

with version 5.6.0 the Linux kernel changed its API. The interface of "proc_create_data()" changed to using "struct proc_ops" instead of "struct file_operations".

I created a small patch file "5.6-linux.patch" that can be applied easily. However, I would prefer to add these changes directly to your source code encapsulated in "#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)" / "#else" / "#endif" statements. Currently, it seems that your repo is accumulating patch files. At least here on Gentoo Linux, it becomes quite challenging to apply this ever growing set of patch files and "sed" commands.

Please add this patch file to your repo, or better, apply it directly using those Kernel version guards. If you want me to help you with this, just tell me, then I'm going to prepare a pull request.

Regards,
Florian

Newer kernel

Hi

Just upgraded my system from FC32 to FC37 and this means that the kernel is significantly newer. Previosly 5.11.22 and now the current kernel is: 6.2.15

  • Needed to do:
    sed -i -e "s/PDE_DATA/pde_data/" dvbloopback/module/dvblb_proc.c
    to get a clean compile of dvbloopback.ko, which is the only one I need and the module loads fine.
    But when MythTV is trying to use it the system will crash with a "Kernel stack corruption" message.

Worked fine with the old kernel.

Any hints on what may be wrong? And how do I start debugging this?

Problem with full support of FE_GET_PROPERTY

Hi,

I would like to address an issue I'm experiencing since I upgraded Mythtv to 0.31.
Mythtv is crashing on DVBv5 API calls because dvbloopback/descrambler is not returning the correct dtv_properties.
Disabling the DVBv5 calls in Mythtv will prevent it from crashing but dvbloopback needs some fixing.

The investigation I did already so far, in a test-bed (using DTV_STAT_SIGNAL_STRENGTH):

Example code:

static struct dtv_property prop[1] = {
        { .cmd = DTV_STAT_SIGNAL_STRENGTH},
    };

static struct dtv_properties dtv_propa = {
    .num = 1, .props = propa
    };
    int ret;
    if ((ret=ioctl(fd, FE_GET_PROPERTY, &dtv_propa)) == -1) {
        perror("ioctl");
        return -1;
    }
    printf("Signal strength: ret=%u res=%u\n",ret, dtv_propa.props->result);

Results in GDB with physical adapter:


	    if ((ret=ioctl(fd, FE_GET_PROPERTY, &dtv_propa)) == -1) {
(gdb) print dtv_propa
$1 = {num = 1, props = 0x5555555580c0 <propa>}
(gdb) print propa
$2 = {{cmd = 62, reserved = {0, 0, 0}, u = {data = 0, st = {len = 0 '\000', stat = {{scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', 
            {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}}}, buffer = {
        data = '\000' <repeats 31 times>, len = 0, reserved1 = {0, 0, 0}, reserved2 = 0x0}}, result = 0}}
(gdb) continue
Continuing.

Breakpoint 2, main () at test-dvb.c:56
56	    printf("Signal strength: ret=%u res=%u\n",ret, dtv_propa.props->result);
(gdb) print dtv_propa
$3 = {num = 1, props = 0x5555555580c0 <propa>}
(gdb) print propa
$4 = {{cmd = 62, reserved = {0, 0, 0}, u = {data = 2853175553, st = {len = 1 '\001', stat = {{scale = 1 '\001', {uvalue = 18446744073709529616, 
              svalue = -22000}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {
              uvalue = 0, svalue = 0}}}}, buffer = {data = "\001\001\020\252\377\377\377\377\377\377", '\000' <repeats 21 times>, len = 0, 
        reserved1 = {0, 0, 0}, reserved2 = 0x0}}, result = 0}}
(gdb) 

Results in GDB with loopback adapter:

	    if ((ret=ioctl(fd, FE_GET_PROPERTY, &dtv_propa)) == -1) {
(gdb) print dtv_propa
$1 = {num = 1, props = 0x5555555580c0 <propa>}
(gdb) print propa
$2 = {{cmd = 62, reserved = {0, 0, 0}, u = {data = 0, st = {len = 0 '\000', stat = {{scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', 
            {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}}}, buffer = {
        data = '\000' <repeats 31 times>, len = 0, reserved1 = {0, 0, 0}, reserved2 = 0x0}}, result = 0}}
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
main () at test-dvb.c:56
56	    printf("Signal strength: ret=%u res=%u\n",ret, dtv_propa.props->result);
(gdb) print dtv_propa
$3 = {num = 1, props = 0xffff9c65bb697850}
(gdb) print propa
$4 = {{cmd = 62, reserved = {0, 0, 0}, u = {data = 2853175553, st = {len = 1 '\001', stat = {{scale = 1 '\001', {uvalue = 18446744073709529616, 
              svalue = -22000}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {uvalue = 0, svalue = 0}}, {scale = 0 '\000', {
              uvalue = 0, svalue = 0}}}}, buffer = {data = "\001\001\020\252\377\377\377\377\377\377", '\000' <repeats 21 times>, len = 0, 
        reserved1 = {0, 0, 0}, reserved2 = 0x0}}, result = 0}}
(gdb)

It seems that dtv_propa.props is corrupt and not properly copied.
However propa is set correctly, but is not being referred to by dtv_propa.props
There are some comments in dvb_loopback.c (in function call_func) about copying pointers.

Anyone experiencing similar issues?

configure problem

I saw this error scroll by:
./configure: line 1159: [: /lib/modules/4.2: binary operator expected

The issue is that DEBIANKERNEL=$(echo pwd | grep -o '[[:digit:]]\+\.[[:digit:]]\+')
does not work when there are more digits in the path.
for example: echo ~/src/dvbloopback-4.2/linux-4.2.5|grep -o '[[:digit:]]\+\.[[:digit:]]\+' gives

4.2
4.2

Maybe add a | tail -1

Appreciate your work with ffdecsawrapper

/Peje

Ubuntu 16.04 + Genpix Skywalker

Hello there, I have been following and using your ffdecsawrapper/dvbloopback for a few years now and I just wanted to first say thank you for your work. I appologize for posting here but I don't know where else to do it. I used to follow your website (lursen.org I believe it was) for info on the latest use of ffdecsawrapper/dvbloopback and mythtv on Ubuntu. I'm stuck on Ubuntu 12.04 and I need to upgrade due to some unrelated issues. I have tried getting descrambler + dvbloopback working in 16.04 but I think I am running into a locking issue with my Genpix Skywalker tuners. I keep getting the error in dmesg/syslog

[  937.926955] gp8psk: usb in 135 operation failed.
[  939.926907] gp8psk: usb out operation failed.

I know this isn't directly related to the git repo for dvbloopback but with your lursen.org site down and dvb.happysat.org gone for good I'm not sure where else to turn. I have also added the FE_CAN_2G_MODULATION for the genpix driver as well to no avail.

I hope you'd be able to lend me a hand.

ffdecsawrapper crashing

Hello,

I am getting quite frequent segfaults (once a day or so) of ffdecsawrapper followed by bunch of dvblb_fake_ioctl interrupted: errors.
Compiled from dvbloopback repo with opensource TBS drivers on debian jessie stock kernel 3.16.0-4-amd64, using your configure script.

Any ideas what can be causing this?

[283741.436216] ffdecsawrapper[25303]: segfault at 7fdc4b391000 ip 000000000046b9b2 sp 00007fdc4b38ea70 error 4 in ffdecsawrapper[400000+de000]
[283742.655062] dvblb_fake_ioctl interrupted: 2150133582
[283743.655858] dvblb_fake_ioctl interrupted: 28483

ffdecsawrapper+dvblast

Hello!

I started dvblast in the configuration file is a SID(among others) for which it does not ffdecsawrapper authorization.
Programs for which authorization has ffdecsawrapper are decoded (visible in oscam_web), but can not be played(vlc).
Subject to dvblast.conf such a SID is not, everything ok.
???

dvbloopback crashing on Intel Kaby Lake

Ubuntu 16.04.2 x86_64 running on

                       system         Computer
/0                     bus            Motherboard
/0/0                   memory         7856MiB System memory
/0/1                   processor      Intel(R) Pentium(R) CPU G4560 @ 3.50GHz
/0/100                 bridge         Intel Corporation
/0/100/2               display        Intel Corporation
/0/100/14              bus            Sunrise Point-H USB 3.0 xHCI Controller
/0/100/16              communication  Sunrise Point-H CSME HECI #1
/0/100/17              storage        Sunrise Point-H SATA controller [AHCI mode]
/0/100/1c              bridge         Sunrise Point-H PCI Express Root Port #5
/0/100/1c.7            bridge         Sunrise Point-H PCI Express Root Port #8
/0/100/1c.7/0  enp2s0  network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
/0/100/1d              bridge         Sunrise Point-H PCI Express Root Port #9
/0/100/1f              bridge         Sunrise Point-H LPC Controller
/0/100/1f.2            memory         Memory controller
/0/100/1f.3            multimedia     Sunrise Point-H HD Audio
/0/100/1f.4            bus            Sunrise Point-H SMBus

After upgrading platform to Intel Kaby Lake, dvbloopback keeps crashing.

Steps to reproduce:

  1. Freshly installed Ubuntu 16.04.2
  2. Built dvbloopback by running ./configure, which rebuilds kernel with dvbloopback in tree
  3. modprobe dvbloopback && ffdecsawrapper --join 0:1
  4. Open VLC or Kaffeine or TVHeadend and specify adapter as /dev/dvb/adapter1

I'm actually using TBS5922SE dvb card, but for a test I've connected Geniatech Mygica T230 and there is exactly the same issue with it.

[  373.339759] dvbloopback: registering 1 adapters
[  373.339833] DVB: registering new adapter (DVB-LOOPBACK)
[  395.815985] BUG: unable to handle kernel paging request at 00007f8279b39720
[  395.816014] IP: [<ffffffffc0d10330>] dvblb_ioctl+0x510/0x6d0 [dvbloopback]
[  395.816042] PGD 20e83b067 PUD 2058d0067 PMD 1fb25c067 PTE 8000000217b99867
[  395.816069] Oops: 0001 [#1] SMP
[  395.816084] Modules linked in: dvbloopback(OE) bnep pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tbsfe(OE) tbs5922se(POE) ir_lirc_codec(OE) lirc_dev(OE) ir_mce_kbd_decoder(OE) ir_sony_decoder(OE) ir_jvc_decoder(OE) ir_rc6_decoder(OE) ir_rc5_decoder(OE) dvb_usb_tbs5923(OE) dvb_usb(OE) dvb_core(OE) ir_nec_decoder(OE) rc_core(OE) eeepc_wmi asus_wmi mxm_wmi sparse_keymap intel_rapl x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_hdmi snd_hda_codec_realtek kvm snd_hda_codec_generic input_leds irqbypass joydev crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel snd_hda_codec
[  395.816345]  aesni_intel snd_hda_core snd_hwdep snd_pcm snd_seq_midi aes_x86_64 snd_seq_midi_event snd_rawmidi lrw glue_helper ablk_helper snd_seq cryptd snd_seq_device hci_uart acpi_als snd_timer btbcm serio_raw btqca snd btintel kfifo_buf soundcore industrialio intel_lpss_acpi bluetooth mei_me intel_lpss wmi shpchp mei mac_hid acpi_pad nfsd nct6775 hwmon_vid auth_rpcgss nfs_acl lockd coretemp grace sunrpc parport_pc ppdev lp parport autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear raid1 i915 i2c_algo_bit hid_generic drm_kms_helper r8169 ahci syscopyarea sysfillrect mii sysimgblt fb_sys_fops libahci psmouse usbhid i2c_hid drm pinctrl_sunrisepoint video pinctrl_intel hid fjes
[  395.816623] CPU: 2 PID: 7128 Comm: vlc Tainted: P         C OE   4.8.0-39-generic #42~16.04.1-Ubuntu
[  395.816648] Hardware name: System manufacturer System Product Name/H110M-R, BIOS 3016 12/27/2016
[  395.816673] task: ffff9c0501d5e3c0 task.stack: ffff9c0524654000
[  395.816690] RIP: 0010:[<ffffffffc0d10330>]  [<ffffffffc0d10330>] dvblb_ioctl+0x510/0x6d0 [dvbloopback]
[  395.816720] RSP: 0018:ffff9c0524657aa0  EFLAGS: 00010246
[  395.816736] RAX: 0000000000000000 RBX: 00007f8279b39720 RCX: 0000000000000000
[  395.816756] RDX: fffffffffffffff2 RSI: 00007f8279b39730 RDI: ffff9c0524657de0
[  395.816776] RBP: ffff9c0524657e80 R08: ffff9c0524658000 R09: 00000000000000c0
[  395.816797] R10: ffff9c052ad7c238 R11: ffff9c05001ede40 R12: ffff9c0524657dd0
[  395.816817] R13: ffff9c052ad7c200 R14: 0000000000000010 R15: 0000000040106f52
[  395.816837] FS:  00007f8279b3a700(0000) GS:ffff9c0536d00000(0000) knlGS:0000000000000000
[  395.816860] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  395.816877] CR2: 00007f8279b39720 CR3: 00000002114b6000 CR4: 00000000003406e0
[  395.816897] Stack:
[  395.816904]  0000000100005e1d ffffffff98cf3e80 0000000101d5e3c0 ffffffffc0d0f450
[  395.816931]  0000000000000000 0000000000000246 0000000000000283 0000000000000283
[  395.816965]  ffff9c0524657b08 ffffffff98cc6fc5 ffff9c04fb2d0090 ffffffff99498b52
[  395.816990] Call Trace:
[  395.817002]  [<ffffffff98cf3e80>] ? del_timer_sync+0x50/0x50
[  395.817019]  [<ffffffffc0d0f450>] ? dvblb_fake_ioctl+0x450/0x450 [dvbloopback]
[  395.817041]  [<ffffffff98cc6fc5>] ? finish_wait+0x55/0x70
[  395.817059]  [<ffffffff99498b52>] ? mutex_lock_interruptible+0x12/0x40
[  395.817078]  [<ffffffffc0d0f277>] ? dvblb_fake_ioctl+0x277/0x450 [dvbloopback]
[  395.817100]  [<ffffffff98cc7470>] ? wake_atomic_t_function+0x60/0x60
[  395.817119]  [<ffffffffc0d0fa6b>] ? dvblb_open+0x2cb/0x3c0 [dvbloopback]
[  395.817141]  [<ffffffffc0ba54b7>] ? dvb_device_open+0xd7/0x110 [dvb_core]
[  395.817161]  [<ffffffff98e37d5f>] ? chrdev_open+0xbf/0x1b0
[  395.817179]  [<ffffffff98e4bfb4>] ? dput+0xc4/0x250
[  395.817194]  [<ffffffff98e55924>] ? mntput+0x24/0x40
[  395.817210]  [<ffffffff98e3d69e>] ? terminate_walk+0x8e/0xf0
[  395.817227]  [<ffffffff98e422a1>] ? path_openat+0x411/0x1440
[  395.817244]  [<ffffffff98e445a5>] ? do_filp_open+0xa5/0x100
[  395.817262]  [<ffffffff98e4bf24>] ? dput+0x34/0x250
[  395.817278]  [<ffffffff98e478c1>] do_vfs_ioctl+0xa1/0x5f0
[  395.817294]  [<ffffffff98e43444>] ? putname+0x54/0x60
[  395.818617]  [<ffffffff98e534e5>] ? set_close_on_exec+0x35/0x70
[  395.819943]  [<ffffffff98e47e89>] SyS_ioctl+0x79/0x90
[  395.821238]  [<ffffffff9949b7f6>] entry_SYSCALL_64_fastpath+0x1e/0xa8
[  395.822536] Code: e8 26 b3 32 d8 48 85 c0 48 c7 c2 f2 ff ff ff 0f 85 5e ff ff ff 41 81 ff 52 6f 10 40 74 0d 41 81 ff 53 6f 10 80 0f 85 5d fe ff ff <8b> 03 be c0 00 40 02 48 8d 14 c0 48 8d 3c 50 48 c1 e7 02 e8 38 
[  395.823975] RIP  [<ffffffffc0d10330>] dvblb_ioctl+0x510/0x6d0 [dvbloopback]
[  395.825328]  RSP <ffff9c0524657aa0>
[  395.826691] CR2: 00007f8279b39720
[  395.834804] ---[ end trace 1aff8204f1e1cacb ]---

I believe this is an issue with the new platform, but I'm out of ideas already how to determine the source. BIOS was updated, different settings were tried, but nothing helps

Problem with include dvbdev.h

I always have to change the include

#include "dvbdev.h"
to
#include <media/dvbdev.h>

in files dvb_loopback.c and dvblb_internal.h to make it compile on Gentoo 4.x or 5.x kernels.

configure script is broken

There is an error on line 80 in the configure script, the ;; must be removed so the script can be run.

Problems on 4.11

I'm trying to upgrade my kernel to 4.11 and seem to run into some dvbloopback problems.
I'm quite convinced that my dvb adapters still work:

# scan -a0 ziggo.conf
scanning ziggo.conf
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
initial transponder 474000000 6875000 0 3
>>> tune to: 474000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64
0x0000 0x4d25: pmt_pid 0x1130 Ziggo -- BBC First (running, scrambled)
0x0000 0x4d2b: pmt_pid 0x0ed8 Ziggo -- Secret Circle info (running, scrambled)
...

# scan -a1 ziggo.conf
scanning ziggo.conf
using '/dev/dvb/adapter1/frontend0' and '/dev/dvb/adapter1/demux0'
initial transponder 474000000 6875000 0 3
>>> tune to: 474000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64
Network Name 'Ziggo Network'
0x0000 0x4d25: pmt_pid 0x1130 Ziggo -- BBC First (running, scrambled)
0x0000 0x4d2b: pmt_pid 0x0ed8 Ziggo -- Secret Circle info (running, scrambled)
...

But when I use the first dvbloopback device I get the following error:

# scan -a2 ziggo.conf
scanning ziggo.conf
using '/dev/dvb/adapter2/frontend0' and '/dev/dvb/adapter2/demux0'
main:2745: FATAL: failed to open '/dev/dvb/adapter2/frontend0': 14 Bad address

But the dvbloopback device is there (at least the /dev tree):

# ls -1 /dev/dvb/adapter2/
audio0
audio1
demux0
demux1
dvr0
dvr1
frontend0
frontend1
osd0
osd1
video0
video1

The same is true for second loopback device, in case you wondered.

I've tried to apply the normal routine (patch dvbdev.c etc.) for baking dvbloopback in tree for 4.11, but may have missed a (new) step. Could you please shed some light on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.