Device nodes and character devices

From LinuxTVWiki
Revision as of 07:15, 3 September 2009 by CityK (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When a driver module loads, the device manager udev will "automagically" create device nodes on /dev

For a DVB device

A properly loaded device module should result in a non-empty /dev/dvb directory. You can check on whether this is true with the following command:

ls -l /dev/dvb/

(alternatively, you can browse your directory structure with the graphical file manager of your choice). More specifically, the output of the above command should reveal that /dev/dvb/ is populated by "adapterN" (whereby, in terms of enumerating the devices installed in the system, N=0 to whatever*footnote*). For example, if you have but a single DVB device installed in your system, then expect to find /dev/dvb/adapter0.

DVB character devices

The Linux DVB API provides for six unix style character devices which allow control of the hardware components found on a particular DVB device adapter.It is under each adapterN directory that you will find these character devices. The command

ls -l /dev/dvb/adapter0

reveals the character devices associated with adapter0 for which the drivers have control. If you have more then one DVB device, you can see the same for all with

ls -l /dev/dvb/adapter*

Similar to the way in which the device adapters are enumerated, the character devices follow the form of M=0 to whatever. For example: /dev/dvb/adapter0/frontend0 .... if the same device had a second frontend, that character device would be enumerated by /dev/dvb/adapter0/frontend1 ... if you had another dvb adapter in the system, then you would see /dev/dvb/adapter1/frontend0 and so forth.

In brief, these are:

  • The frontend device which controls the tuner and demodulator. (different types of these hardware components for the different DTV standards)
  • The demux which controls the filters for processing the transport stream (TS).
    • the dvr which is a logical device that is associated with the demux character device ... it delivers up the TS for either:
(1) immediate playback --- in which case it has to be decoded either:
a) on the device itself [its rare for PC devices to have hardware decoding, but not so for STB] or
b) downstream by the system [the usual route for PC devices -- i.e. software decoding via the host CPU, and possibly assisted by the GPU) ]
or
(2) saving to disk for later playback.
  • the net character device which controls IP-over-DVB (i.e. satellite based internet service)
  • the video device controls the MPEG2 video decoder of the DVB hardware (if present ... so called, full-featured devices).....Note that the DVB video device only controls decoding of the MPEG video stream, not its presentation on the TV or computer screen. On PCs this is typically handled by an associated video4linux device, e.g. /dev/video, which allows scaling and defining output windows ... also note -- do NOT confuse this with the video node created by V4L devices (see below), as these are entirely different things
  • The audio device controls the MPEG2 audio decoder of the DVB hardware (if present ... so called, full-featured devices)
  • the ca device which controls conditional access hardware (like CI, CAM)

Not all of the character devices defined by the API need be present for a device, specifically because some functionality is not needed; in point:

  • Most DVB devices don’t have their own MPEG decoder because
    • modern CPUs and the ability to offload decoding to video card GPUs has pretty much long replaced the need of the so called "full feautred" class of DVB devices, or
    • may be foregone for datacasting type devices (e.g. for data-only uses like “internet over satellite”)
In any regard, this results in the omission of the audio and video character devices
  • not every device or STB provides conditional access hardware ... i.e. omit the ca device
  • the DVB API may also be used for MPEG decoder-only PCI cards, in which case, for these rare devices, there exists no need for the frontend character device
  • some

In fact, a typical DVB device these days will usually only contain three of these character devices (frontend, demux, net), as well as the special logical device (dvr).

For a V4L device

Similarly, with video capture (or, if you prefer, V4L) devices, a properly loaded device module should result in a non-empty /dev/video directory. You can check on whether this is true with the following command:

ls -l /dev/video

The /dev/video device node and the videoN character devices. Note that the node number (N) of the character device (/dev/videoN) will be different if you have multiple devices installed in the system,


  • Footnote: real life limitation of "whatever" --> max adapters definition in driver (usually set at 8 ... though this can be adjusted for more by altering the source code and recompiling)
  • For more info, have a look at the DVB and V4L APIs.
  • Wikipedia's device file article