Using Magix USB-Videowandler 2 on Linux

 Posted by:   Posted on:   Updated on:  2023-01-12T15:21:45Z

How to compile V4L drivers with support for Magix USB-Videowandler 2 video capture card

Videowandler 2 is an USB analog video capture card. There is no official driver support for Linux and the device does not work when you plug it in. According to lsusb, the device is Afatech, which is totally wrong. The kernel only loads modules for USB audio - and this is the only thing that works (the audio input appears as a separate sound card).

Videowandler 2 is based on eMPIA 2861 USB chip. Video conversion is done by SAA7113 and audio conversion by EMP202. The IDs of the device are 1B80:E349. When opening the case, you may find printed on the board UB317 Ver:A or UB315 Ver:C. The latter my be identical to Kworld UB315 but I’m not sure.

Magix USB-Videowandler 2 board. Photo by Christian Enders.

Looking at Linux supported devices with EM2861, EMP202 and SAA7113H, I found Honestech Vidbox NW03. It has a totally different board layout, but I decided to force Honestech drivers for Videowandler on Windows. And the capture worked.

Now, all that’s needed to make this work on Linux is to compile V4L drivers from source after some minor additions to em28xx supported devices. I followed with success the official LinuxTV instructions on how to compile and install V4L device drivers. Here is what I did.
git clone --depth=1 git://linuxtv.org/media_build.git
cd media_build 
./build --main-git --depth 1
This will download and build all drivers. The process takes a long time, so be patient. Once it’s done, go to media_build/media/drivers/media/usb/em28xx/. Open em28xx.h with a text editor, find the Boards supported by driver definitions and at the end add yours:
#define EM2861_BOARD_MAGIX_VIDEOWANDLER2   101
As new boards are added, make sure you use an unique number for your board. When I edited this, the last board had 100, so I used 101. Save and close. Open em28xx-cards.c and locate the array declaration: struct em28xx_board em28xx_boards[]. Add a new element into this array, like this:
 /* 1b80:e349 Magix USB Videowandler-2 (same chips as Honestech VIDBOX NW03)
  * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner */
 [EM2861_BOARD_MAGIX_VIDEOWANDLER2] = {
  .name                = "Magix USB Videowandler-2",
  .tuner_type          = TUNER_ABSENT,
  .decoder             = EM28XX_SAA711X,
  .input               = { {
   .type     = EM28XX_VMUX_COMPOSITE,
   .vmux     = SAA7115_COMPOSITE0,
   .amux     = EM28XX_AMUX_LINE_IN,
  }, {
   .type     = EM28XX_VMUX_SVIDEO,
   .vmux     = SAA7115_SVIDEO3,  /* S-VIDEO needs confirming */
   .amux     = EM28XX_AMUX_LINE_IN,
  } },
 },
Just below the board definitions should be USB IDs table in an array named em28xx_id_table[]. Add a new element in this array (at the end, before the NULL element):
{ USB_DEVICE(0x1b80, 0xe349), /* Magix USB Videowandler-2 */
   .driver_info = EM2861_BOARD_MAGIX_VIDEOWANDLER2 },
That’s it! Save and close. To compile and install the modified driver, do (terminal in media_build directory):
make -C ./v4l
sudo make -C ./ install
sudo make -C . rmmod
Plug in the Magix device. If you check dmesg, you should see:
[  389.864046] usb 2-1: new high-speed USB device number 3 using ehci-pci
[  390.015409] usb 2-1: New USB device found, idVendor=1b80, idProduct=e349
[  390.015412] usb 2-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[  390.015414] usb 2-1: Product: USB 2861 Device
[  390.171845] media: loading out-of-tree module taints kernel.
[  390.171936] media: module verification failed: signature and/or required key missing - tainting kernel
[  390.172837] media: Linux media interface: v0.10
[  390.209897] Linux video capture interface: v2.00
[  390.209900] WARNING: You are using an experimental version of the media stack.
                As the driver is backported to an older kernel, it doesn't offer
                enough quality for its usage in production.
                Use it with care.
               Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):
                3622d3e77ecef090b5111e3c5423313f11711dfa [media] ov2640: print error if devm_*_optional*() fails
[  390.239546] em28xx 2-1:1.0: New device  USB 2861 Device @ 480 Mbps (1b80:e349, interface 0, class 0)
[  390.239551] em28xx 2-1:1.0: Video interface 0 found: isoc
[  390.239648] em28xx 2-1:1.0: chip ID is em2860
[  390.381140] em28xx 2-1:1.0: EEPROM ID = 1a eb 67 95, EEPROM hash = 0xa99a2140
[  390.381143] em28xx 2-1:1.0: EEPROM info:
[  390.381145] em28xx 2-1:1.0:  AC97 audio (5 sample rates)
[  390.381146] em28xx 2-1:1.0:  500mA max power
[  390.381149] em28xx 2-1:1.0:  Table at offset 0x04, strings=0x206a, 0x0000, 0x0000
[  390.381152] em28xx 2-1:1.0: Identified as Magix USB Videowandler-2 (card=101)
[  390.381154] em28xx 2-1:1.0: analog set to isoc mode.
[  390.381277] em28xx 2-1:1.1: audio device (1b80:e349): interface 1, class 1
[  390.381287] em28xx 2-1:1.2: audio device (1b80:e349): interface 2, class 1
[  390.381302] usbcore: registered new interface driver em28xx
[  390.528984] em28xx 2-1:1.0: Registering V4L2 extension
[  391.064485] saa7115 3-0025: saa7113 found @ 0x4a (2-1:1.0)
[  392.124443] em28xx 2-1:1.0: Config register raw data: 0x50
[  392.156221] em28xx 2-1:1.0: AC97 vendor ID = 0xffffffff
[  392.172190] em28xx 2-1:1.0: AC97 features = 0x6a90
[  392.172193] em28xx 2-1:1.0: Empia 202 AC97 audio processor detected
[  395.425425] em28xx 2-1:1.0: V4L2 video device registered as video0
[  395.425427] em28xx 2-1:1.0: V4L2 VBI device registered as vbi0
[  395.425430] em28xx 2-1:1.0: V4L2 extension successfully initialized
[  395.425431] em28xx: Registered (Em28xx v4l2 Extension) extension
[  395.504874] usbcore: registered new interface driver snd-usb-audio
There are some warning messages because you are using an experimental V4L driver version, but the important thing is that the kernel registers video0 device.

tvtime using Magix Videowandler 2 as input source
tvtime using Magix Videowandler 2 as input source
You can view video using tvtime, VLC etc. Note that you may lose the changed em28xx kernel module after updating the system.

11 comments :

  1. Hello,
    nice how to.
    I searched long time and every said that magix and linux will not work.
    I tried for ubuntu and a magix usb Videowandler2.
    But for dmesg i get:
    usb 1-1.2: new high-speed USB device number 116 using dwc_otg
    [ 313.991292] usb 1-1.2: New USB device found, idVendor=1b80, idProduct=e349
    [ 313.991306] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
    [ 313.991313] usb 1-1.2: Product: USB 2861 Device
    [ 314.071992] usbcore: registered new interface driver snd-usb-audio

    It seems that he will not load the kernel.
    What i did wrong, can you help me? vlc is my software i using and the grabber is not listed

    best and thank from
    flix

    ReplyDelete
    Replies
    1. the datas are stored in
      sudo find . -name em28xx
      ./home/pimate/Schreibtisch/media_build/linux/drivers/media/usb/em28xx
      ./home/pimate/Schreibtisch/media_build/media/drivers/media/usb/em28xx
      ./lib/modules/4.4.38+/kernel/drivers/media/usb/em28xx
      ./lib/modules/4.4.38-v7+/kernel/drivers/media/usb/em28xx

      Delete
    2. I tried this on a new install of Ubuntu 18.04 and it loads the following kernel modules: em28xx_v4l,saa7115,em28xx. The device is detected and usable by QV4L2.

      Delete
  2. I try with 16.04 of ubuntu mate on raspberry. Could be this the problem. Kernels will be loaded with git this is not the Problem. I edited also the files. Maybe can I try ur files you edited maybe I did something wrong.

    ReplyDelete
    Replies
    1. Did you get errors when running make? Anyway, here are em28xx driver files, including those modified by me: em28xx_videowandler.zip

      Delete
  3. Hi,
    thanks for your files but they also dind't fix the problem.
    kernels are found in:

    ./lib/modules/4.14.84-v7+/kernel/drivers/media/i2c/saa7115.ko
    ./lib/modules/4.4.38+/kernel/drivers/media/i2c/saa7115.ko
    ./lib/modules/4.4.38-v7+/kernel/drivers/media/i2c/saa7115.ko
    ./lib/modules/4.14.84+/kernel/drivers/media/i2c/saa7115.ko

    ./lib/modules/4.14.84-v7+/kernel/drivers/media/usb/em28xx/em28xx-v4l.ko
    ./lib/modules/4.4.38+/kernel/drivers/media/usb/em28xx/em28xx-v4l.ko
    ./lib/modules/4.4.38-v7+/kernel/drivers/media/usb/em28xx/em28xx-v4l.ko
    ./lib/modules/4.14.84+/kernel/drivers/media/usb/em28xx/em28xx-v4l.ko

    ./lib/modules/4.14.84-v7+/kernel/drivers/media/usb/em28xx/em28xx.ko
    ./lib/modules/4.4.38+/kernel/drivers/media/usb/em28xx/em28xx.ko
    ./lib/modules/4.4.38-v7+/kernel/drivers/media/usb/em28xx/em28xx.ko
    ./lib/modules/4.14.84+/kernel/drivers/media/usb/em28xx/em28xx.ko

    ReplyDelete
    Replies
    1. Build fails, but I don't understand why:

      Preparing to compile for kernel version 4.14.84
      File not found: /lib/modules/4.14.84-v7+/build/.config at ./scripts/make_kconfig.pl line 33, line 4.
      Makefile:378: recipe for target 'allyesconfig' failed
      make[1]: *** [allyesconfig] Error 2
      make[1]: Leaving directory '/home/pimate/MAGIX/media_build/v4l'
      Makefile:26: recipe for target 'allyesconfig' failed
      make: *** [allyesconfig] Error 2

      Delete
  4. hi i tested again on a ne installed 16.04 ubuntu and on raspbian. I get the same errors for both. Any idea? Is it possbile you could send be your /lib/modules/4.14.84-v7+ folder or is this not the only path who belong to magix

    ReplyDelete
  5. Hi,
    it didn't worked for me.

    dmesg say:
    [ 450.294616] v4l2_common: disagrees about version of symbol v4l2_subdev_init
    [ 450.294620] v4l2_common: Unknown symbol v4l2_subdev_init (err -22)
    [ 450.294626] v4l2_common: disagrees about version of symbol v4l2_device_register_subdev
    [ 450.294627] v4l2_common: Unknown symbol v4l2_device_register_subdev (err -22)
    [ 450.294638] v4l2_common: disagrees about version of symbol v4l2_ctrl_fill
    [ 450.294640] v4l2_common: Unknown symbol v4l2_ctrl_fill (err -22)
    [ 450.310118] v4l2_common: disagrees about version of symbol v4l2_subdev_init
    [ 450.310123] v4l2_common: Unknown symbol v4l2_subdev_init (err -22)
    [ 450.310130] v4l2_common: disagrees about version of symbol v4l2_device_register_subdev
    [ 450.310132] v4l2_common: Unknown symbol v4l2_device_register_subdev (err -22)
    [ 450.310145] v4l2_common: disagrees about version of symbol v4l2_ctrl_fill
    [ 450.310147] v4l2_common: Unknown symbol v4l2_ctrl_fill (err -22)
    [ 450.330318] v4l2_common: disagrees about version of symbol v4l2_subdev_init
    [ 450.330328] v4l2_common: Unknown symbol v4l2_subdev_init (err -22)
    [ 450.330447] v4l2_common: disagrees about version of symbol v4l2_device_register_subdev
    [ 450.330451] v4l2_common: Unknown symbol v4l2_device_register_subdev (err -22)
    [ 450.330541] v4l2_common: disagrees about version of symbol v4l2_ctrl_fill
    [ 450.330545] v4l2_common: Unknown symbol v4l2_ctrl_fill (err -22)
    [ 450.446664] usbcore: registered new interface driver snd-usb-audio

    my kernel under debian: 4.19.0-8-amd64

    ReplyDelete
  6. hi, have you resolved this error?

    ReplyDelete