# two ivtv cards conflicting over video0 and video1

## mobymac

I have an ASUStek tv tuner card and a Hauppage PVR-150 tv tuner card. Both use ivtv and I've got the module and firmware working. Problem is each time I reboot they switch device nodes, and now most of the time it seems the ASUS card doesn't get a spot at all. Info:

```
alai ~ # cat /etc/udev/rules.d/z99-capturecard.rules

KERNEL=="video?", ATTRS{subsystem_vendor}=="0x1043", SYMLINK+="asus"

KERNEL=="video?", ATTRS{subsystem_vendor}=="0x0070", SYMLINK+="pvr150"
```

The symlinking works fine, but the problem is that mythtv only uses the pvr150-- I go into mythtv-setup and try to set up the cards and get only pvr150. I pick /dev/asus/, /dev/pvr150/, /dev/video0/, /dev/video1/, doesn't matter-- they all say "Hauppage PVR-150" in the "probed info" section. Every once in a while I'll boot up and the probed info will say "ASUStek ..." where its supposed to, but I can't make it do this consistently.

Am I screwing something up in my udev rules? This seems like a deeper problem because sometimes the ASUS card is getting overwritten and instead that node gets linked to the pvr150...

Here are the pertinent parts of dmesg after a recent boot:

```
[    8.294892] Linux video capture interface: v2.00

[    8.327975] AV200 0000:04:04.0: PCI INT A -> GSI 28 (level, low) -> IRQ 28

[    8.328484] ivtv:  Start initialization, version 1.4.0

[    8.422933] phy0: Selected rate control algorithm 'pid'

[    8.426612] phy0: hwaddr 00:1f:33:88:31:d7, RTL8187vB (default) V1 + rtl8225z2

[    9.234070] ivtv0: Initializing card #0

[    9.234081] ivtv0: Unknown card: vendor/device: 4444/0016

[    9.234084] ivtv0:               subsystem vendor/device: 1043/062e

[    9.234087] ivtv0:               cx23416 based

[    9.234090] ivtv0: Defaulting to Hauppauge WinTV PVR-150 card

[    9.234093] ivtv0: Please mail the vendor/device and subsystem vendor/device IDs and what kind of

[    9.234096] ivtv0: card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)

[    9.234099] ivtv0: Prefix your subject line with [UNKNOWN IVTV CARD].

[    9.235710] ivtv 0000:05:03.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16

[    9.235725] ivtv0: Unreasonably low latency timer, setting to 64 (was 32)

[    9.237062] tveeprom 1-0050: Huh, no eeprom present (err=-6)?

[    9.237067] tveeprom 1-0050: Encountered bad packet header [0c]. Corrupt or not a Hauppauge eeprom.

[    9.237071] ivtv0: Invalid EEPROM

[    9.262292] cx25840 1-0044: cx25843-23 found @ 0x88 (ivtv i2c driver #0)

[    9.280174] tuner 1-0043: chip found @ 0x86 (ivtv i2c driver #0)

[    9.285509] tda9887 1-0043: creating new instance

[    9.285513] tda9887 1-0043: tda988[5/6/7] found

[    9.295451] All bytes are equal. It is not a TEA5767

[    9.295565] tuner 1-0060: chip found @ 0xc0 (ivtv i2c driver #0)

[    9.295622] wm8775 1-001b: chip found @ 0x36 (ivtv i2c driver #0)

[    9.298616] wm8775 1-001b: I2C: cannot write 000 to register R23

[    9.301598] wm8775 1-001b: I2C: cannot write 000 to register R7

[    9.304588] wm8775 1-001b: I2C: cannot write 021 to register R11

[    9.307572] wm8775 1-001b: I2C: cannot write 102 to register R12

[    9.310554] wm8775 1-001b: I2C: cannot write 000 to register R13

[    9.313533] wm8775 1-001b: I2C: cannot write 1d4 to register R14

[    9.316511] wm8775 1-001b: I2C: cannot write 1d4 to register R15

[    9.319489] wm8775 1-001b: I2C: cannot write 1bf to register R16

[    9.323583] wm8775 1-001b: I2C: cannot write 185 to register R17

[    9.326571] wm8775 1-001b: I2C: cannot write 0a2 to register R18

[    9.330593] wm8775 1-001b: I2C: cannot write 005 to register R19

[    9.333586] wm8775 1-001b: I2C: cannot write 07a to register R20

[    9.336571] wm8775 1-001b: I2C: cannot write 102 to register R21

[    9.336947] ivtv0: Registered device video0 for encoder MPG (4096 kB)

[    9.336974] ivtv0: Registered device video32 for encoder YUV (2048 kB)

[    9.337010] ivtv0: Registered device vbi0 for encoder VBI (1024 kB)

[    9.337037] ivtv0: Registered device video24 for encoder PCM (320 kB)

[    9.337066] ivtv0: Registered device radio0 for encoder radio

[    9.337070] ivtv0: Initialized card #0: Hauppauge WinTV PVR-150

[    9.337179] ivtv1: Initializing card #1

[    9.337184] ivtv1: Autodetected Hauppauge card (cx23416 based)

[    9.337814] ivtv 0000:05:04.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17

[    9.337828] ivtv1: Unreasonably low latency timer, setting to 64 (was 32)

[    9.391142] tveeprom 2-0050: Hauppauge model 26552, rev C268, serial# 8582499

[    9.391147] tveeprom 2-0050: tuner model is LG TAPE H001F MK3 (idx 68, type 47)

[    9.391152] tveeprom 2-0050: TV standards NTSC(M) (eeprom 0x08)

[    9.391155] tveeprom 2-0050: audio processor is CX25843 (idx 37)

[    9.391158] tveeprom 2-0050: decoder processor is CX25843 (idx 30)

[    9.391162] tveeprom 2-0050: has radio

[    9.391166] ivtv1: Autodetected Hauppauge WinTV PVR-150

[    9.400474] cx25840 2-0044: cx25843-23 found @ 0x88 (ivtv i2c driver #1)

[    9.404386] tuner 2-0043: chip found @ 0x86 (ivtv i2c driver #1)

[    9.405562] tda9887 2-0043: creating new instance

[    9.405567] tda9887 2-0043: tda988[5/6/7] found

[    9.406933] tuner 2-0061: chip found @ 0xc2 (ivtv i2c driver #1)

[    9.406963] wm8775 2-001b: chip found @ 0x36 (ivtv i2c driver #1)

[    9.431187] tuner-simple 2-0061: creating new instance

[    9.431192] tuner-simple 2-0061: type set to 47 (LG NTSC (TAPE series))

[    9.449227] firmware: requesting v4l-cx25840.fw

[   12.997170] cx25840 2-0044: loaded v4l-cx25840.fw firmware (16382 bytes)

[   13.073032] ivtv1: Registered device video1 for encoder MPG (4096 kB)

[   13.073136] ivtv1: Registered device video33 for encoder YUV (2048 kB)

[   13.073165] ivtv1: Registered device vbi1 for encoder VBI (1024 kB)

[   13.073193] ivtv1: Registered device video25 for encoder PCM (320 kB)

[   13.073221] ivtv1: Registered device radio1 for encoder radio

[   13.073226] ivtv1: Initialized card #1: Hauppauge WinTV PVR-150

[   13.073253] ivtv:  End initialization

[   56.305266] firmware: requesting v4l-cx2341x-enc.fw

[   56.588404] ivtv0: Loaded v4l-cx2341x-enc.fw firmware (376836 bytes)

[   56.805214] ivtv0: Encoder revision: 0x02060039

[   56.830702] firmware: requesting v4l-cx25840.fw

[   60.967981] cx25840 1-0044: loaded v4l-cx25840.fw firmware (16382 bytes)

[   61.055690] lirc_mceusb2[2]: set use inc

[   61.184514] wm8775 1-001b: I2C: cannot write 0c0 to register R21

[   61.187709] wm8775 1-001b: I2C: cannot write 1d4 to register R14

[   61.190763] wm8775 1-001b: I2C: cannot write 1d4 to register R15

[   61.204001] wm8775 1-001b: I2C: cannot write 102 to register R21

[   61.292978] tuner 1-0060: tuner type not set

[   61.296192] wm8775 1-001b: I2C: cannot write 0c0 to register R21

[   61.309253] wm8775 1-001b: I2C: cannot write 1d4 to register R14

[   61.312361] wm8775 1-001b: I2C: cannot write 1d4 to register R15

[   61.315421] wm8775 1-001b: I2C: cannot write 102 to register R21

[   61.390049] tuner 1-0060: tuner type not set

[   62.025026] firmware: requesting v4l-cx2341x-enc.fw

[   62.055180] ivtv1: Loaded v4l-cx2341x-enc.fw firmware (376836 bytes)

[   62.255152] ivtv1: Encoder revision: 0x02060039
```

This part is weird, but not correct since I've had this card working just fine and in the past:

```
[    9.234070] ivtv0: Initializing card #0

[    9.234081] ivtv0: Unknown card: vendor/device: 4444/0016

[    9.234084] ivtv0:               subsystem vendor/device: 1043/062e

[    9.234087] ivtv0:               cx23416 based

[    9.234090] ivtv0: Defaulting to Hauppauge WinTV PVR-150 card

[    9.234093] ivtv0: Please mail the vendor/device and subsystem vendor/device IDs and what kind of

[    9.234096] ivtv0: card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)

[    9.234099] ivtv0: Prefix your subject line with [UNKNOWN IVTV CARD].
```

Help?

[EDIT]: This seems to be reproducible always. So now I've gone and screwed something up and the ASUSTeK card doesn't work anymore. Can anyone help me get it back online? Here's the pertinent lspci info for the cards:

```
05:03.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

        Subsystem: ASUSTeK Computer Inc. Device 062e

        Flags: bus master, medium devsel, latency 64, IRQ 16

        Memory at dc000000 (32-bit, prefetchable) [size=64M]

        Capabilities: [44] Power Management version 2

        Kernel driver in use: ivtv

        Kernel modules: ivtv

05:04.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

        Subsystem: Hauppauge computer works Inc. WinTV PVR 150

        Flags: bus master, medium devsel, latency 64, IRQ 17

        Memory at d8000000 (32-bit, prefetchable) [size=64M]

        Capabilities: [44] Power Management version 2

        Kernel driver in use: ivtv

        Kernel modules: ivtv
```

```
alai ~ # uname -a

Linux alai 2.6.27-gentoo-r8 #13 SMP Sun Sep 20 14:21:12 CDT 2009 i686 Intel(R) Pentium(R) 4 CPU 2.53GHz GenuineIntel GNU/Linux
```

----------

## CrankyPenguin

So it might be the case that your rules are being preempted by some other value.  In lieu of numbering it as z99 consider putting the naming rules in 10 or checking the other udev rules files to see if there is something (esp 70 persistent) that is renaming the cards before you get to.  If you put your rules earlier this might be a fix.

----------

## mimosinnet

Addition: the issue had nothing to do with the configuration (the input devices were connected between each other and there was some interaction between them). Both devices worked with the enclosed configuration.

===

I have come across a similar issue and it does not seem to be related with udev symlinks. Both /dev/video0 and /dev/video1 show the output of /dev/video0, using this command:

```
mplayer tv:// driver=v4l2:device=/dev/video0
```

This is the information of cards, dmesg and udev:

```
lspci

05:07.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)

05:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)

05:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)

# dmesg | grep saa    

[    4.634842] saa7130/34: v4l2 driver version 0.2.15 loaded

[    4.685231] saa7134 0000:05:07.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21

[    4.685236] saa7130[0]: found at 0000:05:07.0, rev: 1, irq: 21, latency: 32, mmio: 0xfd9ff000

[    4.685242] saa7130[0]: subsystem: 1461:10ff, board: AVerMedia DVD EZMaker [card=33,autodetected]

[    4.685262] saa7130[0]: board init: gpio is 10000

[    4.685267] IRQ 21/saa7130[0]: IRQF_DISABLED is not guaranteed on shared IRQs

[    4.826136] saa7130[0]: i2c eeprom 00: 61 14 ff 10 ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826141] saa7130[0]: i2c eeprom 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826145] saa7130[0]: i2c eeprom 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826148] saa7130[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826152] saa7130[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826156] saa7130[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826159] saa7130[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826163] saa7130[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826166] saa7130[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826170] saa7130[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826173] saa7130[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826177] saa7130[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826181] saa7130[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826184] saa7130[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826188] saa7130[0]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826191] saa7130[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

[    4.826262] saa7130[0]: registered device video0 [v4l2]

[    4.826276] saa7130[0]: registered device vbi0

# dmesg | grep bttv

[    4.657635] bttv: driver version 0.9.18 loaded

[    4.657637] bttv: using 8 buffers with 2080k (520 pages) each for capture

[    4.826319] bttv: Bt8xx card found (0).

[    4.826340] bttv 0000:05:08.0: PCI INT A -> GSI 23 (level, low) -> IRQ 23

[    4.826349] bttv0: Bt878 (rev 17) at 0000:05:08.0, irq: 23, latency: 32, mmio: 0xfd8ff000

[    4.826369] bttv0: detected: AVerMedia TVCapture 98 [card=13], PCI subsystem ID is 1461:0004

[    4.826371] bttv0: using: AVerMedia TVCapture 98 [card=13,autodetected]

[    4.826372] IRQ 23/bttv0: IRQF_DISABLED is not guaranteed on shared IRQs

[    4.826409] bttv0: gpio: en=00000000, out=00000000 in=00a47ff3 [init]

[    4.828913] bttv0: Hauppauge/Voodoo msp34xx: reset line init [11]

[    4.866261] bttv0: Avermedia eeprom[0x4011]: tuner=5 radio:no remote control:yes

[    4.866263] bttv0: tuner type=5

[    5.239147] bttv0: audio absent, no audio device found!

[    5.263265] bttv0: registered device video1

[    5.263277] bttv0: registered device vbi1

[    5.263305] bttv0: PLL: 28636363 => 35468950 .. ok

[    5.290233] input: bttv IR (card=13) as /devices/pci0000:00/0000:00:14.4/0000:05:08.0/input/input4

lshal

udi = '/org/freedesktop/Hal/devices/pci_1131_7130_video4linux_0'

  info.capabilities = {'video4linux', 'video4linux.video_capture', 'video4linux.video_overlay'} (string list)

  info.category = 'video4linux'  (string)

  info.parent = '/org/freedesktop/Hal/devices/pci_1131_7130'  (string)

  info.product = 'AVerMedia DVD EZMaker'  (string)

  info.subsystem = 'video4linux'  (string)

  info.udi = '/org/freedesktop/Hal/devices/pci_1131_7130_video4linux_0'  (string)

  linux.device_file = '/dev/video0'  (string)

  linux.hotplug_type = 2  (0x2)  (int)

  linux.subsystem = 'video4linux'  (string)

  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:14.4/0000:05:07.0/video4linux/video0'  (string)

  video4linux.device = '/dev/video0'  (string)

  video4linux.version = '2'  (string)

udi = '/org/freedesktop/Hal/devices/pci_1131_7130_video4linux'

  info.capabilities = {'video4linux', 'video4linux.video_capture', 'video4linux.video_overlay'} (string list)

  info.category = 'video4linux'  (string)

  info.parent = '/org/freedesktop/Hal/devices/pci_1131_7130'  (string)

  info.product = 'AVerMedia DVD EZMaker'  (string)

  info.subsystem = 'video4linux'  (string)

  info.udi = '/org/freedesktop/Hal/devices/pci_1131_7130_video4linux'  (string)

  linux.device_file = '/dev/vbi0'  (string)

  linux.hotplug_type = 2  (0x2)  (int)

  linux.subsystem = 'video4linux'  (string)

  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:14.4/0000:05:07.0/video4linux/vbi0'  (string)

  video4linux.device = '/dev/vbi0'  (string)

  video4linux.version = '2'  (string)

----

udi = '/org/freedesktop/Hal/devices/pci_109e_36e_video4linux_0'

  info.capabilities = {'video4linux', 'video4linux.video_capture', 'video4linux.video_overlay', 'video4linux.tuner'} (string list)

  info.category = 'video4linux'  (string)

  info.parent = '/org/freedesktop/Hal/devices/pci_109e_36e'  (string)

  info.product = 'BT878 video (AVerMedia TVCaptur'  (string)

  info.subsystem = 'video4linux'  (string)

  info.udi = '/org/freedesktop/Hal/devices/pci_109e_36e_video4linux_0'  (string)

  linux.device_file = '/dev/video1'  (string)

  linux.hotplug_type = 2  (0x2)  (int)

  linux.subsystem = 'video4linux'  (string)

  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:14.4/0000:05:08.0/video4linux/video1'  (string)

  video4linux.device = '/dev/video1'  (string)

  video4linux.version = '2'  (string)

udi = '/org/freedesktop/Hal/devices/pci_109e_36e_video4linux'

  info.capabilities = {'video4linux', 'video4linux.video_capture', 'video4linux.video_overlay', 'video4linux.tuner'} (string list)

  info.category = 'video4linux'  (string)

  info.parent = '/org/freedesktop/Hal/devices/pci_109e_36e'  (string)

  info.product = 'BT878 video (AVerMedia TVCaptur'  (string)

  info.subsystem = 'video4linux'  (string)

  info.udi = '/org/freedesktop/Hal/devices/pci_109e_36e_video4linux'  (string)

  linux.device_file = '/dev/vbi1'  (string)

  linux.hotplug_type = 2  (0x2)  (int)

  linux.subsystem = 'video4linux'  (string)

  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:14.4/0000:05:08.0/video4linux/vbi1'  (string)

  video4linux.device = '/dev/vbi1'  (string)

  video4linux.version = '2'  (string)
```

Any hints appreciated.

Thanks!

----------

