162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciIdea behind the dvb-usb-framework
462306a36Sopenharmony_ci=================================
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci.. note::
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci   #) This documentation is outdated. Please check at the DVB wiki
962306a36Sopenharmony_ci      at https://linuxtv.org/wiki for more updated info.
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci   #) **deprecated:** Newer DVB USB drivers should use the dvb-usb-v2 framework.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciIn March 2005 I got the new Twinhan USB2.0 DVB-T device. They provided specs
1462306a36Sopenharmony_ciand a firmware.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciQuite keen I wanted to put the driver (with some quirks of course) into dibusb.
1762306a36Sopenharmony_ciAfter reading some specs and doing some USB snooping, it realized, that the
1862306a36Sopenharmony_cidibusb-driver would be a complete mess afterwards. So I decided to do it in a
1962306a36Sopenharmony_cidifferent way: With the help of a dvb-usb-framework.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciThe framework provides generic functions (mostly kernel API calls), such as:
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci- Transport Stream URB handling in conjunction with dvb-demux-feed-control
2462306a36Sopenharmony_ci  (bulk and isoc are supported)
2562306a36Sopenharmony_ci- registering the device for the DVB-API
2662306a36Sopenharmony_ci- registering an I2C-adapter if applicable
2762306a36Sopenharmony_ci- remote-control/input-device handling
2862306a36Sopenharmony_ci- firmware requesting and loading (currently just for the Cypress USB
2962306a36Sopenharmony_ci  controllers)
3062306a36Sopenharmony_ci- other functions/methods which can be shared by several drivers (such as
3162306a36Sopenharmony_ci  functions for bulk-control-commands)
3262306a36Sopenharmony_ci- TODO: a I2C-chunker. It creates device-specific chunks of register-accesses
3362306a36Sopenharmony_ci  depending on length of a register and the number of values that can be
3462306a36Sopenharmony_ci  multi-written and multi-read.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciThe source code of the particular DVB USB devices does just the communication
3762306a36Sopenharmony_ciwith the device via the bus. The connection between the DVB-API-functionality
3862306a36Sopenharmony_ciis done via callbacks, assigned in a static device-description (struct
3962306a36Sopenharmony_cidvb_usb_device) each device-driver has to have.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciFor an example have a look in drivers/media/usb/dvb-usb/vp7045*.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciObjective is to migrate all the usb-devices (dibusb, cinergyT2, maybe the
4462306a36Sopenharmony_cittusb; flexcop-usb already benefits from the generic flexcop-device) to use
4562306a36Sopenharmony_cithe dvb-usb-lib.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciTODO: dynamic enabling and disabling of the pid-filter in regard to number of
4862306a36Sopenharmony_cifeeds requested.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciSupported devices
5162306a36Sopenharmony_ci-----------------
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciSee the LinuxTV DVB Wiki at https://linuxtv.org for a complete list of
5462306a36Sopenharmony_cicards/drivers/firmwares:
5562306a36Sopenharmony_cihttps://linuxtv.org/wiki/index.php/DVB_USB
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci0. History & News:
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci  2005-06-30
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci  - added support for WideView WT-220U (Thanks to Steve Chang)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci  2005-05-30
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci  - added basic isochronous support to the dvb-usb-framework
6662306a36Sopenharmony_ci  - added support for Conexant Hybrid reference design and Nebula
6762306a36Sopenharmony_ci	       DigiTV USB
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci  2005-04-17
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci  - all dibusb devices ported to make use of the dvb-usb-framework
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci  2005-04-02
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci  - re-enabled and improved remote control code.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci  2005-03-31
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci  - ported the Yakumo/Hama/Typhoon DVB-T USB2.0 device to dvb-usb.
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci  2005-03-30
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci  - first commit of the dvb-usb-module based on the dibusb-source.
8462306a36Sopenharmony_ci    First device is a new driver for the
8562306a36Sopenharmony_ci    TwinhanDTV Alpha / MagicBox II USB2.0-only DVB-T device.
8662306a36Sopenharmony_ci  - (change from dvb-dibusb to dvb-usb)
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci  2005-03-28
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci  - added support for the AVerMedia AverTV DVB-T USB2.0 device
9162306a36Sopenharmony_ci    (Thanks to Glen Harris and Jiun-Kuei Jung, AVerMedia)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci  2005-03-14
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci  - added support for the Typhoon/Yakumo/HAMA DVB-T mobile USB2.0
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci  2005-02-11
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci  - added support for the KWorld/ADSTech Instant DVB-T USB2.0.
10062306a36Sopenharmony_ci    Thanks a lot to Joachim von Caron
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci  2005-02-02
10362306a36Sopenharmony_ci  - added support for the Hauppauge Win-TV Nova-T USB2
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci  2005-01-31
10662306a36Sopenharmony_ci  - distorted streaming is gone for USB1.1 devices
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci  2005-01-13
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci  - moved the mirrored pid_filter_table back to dvb-dibusb
11162306a36Sopenharmony_ci    first almost working version for HanfTek UMT-010
11262306a36Sopenharmony_ci    found out, that Yakumo/HAMA/Typhoon are predecessors of the HanfTek UMT-010
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci  2005-01-10
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci  - refactoring completed, now everything is very delightful
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci  - tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
11962306a36Sopenharmony_ci    Panasonic Tuner assembled). Tunerprobing implemented.
12062306a36Sopenharmony_ci    Thanks a lot to Gunnar Wittich.
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci  2004-12-29
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci  - after several days of struggling around bug of no returning URBs fixed.
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci  2004-12-26
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci  - refactored the dibusb-driver, split into separate files
12962306a36Sopenharmony_ci  - i2c-probing enabled
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci  2004-12-06
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci  - possibility for demod i2c-address probing
13462306a36Sopenharmony_ci  - new usb IDs (Compro, Artec)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci  2004-11-23
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci  - merged changes from DiB3000MC_ver2.1
13962306a36Sopenharmony_ci  - revised the debugging
14062306a36Sopenharmony_ci  - possibility to deliver the complete TS for USB2.0
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci  2004-11-21
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci  - first working version of the dib3000mc/p frontend driver.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci  2004-11-12
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci  - added additional remote control keys. Thanks to Uwe Hanke.
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci  2004-11-07
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci  - added remote control support. Thanks to David Matthews.
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci  2004-11-05
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci  - added support for a new devices (Grandtec/Avermedia/Artec)
15762306a36Sopenharmony_ci  - merged my changes (for dib3000mb/dibusb) to the FE_REFACTORING, because it became HEAD
15862306a36Sopenharmony_ci  - moved transfer control (pid filter, fifo control) from usb driver to frontend, it seems
15962306a36Sopenharmony_ci    better settled there (added xfer_ops-struct)
16062306a36Sopenharmony_ci  - created a common files for frontends (mc/p/mb)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci  2004-09-28
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci  - added support for a new device (Unknown, vendor ID is Hyper-Paltek)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci  2004-09-20
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci  - added support for a new device (Compro DVB-U2000), thanks
16962306a36Sopenharmony_ci    to Amaury Demol for reporting
17062306a36Sopenharmony_ci  - changed usb TS transfer method (several urbs, stopping transfer
17162306a36Sopenharmony_ci    before setting a new pid)
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci  2004-09-13
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci  - added support for a new device (Artec T1 USB TVBOX), thanks
17662306a36Sopenharmony_ci    to Christian Motschke for reporting
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci  2004-09-05
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci  - released the dibusb device and dib3000mb-frontend driver
18162306a36Sopenharmony_ci    (old news for vp7041.c)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci  2004-07-15
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci  - found out, by accident, that the device has a TUA6010XS for PLL
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci  2004-07-12
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci  - figured out, that the driver should also work with the
19062306a36Sopenharmony_ci    CTS Portable (Chinese Television System)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci  2004-07-08
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci  - firmware-extraction-2.422-problem solved, driver is now working
19562306a36Sopenharmony_ci    properly with firmware extracted from 2.422
19662306a36Sopenharmony_ci  - #if for 2.6.4 (dvb), compile issue
19762306a36Sopenharmony_ci  - changed firmware handling, see vp7041.txt sec 1.1
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci  2004-07-02
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci  - some tuner modifications, v0.1, cleanups, first public
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci  2004-06-28
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci  - now using the dvb_dmx_swfilter_packets, everything runs fine now
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci  2004-06-27
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci  - able to watch and switching channels (pre-alpha)
21062306a36Sopenharmony_ci  - no section filtering yet
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci  2004-06-06
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci  - first TS received, but kernel oops :/
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci  2004-05-14
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci  - firmware loader is working
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci  2004-05-11
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci  - start writing the driver
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciHow to use?
22562306a36Sopenharmony_ci-----------
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ciFirmware
22862306a36Sopenharmony_ci~~~~~~~~
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ciMost of the USB drivers need to download a firmware to the device before start
23162306a36Sopenharmony_ciworking.
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ciHave a look at the Wikipage for the DVB-USB-drivers to find out, which firmware
23462306a36Sopenharmony_ciyou need for your device:
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_cihttps://linuxtv.org/wiki/index.php/DVB_USB
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ciCompiling
23962306a36Sopenharmony_ci~~~~~~~~~
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ciSince the driver is in the linux kernel, activating the driver in
24262306a36Sopenharmony_ciyour favorite config-environment should sufficient. I recommend
24362306a36Sopenharmony_cito compile the driver as module. Hotplug does the rest.
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ciIf you use dvb-kernel enter the build-2.6 directory run 'make' and 'insmod.sh
24662306a36Sopenharmony_ciload' afterwards.
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ciLoading the drivers
24962306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ciHotplug is able to load the driver, when it is needed (because you plugged
25262306a36Sopenharmony_ciin the device).
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ciIf you want to enable debug output, you have to load the driver manually and
25562306a36Sopenharmony_cifrom within the dvb-kernel cvs repository.
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_cifirst have a look, which debug level are available:
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci.. code-block:: none
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	# modinfo dvb-usb
26262306a36Sopenharmony_ci	# modinfo dvb-usb-vp7045
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	etc.
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci.. code-block:: none
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	modprobe dvb-usb debug=<level>
26962306a36Sopenharmony_ci	modprobe dvb-usb-vp7045 debug=<level>
27062306a36Sopenharmony_ci	etc.
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_cishould do the trick.
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ciWhen the driver is loaded successfully, the firmware file was in
27562306a36Sopenharmony_cithe right place and the device is connected, the "Power"-LED should be
27662306a36Sopenharmony_citurned on.
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ciAt this point you should be able to start a dvb-capable application. I'm use
27962306a36Sopenharmony_ci(t|s)zap, mplayer and dvbscan to test the basics. VDR-xine provides the
28062306a36Sopenharmony_cilong-term test scenario.
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ciKnown problems and bugs
28362306a36Sopenharmony_ci-----------------------
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci- Don't remove the USB device while running an DVB application, your system
28662306a36Sopenharmony_ci  will go crazy or die most likely.
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ciAdding support for devices
28962306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ciTODO
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ciUSB1.1 Bandwidth limitation
29462306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ciA lot of the currently supported devices are USB1.1 and thus they have a
29762306a36Sopenharmony_cimaximum bandwidth of about 5-6 MBit/s when connected to a USB2.0 hub.
29862306a36Sopenharmony_ciThis is not enough for receiving the complete transport stream of a
29962306a36Sopenharmony_ciDVB-T channel (which is about 16 MBit/s). Normally this is not a
30062306a36Sopenharmony_ciproblem, if you only want to watch TV (this does not apply for HDTV),
30162306a36Sopenharmony_cibut watching a channel while recording another channel on the same
30262306a36Sopenharmony_cifrequency simply does not work very well. This applies to all USB1.1
30362306a36Sopenharmony_ciDVB-T devices, not just the dvb-usb-devices)
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ciThe bug, where the TS is distorted by a heavy usage of the device is gone
30662306a36Sopenharmony_cidefinitely. All dvb-usb-devices I was using (Twinhan, Kworld, DiBcom) are
30762306a36Sopenharmony_ciworking like charm now with VDR. Sometimes I even was able to record a channel
30862306a36Sopenharmony_ciand watch another one.
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ciComments
31162306a36Sopenharmony_ci~~~~~~~~
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ciPatches, comments and suggestions are very very welcome.
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci3. Acknowledgements
31662306a36Sopenharmony_ci-------------------
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci   Amaury Demol (Amaury.Demol@parrot.com) and Francois Kanounnikoff from DiBcom for
31962306a36Sopenharmony_ci   providing specs, code and help, on which the dvb-dibusb, dib3000mb and
32062306a36Sopenharmony_ci   dib3000mc are based.
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci   David Matthews for identifying a new device type (Artec T1 with AN2235)
32362306a36Sopenharmony_ci   and for extending dibusb with remote control event handling. Thank you.
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci   Alex Woods for frequently answering question about usb and dvb
32662306a36Sopenharmony_ci   stuff, a big thank you.
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci   Bernd Wagner for helping with huge bug reports and discussions.
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci   Gunnar Wittich and Joachim von Caron for their trust for providing
33162306a36Sopenharmony_ci   root-shells on their machines to implement support for new devices.
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci   Allan Third and Michael Hutchinson for their help to write the Nebula
33462306a36Sopenharmony_ci   digitv-driver.
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci   Glen Harris for bringing up, that there is a new dibusb-device and Jiun-Kuei
33762306a36Sopenharmony_ci   Jung from AVerMedia who kindly provided a special firmware to get the device
33862306a36Sopenharmony_ci   up and running in Linux.
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci   Jennifer Chen, Jeff and Jack from Twinhan for kindly supporting by
34162306a36Sopenharmony_ci   writing the vp7045-driver.
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci   Steve Chang from WideView for providing information for new devices and
34462306a36Sopenharmony_ci   firmware files.
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci   Michael Paxton for submitting remote control keymaps.
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci   Some guys on the linux-dvb mailing list for encouraging me.
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci   Peter Schildmann >peter.schildmann-nospam-at-web.de< for his
35162306a36Sopenharmony_ci   user-level firmware loader, which saves a lot of time
35262306a36Sopenharmony_ci   (when writing the vp7041 driver)
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_ci   Ulf Hermenau for helping me out with traditional chinese.
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ci   André Smoktun and Christian Frömmel for supporting me with
35762306a36Sopenharmony_ci   hardware and listening to my problems very patiently.
358