raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.1k stars 4.97k forks source link

Webcam random failure with kernel 3.12.21+ #623

Closed redhawkuk closed 7 years ago

redhawkuk commented 10 years ago

When capturing webcam 640x480 images at a rate of 1 frame every 2 seconds the device stops responding. Sometimes it could be 2 minutes before failure or even 10 minutes before failure either way it's a random occurrence with no set pattern. dmesg logs: [43252.679365] Linux video capture interface: v2.00 [43252.759618] uvcvideo: Found UVC 1.00 device (046d:08c5) [43252.782656] input: UVC Camera (046d:08c5) as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/input/input1 [43252.784539] usbcore: registered new interface driver uvcvideo [43252.784564] USB Video Class driver (1.1.1) [44406.355606] uvcvideo: Failed to set UVC probe control : -110 (exp. 26). [44411.368513] uvcvideo: Failed to set UVC probe control : -110 (exp. 26). [44416.408389] uvcvideo: Failed to set UVC probe control : -110 (exp. 26).

As a quick fix I have to physically unplug the webcam and reconnect to the USB port but ideally I need a better solution. I have rolled back to earlier kernel version and my webcam is totally stable 24/7 so I can only conclude that kernel 3.12.21+ has introduced some weird bug.

My webcam is a Logitech Pro 5000 and it's connected to the USB port without an external USB hub.

Any suggestions??

popcornmix commented 10 years ago

What was the kernel version that worked well? Can you identify the first kernel version that caused the problem?

redhawkuk commented 10 years ago

The last working kernel was 3.10.25+ after that 3.12 has pretty much killed it. I've been running rpi-update several times on the off-chance the problem had been fixed but alas no :(

popcornmix commented 10 years ago

Can you test this build: https://github.com/Hexxeh/rpi-firmware/commit/b842df82b33d8aafcd6c9be3b6a86cdc2f195ade It is the first 3.12 kernel, before the FIQ FSM rewrite went in.

redhawkuk commented 10 years ago

Rolling back to kernel 3.12.18+ aka b842df82b33d8aafcd6c9be3b6a86cdc2f195ade does appear to be more stable with my webcam that is to say it hasn't crashed yet. Unfortunately it has issues with audio capture and probably the RTL DVB-T dongle of which I have previously raised an issue here. I have another webcam with different chipset I could try out so perhaps this problem is unique to the Logitech Pro 5000.

Any idea what this error message is or what's causing it??

redhawkuk commented 10 years ago

(I closed in error the mouse moved when I clicked on "comment")

Rolling back to kernel 3.12.18+ aka b842df82b33d8aafcd6c9be3b6a86cdc2f195ade does appear to be more stable with my webcam that is to say it hasn't crashed yet. Unfortunately it has issues with audio capture and probably the RTL DVB-T dongle of which I have previously raised an issue here. I have another webcam with different chipset I could try out so perhaps this problem is unique to the Logitech Pro 5000.

Any idea what this error message is or what's causing it??

popcornmix commented 10 years ago

Probably best for @P33M to answer.

P33M commented 10 years ago

Possible dupe of #618.

Can you add dwc_otg.fiq_fsm_mask=0x3 uvcvideo.trace=0x408 to /boot/cmdline.txt, reboot and

redhawkuk commented 10 years ago

Thanks for the cmdline options I can report that my webcam has been running for well over 20 minutes now without crashing. I also tried audio capture at the same time with darkice to load the USB controller and so far so good audio is super stable.

Dmesg has the following log entries: [ 67.093184] uvcvideo: Trying format 0x4745504a (JPEG): 640x480. [ 67.094077] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 67.154702] uvcvideo: Trying format 0x47504a4d (MJPG): 640x480. [ 67.154744] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 67.188575] uvcvideo: Trying format 0x47504a4d (MJPG): 640x480. [ 67.188608] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 67.251121] uvcvideo: Device requested 384 B/frame bandwidth. [ 67.251158] uvcvideo: Selecting alternate setting 2 (384 B/frame bandwidth). [ 67.251830] uvcvideo: Allocated 5 URB buffers of 32x384 bytes each. [ 89.812997] uvcvideo: Trying format 0x4745504a (JPEG): 640x480. [ 89.813109] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 89.873228] uvcvideo: Trying format 0x47504a4d (MJPG): 640x480. [ 89.873260] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 89.931402] uvcvideo: Trying format 0x47504a4d (MJPG): 640x480. [ 89.931433] uvcvideo: Using default frame interval 66666.6 us (15.0 fps). [ 89.971499] uvcvideo: Device requested 384 B/frame bandwidth. [ 89.971568] uvcvideo: Selecting alternate setting 2 (384 B/frame bandwidth). [ 89.972300] uvcvideo: Allocated 5 URB buffers of 32x384 bytes each. (repeated)

Are there any consequences for having dwc_otg.fiq_fsm_mask=0x3 or should I remove this once a fix has been issued??

P33M commented 10 years ago

Bit 3 of the mask (0x4) enables the FIQ for USB2.0 isochronous transfers.

The primary advantage of doing this is that it significantly lowers the ARM11 CPU time spent poking the OTG registers to issue a transaction every 125uS. Scheduling accuracy is also much improved - the FIQ almost never drops a transfer.

I tested this originally with uncompressed-streaming webcams that transmit ~3k bytes per frame thinking that the increased data rates would make things more likely to fall over. There seems to be a bug with small packet sizes.

koosvriezen commented 10 years ago

Just wanted to note that the webcam in question in #618 is a USB1 device.

carllewin commented 9 years ago

I have noticed Raspbian kernel 3.18.7+ seems to be displaying similar instability when using Huawei 3G USB modem. Disconnecting the Ethernet cable with the USB modem connected causes the modem to reset. Disconnecting the USB modem causes apparent freezing of the system and sometimes host device crashes. The same hardware configuration worked reliably with 2.X kernel. Could the method described by P33M offer an appropriate way to diagnose the issue I am observing?

Ruffio commented 8 years ago

@redhawkuk has this issue been resolved? If yes, then please close this issue.

P33M commented 7 years ago

Closing USB issues as OP has not updated the thread. Further comments by the OP stating that the issue is still present on latest rpi-update kernel will lead to a review.

James4Ever0 commented 1 month ago

@redhawkuk

Solution: https://github.com/jacksonliam/mjpg-streamer/issues/182#issuecomment-2336583229