Hello, I'm trying to get a usb camera working on a Raspberri Pi 3 with FreeBSD 12/HEAD. Some time ago I made a PC-based C/SDL identification system that takes pictures of people. I want it to run on 4 RPI 3 boards. The conversion to aarch64 goes very well, I only have to fix some touchscreen issues, the camera and a system clock.
The camera is a problem. It works somehow with a logitech C310 with running webcamd and pwcview but I can't get anything better than 320x200. Higher resolutions result in a pink screen, or crash pwcviewer with message "libv4l2 error dequeuing buf: Device not configured" or libjpeg complaining about reading beyond end of data.
On a default Raspbian system and on 32-bit FreeBSD 10.1 PC's the camera works without big problems, however on PC's I still have bandwidth issues. The camera likes to jam signals of touchscreens, cardreaders and the printer sometimes but I can live with that.
My own uneditted C/SDL-program from the PC system shows a messed up view or crashes, but some visible cam data is coming through. It used to show a fullscreen 640x480 10fps view, cut out the face and save a jpg of it on a mouse-click.
I will add the code here if required.
Things I tried:
- Compiling webcamd with debug on: Works the same, shows nothing while starting or while running pwcview.
- Setting sysctl var hw.usb.dwg_otg.debug=1: results in strange irresponsive system state, with stdin spamming the terminal with empty lines. Reboot is required.
- Tried the same setup with a RPI 2 and FreeBSD 11.1 REL: exact same problem. So v4l1 vs. v4l2 is probably not the problem.
- Switching packages pwcview/pwcbsd, optionally loading the pwc.ko module of pwcbsd, switched between kernel modules cuse4bsd and cuse: no differences noticed.
-unplugging all other USB devices and ethernet and start pwcview after sleep command: no change.
-Downloaded the HEAD src and looked for related options but found nothing
-Connecting the cam to a external self-powered USB 2 hub: webcam fully stops working.
Where do I have to look for the cause of this?
Does it still have to do with FreeBSD not supporting 'isochronous' transfer for high speed devices, which I read on a 2014 topic?:
https://forums.freebsd.org/threads/raspberry-pi-b-webcamd-ffmpeg-problem.49482/
https://lists.freebsd.org/pipermail/freebsd-arm/2014-May/008273.html
Is there any way to make a higher USB bandwidth possible on a RPI3?
And what other options do I have for having a 640x480 camera on a RPI3 with FreeBSD?
update: Another attempt, compiled mplayer with v4l support and try to play the /dev/video0 device:
(after starting webcamd on the cam usb device)
# mplayer -v tv:// -tv driver=v4l2:device=/dev/video0
works, in 160x120 resolution
# mplayer -v tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
mplayer shows a pink 640x480 screen, garbled cam data is visisble sometimes, keeps running endless with 0 frame-count and "v4l2: select timeout" messages
# mplayer -v tv:// -tv driver=v4l2:width=800:height=600:device=/dev/video0
results in pink 800x600 screen and looping with errors:
libv4l2: error: got 4 consecutive frame decode errors, last error: libjpeg error: end of image
v4l2: ioctl dequeue buffer failed: input/output error, idx = 1
Any higher resolution does the same as 800x600. The C310 webcam should go to 1280x720.
The camera is a problem. It works somehow with a logitech C310 with running webcamd and pwcview but I can't get anything better than 320x200. Higher resolutions result in a pink screen, or crash pwcviewer with message "libv4l2 error dequeuing buf: Device not configured" or libjpeg complaining about reading beyond end of data.
On a default Raspbian system and on 32-bit FreeBSD 10.1 PC's the camera works without big problems, however on PC's I still have bandwidth issues. The camera likes to jam signals of touchscreens, cardreaders and the printer sometimes but I can live with that.
My own uneditted C/SDL-program from the PC system shows a messed up view or crashes, but some visible cam data is coming through. It used to show a fullscreen 640x480 10fps view, cut out the face and save a jpg of it on a mouse-click.
I will add the code here if required.
Things I tried:
- Compiling webcamd with debug on: Works the same, shows nothing while starting or while running pwcview.
- Setting sysctl var hw.usb.dwg_otg.debug=1: results in strange irresponsive system state, with stdin spamming the terminal with empty lines. Reboot is required.
- Tried the same setup with a RPI 2 and FreeBSD 11.1 REL: exact same problem. So v4l1 vs. v4l2 is probably not the problem.
- Switching packages pwcview/pwcbsd, optionally loading the pwc.ko module of pwcbsd, switched between kernel modules cuse4bsd and cuse: no differences noticed.
-unplugging all other USB devices and ethernet and start pwcview after sleep command: no change.
-Downloaded the HEAD src and looked for related options but found nothing
-Connecting the cam to a external self-powered USB 2 hub: webcam fully stops working.
Where do I have to look for the cause of this?
Does it still have to do with FreeBSD not supporting 'isochronous' transfer for high speed devices, which I read on a 2014 topic?:
https://forums.freebsd.org/threads/raspberry-pi-b-webcamd-ffmpeg-problem.49482/
https://lists.freebsd.org/pipermail/freebsd-arm/2014-May/008273.html
Is there any way to make a higher USB bandwidth possible on a RPI3?
And what other options do I have for having a 640x480 camera on a RPI3 with FreeBSD?
update: Another attempt, compiled mplayer with v4l support and try to play the /dev/video0 device:
(after starting webcamd on the cam usb device)
# mplayer -v tv:// -tv driver=v4l2:device=/dev/video0
works, in 160x120 resolution
# mplayer -v tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0
mplayer shows a pink 640x480 screen, garbled cam data is visisble sometimes, keeps running endless with 0 frame-count and "v4l2: select timeout" messages
# mplayer -v tv:// -tv driver=v4l2:width=800:height=600:device=/dev/video0
results in pink 800x600 screen and looping with errors:
libv4l2: error: got 4 consecutive frame decode errors, last error: libjpeg error: end of image
v4l2: ioctl dequeue buffer failed: input/output error, idx = 1
Any higher resolution does the same as 800x600. The C310 webcam should go to 1280x720.
Last edited: