On Wed, 2009-12-30 at 01:37 -0500, Trevor Boicey wrote:
> One line version: 
> - PVR-500 drivers work for both encoders in two cards using linux
> 2.6.13/ivtv-0.4.1, in linux 2.6.32 only first encoder produces MPEG
> data, the other three produce... something else. 

One line answer:

Check your udev rules.  Things changed a recently with all of the v4l
drivers (including ivtv) - minor numbers will no longer have a 1-to-1
correspondence to device node names or video stream types.


> Short version: 
> - Attempted to upgrade an older mythbox (kernel 2.6.13/ivtv
> 0.4.1/working for years) to current codebase, along with some hardware
> upgrades. Collapsing two mythboxen into one, so I have extra
> hardware. 
> - I have three PVR-500s, Revs D492, E587, E787. All working a week
> ago. 
> - Problem occurs with as little as one PVR-500 in PC, I have tried
> each of the three individually with same results. 
> - In new PC, using 2.6.32, video0 works perfectly. video1 seems to set
> up alright, and dmesg looks normal, no errors. 
> - When I do "cat /dev/v4l/video0 > foo.mpg" it produces a usable mpg 
> - When I do "cat /dev/v4l/video1 > foo.mpg" it produces many more
> bytes, and not an mpg. 
> - Same effect if I add another PVR-500, video2 and video3 also fail. 
> - However, if I reboot with kernel 2.6.13, and build ivtv-0.4.1, and
> install those modules, everything works fine. 
> - No module options, both kernels use the same /dev structure and same
> device nodes, and install the same firmware file. 
> - Seemingly identical conditions except kernel version and driver
> version. 

The ivtv driver, cx18 driver, and V4L2 specification (IIRC)
traditionally assume a naming convention like this:

/dev/radio0 <= FM radio control node for first CX2341x
/dev/radio1 <= FM radio control node for second CX2341x
...
/dev/vbi0 <= VBI data from first CX2341x
/dev/vbi1 <= VBI data from second CX2341x
...
/dev/video0 <= MPEG from first CX2341x
/dev/video1 <= MPEG from second CX2341x
...
/dev/video24 <= PCM audio from first CX2341x
/dev/video25 <= PCM audio from second CX2341x
...
/dev/video32 <= YUV (HM12) video from first CX2341x
/dev/video33 <= YUV (HM12) video from second CX2341x

and previously the device node minor number corresponded the number
after the "/dev/video", but that is no longer the case.

Here's a listing from my 2.6.27 machine with the v1.4.1 ivtv driver and
v1.3.0 cx18 driver loaded:

$ ls -al /dev/video*
lrwxrwxrwx  1 root root       6 2009-12-30 13:24 /dev/video -> video0
crw-rw----+ 1 andy mythtv 81, 0 2009-12-30 13:24 /dev/video0
crw-rw----+ 1 andy mythtv 81, 5 2009-12-30 13:25 /dev/video1
crw-rw----+ 1 andy mythtv 81, 3 2009-12-30 13:24 /dev/video24
crw-rw----+ 1 andy mythtv 81, 8 2009-12-30 13:25 /dev/video25
crw-rw----+ 1 andy mythtv 81, 1 2009-12-30 13:24 /dev/video32
crw-rw----+ 1 andy mythtv 81, 6 2009-12-30 13:25 /dev/video33

Note how the minor numbers really have no relationship to the number
after "/dev/video" any more.



> Long data: 
> 
> Here is the logs for 2.6.32, two cards installed. Only the first
> encoder of four works. (video0) 
> 
> messages:Dec 27 15:09:17 trevo kernel: ivtv: Start initialization, version 
> 1.4.1 
> messages:Dec 27 15:09:17 trevo kernel: ivtv0: Initializing card 0 
> messages:Dec 27 15:09:17 trevo kernel: ivtv0: Autodetected Hauppauge card 
> (cx23416 based) 
> messages:Dec 27 15:09:17 trevo kernel: ivtv0: Unreasonably low latency timer, 
> setting to 64 (was 32) 
> messages:Dec 27 15:09:17 trevo kernel: ivtv0: Autodetected WinTV PVR 500 
> (unit #1) 
> messages:Dec 27 15:09:17 trevo kernel: cx25840 0-0044: cx25843-24 found @ 
> 0x88 (ivtv i2c driver #0) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 0-0060: chip found @ 0xc0 (ivtv 
> i2c driver #0) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 0-0061: chip found @ 0xc2 (ivtv 
> i2c driver #0) 
> messages:Dec 27 15:09:18 trevo kernel: wm8775 0-001b: chip found @ 0x36 (ivtv 
> i2c driver #0) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Registered device video0 for 
> encoder MPG (4096 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Registered device video32 for 
> encoder YUV (2048 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Registered device vbi0 for 
> encoder VBI (1024 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Registered device video24 for 
> encoder PCM (320 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Registered device radio0 for 
> encoder radio 
> messages:Dec 27 15:09:18 trevo kernel: ivtv0: Initialized card: WinTV PVR 500 
> (unit #1) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Initializing card 1 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Autodetected Hauppauge card 
> (cx23416 based) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Unreasonably low latency timer, 
> setting to 64 (was 32) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Correcting tveeprom data: no 
> radio present on second unit 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Autodetected WinTV PVR 500 
> (unit #2) 
> messages:Dec 27 15:09:18 trevo kernel: cx25840 1-0044: cx25843-24 found @ 
> 0x88 (ivtv i2c driver #1) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 1-0061: chip found @ 0xc2 (ivtv 
> i2c driver #1) 
> messages:Dec 27 15:09:18 trevo kernel: wm8775 1-001b: chip found @ 0x36 (ivtv 
> i2c driver #1) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Registered device video1 for 
> encoder MPG (4096 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Registered device video33 for 
> encoder YUV (2048 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Registered device vbi1 for 
> encoder VBI (1024 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Registered device video25 for 
> encoder PCM (320 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv1: Initialized card: WinTV PVR 500 
> (unit #2) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Initializing card 2 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Autodetected Hauppauge card 
> (cx23416 based) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Unreasonably low latency timer, 
> setting to 64 (was 32) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Autodetected WinTV PVR 500 
> (unit #1) 
> messages:Dec 27 15:09:18 trevo kernel: cx25840 2-0044: cx25843-24 found @ 
> 0x88 (ivtv i2c driver #2) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 2-0060: chip found @ 0xc0 (ivtv 
> i2c driver #2) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 2-0061: chip found @ 0xc2 (ivtv 
> i2c driver #2) 
> messages:Dec 27 15:09:18 trevo kernel: wm8775 2-001b: chip found @ 0x36 (ivtv 
> i2c driver #2) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Registered device video2 for 
> encoder MPG (4096 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Registered device video34 for 
> encoder YUV (2048 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Registered device vbi2 for 
> encoder VBI (1024 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Registered device video26 for 
> encoder PCM (320 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Registered device radio2 for 
> encoder radio 
> messages:Dec 27 15:09:18 trevo kernel: ivtv2: Initialized card: WinTV PVR 500 
> (unit #1) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Initializing card 3 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Autodetected Hauppauge card 
> (cx23416 based) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Unreasonably low latency timer, 
> setting to 64 (was 32) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Correcting tveeprom data: no 
> radio present on second unit 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Autodetected WinTV PVR 500 
> (unit #2) 
> messages:Dec 27 15:09:18 trevo kernel: cx25840 3-0044: cx25843-24 found @ 
> 0x88 (ivtv i2c driver #3) 
> messages:Dec 27 15:09:18 trevo kernel: tuner 3-0061: chip found @ 0xc2 (ivtv 
> i2c driver #3) 
> messages:Dec 27 15:09:18 trevo kernel: wm8775 3-001b: chip found @ 0x36 (ivtv 
> i2c driver #3) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Registered device video3 for 
> encoder MPG (4096 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Registered device video35 for 
> encoder YUV (2048 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Registered device vbi3 for 
> encoder VBI (1024 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Registered device video27 for 
> encoder PCM (320 kB) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv3: Initialized card: WinTV PVR 500 
> (unit #2) 
> messages:Dec 27 15:09:18 trevo kernel: ivtv: End initialization 
> messages:Dec 27 15:10:31 trevo kernel: ivtv 0000:03:08.0: firmware: 
> requesting v4l-cx2341x-enc.fw 
> messages:Dec 27 15:10:31 trevo kernel: ivtv0: Loaded v4l-cx2341x-enc.fw 
> firmware (376836 bytes) 
> messages:Dec 27 15:10:31 trevo kernel: ivtv0: Encoder revision: 0x02050032 
> 
> Here is dmesg for 2.6.13 one card installed (running happily, both
> encoders) 
> 
> ivtv:  ==================== START INIT IVTV ==================== 
> ivtv:  version 0.4.1 (tagged release) loading 
[snip]
> ivtv:  ====================  END INIT IVTV  ==================== 
> 
> 
> More debugging information: 
> 
> Is this right? lspci shows the cards at 03:09 and 03:09, but v4l2-ctl
> shows them both as unit #1 and at 03:08: 
> 
> 03:08.0 Multimedia video controller: Internext Compression Inc iTVC16
> (CX23416) MPEG-2 Encoder (rev 01) 
> 03:09.0 Multimedia video controller: Internext Compression Inc iTVC16
> (CX23416) MPEG-2 Encoder (rev 01) 
> 
> crw-rw----  1 video 81, 0 2009-12-27 20:13 /dev/v4l/video0 
> crw-rw----  1 video 81, 1 2009-12-27 20:13 /dev/v4l/video1 
> crw-rw----  1 video 81, 2 2009-12-27 20:13 /dev/v4l/video2 
> crw-rw----  1 video 81, 3 2009-12-27 20:13 /dev/v4l/video3 
> 
> r...@trevo:/tmp# v4l2-ctl -d /dev/v4l/video1 -D 
> Driver Info: 
> Driver name : ivtv 
> Card type : WinTV PVR 500 (unit #1) 
> Bus info : PCI:0000:03:08.0 
> 
> r...@trevo:/tmp# v4l2-ctl -d /dev/v4l/video0 -D 
> Driver Info: 
> Driver name : ivtv 
> Card type : WinTV PVR 500 (unit #1) 
> Bus info : PCI:0000:03:08.0 


Yes, it is right.  You're looking at the MPEG device node
(/dev/v4l/video0) and the YUV (HM12) device node (/dev/v4l/video1) of
the same CX23416.  /dev/v4l/video1 is not the MPEG device node of the
next CX23416.

You have udev rules that assume the minor number maps to the type of
video stream or video node.  That's not the case anymore.  


> Also notable, the pixel format for each tuner is listed differently,
> the working one is MPEG, the non-working one is HM12. Setting the
> pixelformat with v4l2-ctl doesn't seem to affect it, no error but it
> stays as HM12. I can change the resolution successfully though. 
> 
> r...@trevo:/tmp# v4l2-ctl -d /dev/v4l/video0 -V 
> Format Video Capture: 
> Width/Height : 720/480 
> Pixel Format : 'MPEG' 
> Field : Interlaced 
> Bytes per Line: 0 
> Size Image : 131072 
> Colorspace : Broadcast NTSC/PAL (SMPTE170M/ITU601) 
> 
> r...@trevo:/tmp# v4l2-ctl -d /dev/v4l/video1 -V 
> Format Video Capture: 
> Width/Height : 720/480 
> Pixel Format : 'HM12' 
> Field : Interlaced 
> Bytes per Line: 720 
> Size Image : 518400 
> Colorspace : Broadcast NTSC/PAL (SMPTE170M/ITU601) 
> 


> I hope something in there is useful. 

Sure.  Now here's something you may find useful.

In a window, as root, unload the ivtv module.  Then in another window,
as root, run

# man udevadm
# udevadm monitor --environment --kernel --udev

In the first window, now modprobe the ivtv module.  You will see all the
events and environment data that come through that udev operates upon.
It looks something like this:


udevmonitor will print the received events for:
UDEV the event which udev sends out after rule processing
UEVENT the kernel uevent

UEVENT[1262200513.371779] add      /module/ivtv (module)
ACTION=add
DEVPATH=/module/ivtv
SUBSYSTEM=module
SEQNUM=1275

UDEV  [1262200513.376397] add      /module/ivtv (module)
UDEV_LOG=3
ACTION=add
DEVPATH=/module/ivtv
SUBSYSTEM=module
SEQNUM=1275
UDEVD_EVENT=1

[...]

UEVENT[1262200513.589200] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video1 (video4linux)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=5
SEQNUM=1281

UEVENT[1262200513.592127] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video33 (video4linux)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video33
SUBSYSTEM=video4linux
MAJOR=81
MINOR=6
SEQNUM=1282

UEVENT[1262200513.596333] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/vbi1 (video4linux)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/vbi1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=7
SEQNUM=1283

UEVENT[1262200513.605989] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video25 (video4linux)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video25
SUBSYSTEM=video4linux
MAJOR=81
MINOR=8
SEQNUM=1284

UEVENT[1262200513.610136] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/radio1 (video4linux)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/radio1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=9
SEQNUM=1285

[...]

UDEV  [1262200513.707610] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/vbi1 (video4linux)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/vbi1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=7
SEQNUM=1283
UDEVD_EVENT=1
ID_PATH=pci-0000:02:01.0
DEVNAME=/dev/vbi1
DEVLINKS=/dev/v4l/by-path/pci-0000:02:01.0-video-index2

UDEV  [1262200513.709209] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/radio1 (video4linux)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/radio1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=9
SEQNUM=1285
UDEVD_EVENT=1
ID_PATH=pci-0000:02:01.0
DEVNAME=/dev/radio1

UDEV  [1262200513.718639] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video33 (video4linux)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video33
SUBSYSTEM=video4linux
MAJOR=81
MINOR=6
SEQNUM=1282
UDEVD_EVENT=1
ID_PATH=pci-0000:02:01.0
DEVNAME=/dev/video33
DEVLINKS=/dev/v4l/by-path/pci-0000:02:01.0-video-index1

UDEV  [1262200513.724246] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video1 (video4linux)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video1
SUBSYSTEM=video4linux
MAJOR=81
MINOR=5
SEQNUM=1281
UDEVD_EVENT=1
ID_PATH=pci-0000:02:01.0
DEVNAME=/dev/video1
DEVLINKS=/dev/v4l/by-path/pci-0000:02:01.0-video-index0

UDEV  [1262200513.740210] add      
/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video25 (video4linux)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.4/0000:02:01.0/video4linux/video25
SUBSYSTEM=video4linux
MAJOR=81
MINOR=8
SEQNUM=1284
UDEVD_EVENT=1
ID_PATH=pci-0000:02:01.0
DEVNAME=/dev/video25
DEVLINKS=/dev/v4l/by-path/pci-0000:02:01.0-video-index3

[...]



Note that, for example, the "video1" part of the kernel UEVENT
"DEVPATH=.../video1" string is orginating from the videodev and ivtv
modules for the MPEG stream of my PVR-150.  After default udev rule
processing, the UDEV event shows a "DEVNAME=/dev/video1" which is the
device node created for the "DEVPATH=.../video1".  Note that
for /dev/video1, the minor number of "5" has nothing to do with the node
type of MPEG; it's just a minor number.

I suggest you add or modify your udev rules to not use the device minor
number with the new ivtv driver.

Regards,
Andy

> Cheers. 



_______________________________________________
ivtv-users mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-users

Reply via email to