xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/media/drivers/dvb-usb.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunIdea behind the dvb-usb-framework
4*4882a593Smuzhiyun=================================
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun.. note::
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun   #) This documentation is outdated. Please check at the DVB wiki
9*4882a593Smuzhiyun      at https://linuxtv.org/wiki for more updated info.
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun   #) **deprecated:** Newer DVB USB drivers should use the dvb-usb-v2 framework.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunIn March 2005 I got the new Twinhan USB2.0 DVB-T device. They provided specs
14*4882a593Smuzhiyunand a firmware.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunQuite keen I wanted to put the driver (with some quirks of course) into dibusb.
17*4882a593SmuzhiyunAfter reading some specs and doing some USB snooping, it realized, that the
18*4882a593Smuzhiyundibusb-driver would be a complete mess afterwards. So I decided to do it in a
19*4882a593Smuzhiyundifferent way: With the help of a dvb-usb-framework.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunThe framework provides generic functions (mostly kernel API calls), such as:
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun- Transport Stream URB handling in conjunction with dvb-demux-feed-control
24*4882a593Smuzhiyun  (bulk and isoc are supported)
25*4882a593Smuzhiyun- registering the device for the DVB-API
26*4882a593Smuzhiyun- registering an I2C-adapter if applicable
27*4882a593Smuzhiyun- remote-control/input-device handling
28*4882a593Smuzhiyun- firmware requesting and loading (currently just for the Cypress USB
29*4882a593Smuzhiyun  controllers)
30*4882a593Smuzhiyun- other functions/methods which can be shared by several drivers (such as
31*4882a593Smuzhiyun  functions for bulk-control-commands)
32*4882a593Smuzhiyun- TODO: a I2C-chunker. It creates device-specific chunks of register-accesses
33*4882a593Smuzhiyun  depending on length of a register and the number of values that can be
34*4882a593Smuzhiyun  multi-written and multi-read.
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunThe source code of the particular DVB USB devices does just the communication
37*4882a593Smuzhiyunwith the device via the bus. The connection between the DVB-API-functionality
38*4882a593Smuzhiyunis done via callbacks, assigned in a static device-description (struct
39*4882a593Smuzhiyundvb_usb_device) each device-driver has to have.
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunFor an example have a look in drivers/media/usb/dvb-usb/vp7045*.
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunObjective is to migrate all the usb-devices (dibusb, cinergyT2, maybe the
44*4882a593Smuzhiyunttusb; flexcop-usb already benefits from the generic flexcop-device) to use
45*4882a593Smuzhiyunthe dvb-usb-lib.
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunTODO: dynamic enabling and disabling of the pid-filter in regard to number of
48*4882a593Smuzhiyunfeeds requested.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunSupported devices
51*4882a593Smuzhiyun-----------------
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunSee the LinuxTV DVB Wiki at https://linuxtv.org for a complete list of
54*4882a593Smuzhiyuncards/drivers/firmwares:
55*4882a593Smuzhiyunhttps://linuxtv.org/wiki/index.php/DVB_USB
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun0. History & News:
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun  2005-06-30
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun  - added support for WideView WT-220U (Thanks to Steve Chang)
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun  2005-05-30
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun  - added basic isochronous support to the dvb-usb-framework
66*4882a593Smuzhiyun  - added support for Conexant Hybrid reference design and Nebula
67*4882a593Smuzhiyun	       DigiTV USB
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun  2005-04-17
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun  - all dibusb devices ported to make use of the dvb-usb-framework
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun  2005-04-02
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun  - re-enabled and improved remote control code.
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun  2005-03-31
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun  - ported the Yakumo/Hama/Typhoon DVB-T USB2.0 device to dvb-usb.
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun  2005-03-30
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun  - first commit of the dvb-usb-module based on the dibusb-source.
84*4882a593Smuzhiyun    First device is a new driver for the
85*4882a593Smuzhiyun    TwinhanDTV Alpha / MagicBox II USB2.0-only DVB-T device.
86*4882a593Smuzhiyun  - (change from dvb-dibusb to dvb-usb)
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun  2005-03-28
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun  - added support for the AVerMedia AverTV DVB-T USB2.0 device
91*4882a593Smuzhiyun    (Thanks to Glen Harris and Jiun-Kuei Jung, AVerMedia)
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun  2005-03-14
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun  - added support for the Typhoon/Yakumo/HAMA DVB-T mobile USB2.0
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun  2005-02-11
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun  - added support for the KWorld/ADSTech Instant DVB-T USB2.0.
100*4882a593Smuzhiyun    Thanks a lot to Joachim von Caron
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun  2005-02-02
103*4882a593Smuzhiyun  - added support for the Hauppauge Win-TV Nova-T USB2
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun  2005-01-31
106*4882a593Smuzhiyun  - distorted streaming is gone for USB1.1 devices
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun  2005-01-13
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun  - moved the mirrored pid_filter_table back to dvb-dibusb
111*4882a593Smuzhiyun    first almost working version for HanfTek UMT-010
112*4882a593Smuzhiyun    found out, that Yakumo/HAMA/Typhoon are predecessors of the HanfTek UMT-010
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun  2005-01-10
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun  - refactoring completed, now everything is very delightful
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun  - tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
119*4882a593Smuzhiyun    Panasonic Tuner assembled). Tunerprobing implemented.
120*4882a593Smuzhiyun    Thanks a lot to Gunnar Wittich.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun  2004-12-29
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun  - after several days of struggling around bug of no returning URBs fixed.
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun  2004-12-26
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun  - refactored the dibusb-driver, split into separate files
129*4882a593Smuzhiyun  - i2c-probing enabled
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun  2004-12-06
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun  - possibility for demod i2c-address probing
134*4882a593Smuzhiyun  - new usb IDs (Compro, Artec)
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun  2004-11-23
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun  - merged changes from DiB3000MC_ver2.1
139*4882a593Smuzhiyun  - revised the debugging
140*4882a593Smuzhiyun  - possibility to deliver the complete TS for USB2.0
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun  2004-11-21
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun  - first working version of the dib3000mc/p frontend driver.
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun  2004-11-12
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun  - added additional remote control keys. Thanks to Uwe Hanke.
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun  2004-11-07
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun  - added remote control support. Thanks to David Matthews.
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun  2004-11-05
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun  - added support for a new devices (Grandtec/Avermedia/Artec)
157*4882a593Smuzhiyun  - merged my changes (for dib3000mb/dibusb) to the FE_REFACTORING, because it became HEAD
158*4882a593Smuzhiyun  - moved transfer control (pid filter, fifo control) from usb driver to frontend, it seems
159*4882a593Smuzhiyun    better settled there (added xfer_ops-struct)
160*4882a593Smuzhiyun  - created a common files for frontends (mc/p/mb)
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun  2004-09-28
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun  - added support for a new device (Unknown, vendor ID is Hyper-Paltek)
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun  2004-09-20
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun  - added support for a new device (Compro DVB-U2000), thanks
169*4882a593Smuzhiyun    to Amaury Demol for reporting
170*4882a593Smuzhiyun  - changed usb TS transfer method (several urbs, stopping transfer
171*4882a593Smuzhiyun    before setting a new pid)
172*4882a593Smuzhiyun
173*4882a593Smuzhiyun  2004-09-13
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun  - added support for a new device (Artec T1 USB TVBOX), thanks
176*4882a593Smuzhiyun    to Christian Motschke for reporting
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun  2004-09-05
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun  - released the dibusb device and dib3000mb-frontend driver
181*4882a593Smuzhiyun    (old news for vp7041.c)
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun  2004-07-15
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun  - found out, by accident, that the device has a TUA6010XS for PLL
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun  2004-07-12
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun  - figured out, that the driver should also work with the
190*4882a593Smuzhiyun    CTS Portable (Chinese Television System)
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun  2004-07-08
193*4882a593Smuzhiyun
194*4882a593Smuzhiyun  - firmware-extraction-2.422-problem solved, driver is now working
195*4882a593Smuzhiyun    properly with firmware extracted from 2.422
196*4882a593Smuzhiyun  - #if for 2.6.4 (dvb), compile issue
197*4882a593Smuzhiyun  - changed firmware handling, see vp7041.txt sec 1.1
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun  2004-07-02
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun  - some tuner modifications, v0.1, cleanups, first public
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun  2004-06-28
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun  - now using the dvb_dmx_swfilter_packets, everything runs fine now
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun  2004-06-27
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun  - able to watch and switching channels (pre-alpha)
210*4882a593Smuzhiyun  - no section filtering yet
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun  2004-06-06
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun  - first TS received, but kernel oops :/
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun  2004-05-14
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun  - firmware loader is working
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun  2004-05-11
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun  - start writing the driver
223*4882a593Smuzhiyun
224*4882a593SmuzhiyunHow to use?
225*4882a593Smuzhiyun-----------
226*4882a593Smuzhiyun
227*4882a593SmuzhiyunFirmware
228*4882a593Smuzhiyun~~~~~~~~
229*4882a593Smuzhiyun
230*4882a593SmuzhiyunMost of the USB drivers need to download a firmware to the device before start
231*4882a593Smuzhiyunworking.
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunHave a look at the Wikipage for the DVB-USB-drivers to find out, which firmware
234*4882a593Smuzhiyunyou need for your device:
235*4882a593Smuzhiyun
236*4882a593Smuzhiyunhttps://linuxtv.org/wiki/index.php/DVB_USB
237*4882a593Smuzhiyun
238*4882a593SmuzhiyunCompiling
239*4882a593Smuzhiyun~~~~~~~~~
240*4882a593Smuzhiyun
241*4882a593SmuzhiyunSince the driver is in the linux kernel, activating the driver in
242*4882a593Smuzhiyunyour favorite config-environment should sufficient. I recommend
243*4882a593Smuzhiyunto compile the driver as module. Hotplug does the rest.
244*4882a593Smuzhiyun
245*4882a593SmuzhiyunIf you use dvb-kernel enter the build-2.6 directory run 'make' and 'insmod.sh
246*4882a593Smuzhiyunload' afterwards.
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunLoading the drivers
249*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~
250*4882a593Smuzhiyun
251*4882a593SmuzhiyunHotplug is able to load the driver, when it is needed (because you plugged
252*4882a593Smuzhiyunin the device).
253*4882a593Smuzhiyun
254*4882a593SmuzhiyunIf you want to enable debug output, you have to load the driver manually and
255*4882a593Smuzhiyunfrom within the dvb-kernel cvs repository.
256*4882a593Smuzhiyun
257*4882a593Smuzhiyunfirst have a look, which debug level are available:
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun.. code-block:: none
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun	# modinfo dvb-usb
262*4882a593Smuzhiyun	# modinfo dvb-usb-vp7045
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun	etc.
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun.. code-block:: none
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun	modprobe dvb-usb debug=<level>
269*4882a593Smuzhiyun	modprobe dvb-usb-vp7045 debug=<level>
270*4882a593Smuzhiyun	etc.
271*4882a593Smuzhiyun
272*4882a593Smuzhiyunshould do the trick.
273*4882a593Smuzhiyun
274*4882a593SmuzhiyunWhen the driver is loaded successfully, the firmware file was in
275*4882a593Smuzhiyunthe right place and the device is connected, the "Power"-LED should be
276*4882a593Smuzhiyunturned on.
277*4882a593Smuzhiyun
278*4882a593SmuzhiyunAt this point you should be able to start a dvb-capable application. I'm use
279*4882a593Smuzhiyun(t|s)zap, mplayer and dvbscan to test the basics. VDR-xine provides the
280*4882a593Smuzhiyunlong-term test scenario.
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunKnown problems and bugs
283*4882a593Smuzhiyun-----------------------
284*4882a593Smuzhiyun
285*4882a593Smuzhiyun- Don't remove the USB device while running an DVB application, your system
286*4882a593Smuzhiyun  will go crazy or die most likely.
287*4882a593Smuzhiyun
288*4882a593SmuzhiyunAdding support for devices
289*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~
290*4882a593Smuzhiyun
291*4882a593SmuzhiyunTODO
292*4882a593Smuzhiyun
293*4882a593SmuzhiyunUSB1.1 Bandwidth limitation
294*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~
295*4882a593Smuzhiyun
296*4882a593SmuzhiyunA lot of the currently supported devices are USB1.1 and thus they have a
297*4882a593Smuzhiyunmaximum bandwidth of about 5-6 MBit/s when connected to a USB2.0 hub.
298*4882a593SmuzhiyunThis is not enough for receiving the complete transport stream of a
299*4882a593SmuzhiyunDVB-T channel (which is about 16 MBit/s). Normally this is not a
300*4882a593Smuzhiyunproblem, if you only want to watch TV (this does not apply for HDTV),
301*4882a593Smuzhiyunbut watching a channel while recording another channel on the same
302*4882a593Smuzhiyunfrequency simply does not work very well. This applies to all USB1.1
303*4882a593SmuzhiyunDVB-T devices, not just the dvb-usb-devices)
304*4882a593Smuzhiyun
305*4882a593SmuzhiyunThe bug, where the TS is distorted by a heavy usage of the device is gone
306*4882a593Smuzhiyundefinitely. All dvb-usb-devices I was using (Twinhan, Kworld, DiBcom) are
307*4882a593Smuzhiyunworking like charm now with VDR. Sometimes I even was able to record a channel
308*4882a593Smuzhiyunand watch another one.
309*4882a593Smuzhiyun
310*4882a593SmuzhiyunComments
311*4882a593Smuzhiyun~~~~~~~~
312*4882a593Smuzhiyun
313*4882a593SmuzhiyunPatches, comments and suggestions are very very welcome.
314*4882a593Smuzhiyun
315*4882a593Smuzhiyun3. Acknowledgements
316*4882a593Smuzhiyun-------------------
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun   Amaury Demol (Amaury.Demol@parrot.com) and Francois Kanounnikoff from DiBcom for
319*4882a593Smuzhiyun   providing specs, code and help, on which the dvb-dibusb, dib3000mb and
320*4882a593Smuzhiyun   dib3000mc are based.
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun   David Matthews for identifying a new device type (Artec T1 with AN2235)
323*4882a593Smuzhiyun   and for extending dibusb with remote control event handling. Thank you.
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun   Alex Woods for frequently answering question about usb and dvb
326*4882a593Smuzhiyun   stuff, a big thank you.
327*4882a593Smuzhiyun
328*4882a593Smuzhiyun   Bernd Wagner for helping with huge bug reports and discussions.
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun   Gunnar Wittich and Joachim von Caron for their trust for providing
331*4882a593Smuzhiyun   root-shells on their machines to implement support for new devices.
332*4882a593Smuzhiyun
333*4882a593Smuzhiyun   Allan Third and Michael Hutchinson for their help to write the Nebula
334*4882a593Smuzhiyun   digitv-driver.
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun   Glen Harris for bringing up, that there is a new dibusb-device and Jiun-Kuei
337*4882a593Smuzhiyun   Jung from AVerMedia who kindly provided a special firmware to get the device
338*4882a593Smuzhiyun   up and running in Linux.
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun   Jennifer Chen, Jeff and Jack from Twinhan for kindly supporting by
341*4882a593Smuzhiyun   writing the vp7045-driver.
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun   Steve Chang from WideView for providing information for new devices and
344*4882a593Smuzhiyun   firmware files.
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun   Michael Paxton for submitting remote control keymaps.
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun   Some guys on the linux-dvb mailing list for encouraging me.
349*4882a593Smuzhiyun
350*4882a593Smuzhiyun   Peter Schildmann >peter.schildmann-nospam-at-web.de< for his
351*4882a593Smuzhiyun   user-level firmware loader, which saves a lot of time
352*4882a593Smuzhiyun   (when writing the vp7041 driver)
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun   Ulf Hermenau for helping me out with traditional chinese.
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun   André Smoktun and Christian Frömmel for supporting me with
357*4882a593Smuzhiyun   hardware and listening to my problems very patiently.
358