gkaindl / ambi-tv

a flexible ambilight clone for embedded linux
296 stars 85 forks source link

v4l2-grab: failed to start video streaming: 71 (Protocol error) #13

Closed andyclarke closed 10 years ago

andyclarke commented 10 years ago

Well after lots of trouble getting the usbtv module loaded I have finally got that but now it seems to have problems with the video capture:

pi@raspberrypi ~/ambi-tv $ sudo bin/ambi-tv

*********************************************************
*  ambi-tv: diy ambient lighting for your screen or tv  *
*                                         (c) @gkaindl  *
*********************************************************

registration: registered component 'v4l2-video' (class v4l2-grab-source).
        device name:              /dev/video0
        buffers:                  4
        crop-top:                 1
        crop-right:               4
        crop-bottom:              1
        crop-left:                4
        auto-crop luma threshold: 8
registration: registered component 'timer-30fps' (class timer-source).
        millis: 33
registration: registered component 'led-frame' (class lpd8806-spidev-sink).
        device name:       /dev/spidev0.0
        spi hz:            2500000
        number of leds:    32
        blending frames:   3
        led insets (tblr): 0.0%, 0.0%, 0.0%, 0.0%
        gamma (rgb):       1.55, 1.60, 1.50
registration: registered component 'avg-color' (class avg-color-processor).
registration: registered component 'edge-color' (class edge-color-processor).
        box-width:  8
        box-height: 8
registration: registered component 'mood-light' (class mood-light-processor).
        speed:  2.0
program: 'program_tv_edge_color': appended component 'v4l2-video'.
program: 'program_tv_edge_color': appended component 'edge-color'.
program: 'program_tv_edge_color': appended component 'led-frame'.
program: registered program 'program_tv_edge_color'.
program: 'program_tv_avg_color': appended component 'v4l2-video'.
program: 'program_tv_avg_color': appended component 'avg-color'.
program: 'program_tv_avg_color': appended component 'led-frame'.
program: registered program 'program_tv_avg_color'.
program: 'program_mood_light': appended component 'timer-30fps'.
program: 'program_mood_light': appended component 'mood-light'.
program: 'program_mood_light': appended component 'led-frame'.
program: registered program 'program_mood_light'.
main: configuration finished, 3 programs available.
        program_tv_edge_color
        program_tv_avg_color
        program_mood_light
component: activating component 'v4l2-video'...
v4l2-grab: video format: 720x576 (YUYV).
v4l2-grab: failed to start video streaming: 71 (Protocol error).
main: failed to start initial program 'program_tv_edge_color', aborting...

As far as I can tell, all the required modules are loaded:

pi@raspberrypi ~/ambi-tv $ lsmod
Module                  Size  Used by
spidev                  5224  0
spi_bcm2708             4816  0
snd_bcm2835            16304  0
snd_pcm                77560  1 snd_bcm2835
snd_page_alloc          5145  1 snd_pcm
snd_seq                53329  0
snd_seq_device          6438  1 snd_seq
snd_timer              19998  2 snd_pcm,snd_seq
snd                    58447  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
usbtv                   6366  0
videobuf2_vmalloc       2425  1 usbtv
videobuf2_memops        2584  1 videobuf2_vmalloc
videobuf2_core         26995  1 usbtv
videodev              104342  2 usbtv,videobuf2_core
media                  13424  1 videodev
leds_gpio               2235  0
led_class               3562  1 leds_gpio

And the EasyCap device is there:

pi@raspberrypi ~/ambi-tv $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 1b71:3002

dmesg shows:

[  631.202385] usb 1-1.3: USB disconnect, device number 5
[  631.522303] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
[  631.625871] usb 1-1.3: config 1 interface 0 altsetting 1 bulk endpoint 0x83 has invalid maxpacket 256
[  631.629241] usb 1-1.3: New USB device found, idVendor=1b71, idProduct=3002
[  631.629268] usb 1-1.3: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[  631.629284] usb 1-1.3: Product: usbtv007
[  631.629299] usb 1-1.3: Manufacturer: fushicai
[  631.629313] usb 1-1.3: SerialNumber: 300000000002
[  631.630888] size is 3072, interval is 1
[  631.631250] usbtv 1-1.3:1.0: Fushicai USBTV007 Video Grabber

Would it give this error if it didn't like the video input? Would it not work with no input?

Many thanks, Andy

andyclarke commented 10 years ago

I've just read the issue titled "NTSC support" and this seems to be a similar error. I'm not using a USB extension cable. I will try a more powerful PSU or see if I can get a USB hub.

andyclarke commented 10 years ago

I used a slightly more powerful PSU for the PI, 1.2amps (best one I have around) and it didn't make a difference. I then tried the top USB port on the PI and after a reboot it started to work for about a second and then did this:

*********************************************************
*  ambi-tv: diy ambient lighting for your screen or tv  *
*                                         (c) @gkaindl  *
*********************************************************

registration: registered component 'v4l2-video' (class v4l2-grab-source).
        device name:              /dev/video0
        buffers:                  4
        crop-top:                 1
        crop-right:               4
        crop-bottom:              1
        crop-left:                4
        auto-crop luma threshold: 8
registration: registered component 'timer-30fps' (class timer-source).
        millis: 33
registration: registered component 'led-frame' (class lpd8806-spidev-sink).
        device name:       /dev/spidev0.0
        spi hz:            2500000
        number of leds:    32
        blending frames:   3
        led insets (tblr): 0.0%, 0.0%, 0.0%, 0.0%
        gamma (rgb):       1.55, 1.60, 1.50
registration: registered component 'avg-color' (class avg-color-processor).
registration: registered component 'edge-color' (class edge-color-processor).
        box-width:  8
        box-height: 8
registration: registered component 'mood-light' (class mood-light-processor).
        speed:  2.0
program: 'program_tv_edge_color': appended component 'v4l2-video'.
program: 'program_tv_edge_color': appended component 'edge-color'.
program: 'program_tv_edge_color': appended component 'led-frame'.
program: registered program 'program_tv_edge_color'.
program: 'program_tv_avg_color': appended component 'v4l2-video'.
program: 'program_tv_avg_color': appended component 'avg-color'.
program: 'program_tv_avg_color': appended component 'led-frame'.
program: registered program 'program_tv_avg_color'.
program: 'program_mood_light': appended component 'timer-30fps'.
program: 'program_mood_light': appended component 'mood-light'.
program: 'program_mood_light': appended component 'led-frame'.
program: registered program 'program_mood_light'.
main: configuration finished, 3 programs available.
        program_tv_edge_color
        program_tv_avg_color
        program_mood_light
component: activating component 'v4l2-video'...
v4l2-grab: video format: 720x576 (YUYV).
component: activating component 'edge-color'...
component: activating component 'led-frame'...
main: started initial program 'program_tv_edge_color'.
main: ************* start-up complete
        press <space> to cycle between programs.
        press 't' to toggle pause.
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to dequeue a frame: 19 (No such device).
v4l2-grab: failed to stop video streaming: 19 (No such device).
component: deactivating component 'edge-color'...
component: deactivating component 'led-frame'...

Very fast, over and over until I stopped it with a Ctrl-C!

Still think it might be a power draw issue so will get a powered USB hub tomorrow and report back.

SchruteRampage commented 10 years ago

I plugged the EasyCap directly into the pi and I the code runs fine with no errors, but there is no output on my LED's. I am running a separate power supply for the LED's.

andyclarke commented 10 years ago

Well I'm now using an 8A PSU to power the PI and LEDs. The LEDs work great in mood-light mode but I still get the above error when trying the other two programs. It seems to work for a second and then I just get loads of:

v4l2-grab: failed to dequeue a frame: 19 (No such device).

over and over. Then after I Ctrl-C out of it, the video0 device has gone but there is a video1 device. I can change the config to use that and it does the same thing, and then swap back to video0.

Any one with any ideas? EasyCap is plugged directly in to the PI.

sn00zerman commented 10 years ago

I had the same issue in the beginning. You power-supply is probably good enough,however, the RPI does not "pass-trough" this power on the USB connector. It seems like the Easycap is pushing the the RPI USB to it's limits … I'm sure that when you put a powered USB-hub in between, this problem will go away :-) (At least, it solved my issue)

good luck, Kris

-=(http://www.digitalplayground.be)=- Where fun meets technology

Op 24-aug.-2013, om 18:59 heeft Andy notifications@github.com het volgende geschreven:

Well I'm now using an 8A PSU to power the PI and LEDs. The LEDs work great in mood-light mode but I still get the above error when trying the other two programs. It seems to work for a second and then I just get loads of:

v4l2-grab: failed to dequeue a frame: 19 (No such device). over and over. Then after I Ctrl-C out of it, the video0 device has gone but there is a video1 device. I can change the config to use that and it does the same thing, and then swap back to video0.

Any one with any ideas? EasyCap is plugged directly in to the PI.

— Reply to this email directly or view it on GitHub.

andyclarke commented 10 years ago

I can confirm that a powered USB hub fixed this issue. Thanks all.