Discussion:
No /dev/video0 on Pi 4 with CSI camera
(too old to reply)
o***@disroot.org
2021-01-06 09:10:01 UTC
Permalink
From: Mark Raynsford <list+***@io7m.com>
Date: Sun, 12 Jul 2020 10:27:00 +0000
Message-id: ***@sunflower.int.arc7.info>
https://lists.debian.org/debian-arm/2020/07/msg00008.html
I'm experimenting with a Raspberry Pi 4 Model B and can't seem to get
V4L to expose a /dev/video0 device when using the standard CSI camera
module. Raspbian on the same device seems to expose one correctly. I'm
using the 20200707_raspi_4 image.
I was having similar problems with an early Pi 1, Model B+. The following exposed a /dev/video0 device for me. Maybe it works for a Pi4 too.

Installed raspi_0w image.
Added start_x=1 in /boot/firmware/config.txt
Installed v4l-utils, v4l2ucp, v4l-conf.
Installed a bunch of python stuff...
No joy.
Upgraded system to debian testing (to get the bcm2835_v4l2 module, from the staging directory).
Reboot.
Changed /boot/firmware/config.txt again, because it was overwritten during upgrade to testing: start_x=1 ; Also added gpu_mem=128 but not sure if this is needed.
Reboot
Magic! /dev/video0 now exists.
Haven't captured a picture yet, but this looks promising:
# v4l2-ctl --info
Driver Info:
Driver name : bm2835 mmal
Card type : mmal service 16.1
Bus info : platform:bcm2835-v4l2-0
Driver version : 5.9.15
Capabilities : 0x85200005
Video Capture
Video Overlay
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200005
Video Capture
Video Overlay
Read/Write
Streaming
Extended Pix Format
I'd prefer not to have to run Raspbian on the device.
Me too! :)
Gunnar Wolf
2021-01-29 17:20:02 UTC
Permalink
Hi!
Post by o***@disroot.org
I'm experimenting with a Raspberry Pi 4 Model B and can't seem to get
V4L to expose a /dev/video0 device when using the standard CSI camera
module. Raspbian on the same device seems to expose one correctly. I'm
using the 20200707_raspi_4 image.
I was having similar problems with an early Pi 1, Model B+. The following exposed a /dev/video0 device for me. Maybe it works for a Pi4 too.
I was very happy to see this message! Still...
Post by o***@disroot.org
Installed raspi_0w image.
Added start_x=1 in /boot/firmware/config.txt
Installed v4l-utils, v4l2ucp, v4l-conf.
Installed a bunch of python stuff...
No joy.
Upgraded system to debian testing (to get the bcm2835_v4l2 module, from the staging directory).
Reboot.
Changed /boot/firmware/config.txt again, because it was overwritten during upgrade to testing: start_x=1 ; Also added gpu_mem=128 but not sure if this is needed.
Reboot
Magic! /dev/video0 now exists.
# v4l2-ctl --info
No luck yet :-( I tried this on a RPi4, and while /dev/vide0 exists,
any attempts to use it ends up with a dead camera grabbing program :-(
Alan Corey
2021-01-29 19:00:01 UTC
Permalink
The CSI cameras are not natively anything like v4l, maybe you can run
something now to make them compliant. The Pi should work with a USB
camera and give v4l.

See the RPI forums at
https://www.raspberrypi.org/forums/viewforum.php?f=43&sid=a62693ef63165f18071bd85d069e6e90
Or in Raspbian look at the raspistill and raspicam programs. They're
more like surplus cell phone cameras than anything with a standard
interface.
Post by Gunnar Wolf
Hi!
Post by o***@disroot.org
I'm experimenting with a Raspberry Pi 4 Model B and can't seem to get
V4L to expose a /dev/video0 device when using the standard CSI camera
module. Raspbian on the same device seems to expose one correctly. I'm
using the 20200707_raspi_4 image.
I was having similar problems with an early Pi 1, Model B+. The following
exposed a /dev/video0 device for me. Maybe it works for a Pi4 too.
I was very happy to see this message! Still...
Post by o***@disroot.org
Installed raspi_0w image.
Added start_x=1 in /boot/firmware/config.txt
Installed v4l-utils, v4l2ucp, v4l-conf.
Installed a bunch of python stuff...
No joy.
Upgraded system to debian testing (to get the bcm2835_v4l2 module, from
the staging directory).
Reboot.
Changed /boot/firmware/config.txt again, because it was overwritten during
upgrade to testing: start_x=1 ; Also added gpu_mem=128 but not sure if
this is needed.
Reboot
Magic! /dev/video0 now exists.
# v4l2-ctl --info
No luck yet :-( I tried this on a RPi4, and while /dev/vide0 exists,
any attempts to use it ends up with a dead camera grabbing program :-(
--
-------------
Education is contagious.
o***@disroot.org
2021-02-10 16:30:02 UTC
Permalink
Thanks for the forum link! As mentioned there, fswebcam can capture images after config.txt is setup (again and again).

# fswebcam -F 5 --png --save fsw2.png

gave a 384x288 png image from the camera, with a date-time tag along the bottom! It's not the highest quality by today's phone standards, but it's OK.

A tip on making config.txt changes persistent after upgrades, or getting it to work as non-root user, would be appreciated.

# fswebcam -F 5 --png --save fsw2.png
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing 5 frames...
Captured 5 frames in 0.71 seconds. (7 fps)
--- Processing captured image...
Setting output format to PNG, quality 0
Writing PNG image to 'fsw2.png'.

# file fsw2.png
fsw2.png: PNG image data, 384 x 288, 8-bit/color RGB, non-interlaced
Post by Alan Corey
The CSI cameras are not natively anything like v4l, maybe you can run
something now to make them compliant. The Pi should work with a USB
camera and give v4l.
See the RPI forums at
https://www.raspberrypi.org/forums/viewforum.php?f=43&sid=a62693ef63165f18071bd85d069e6e90
Or in Raspbian look at the raspistill and raspicam programs. They're
more like surplus cell phone cameras than anything with a standard
interface.
Post by Gunnar Wolf
Hi!
Post by o***@disroot.org
I'm experimenting with a Raspberry Pi 4 Model B and can't seem to get
V4L to expose a /dev/video0 device when using the standard CSI camera
module. Raspbian on the same device seems to expose one correctly. I'm
using the 20200707_raspi_4 image.
I was having similar problems with an early Pi 1, Model B+. The following
exposed a /dev/video0 device for me. Maybe it works for a Pi4 too.
I was very happy to see this message! Still...
Post by o***@disroot.org
Installed raspi_0w image.
Added start_x=1 in /boot/firmware/config.txt
Installed v4l-utils, v4l2ucp, v4l-conf.
Installed a bunch of python stuff...
No joy.
Upgraded system to debian testing (to get the bcm2835_v4l2 module, from
the staging directory).
Reboot.
Changed /boot/firmware/config.txt again, because it was overwritten during
upgrade to testing: start_x=1 ; Also added gpu_mem=128 but not sure if
this is needed.
Reboot
Magic! /dev/video0 now exists.
# v4l2-ctl --info
No luck yet :-( I tried this on a RPi4, and while /dev/vide0 exists,
any attempts to use it ends up with a dead camera grabbing program :-(
--
-------------
Education is contagious.
Alan Corey
2021-02-10 17:20:01 UTC
Permalink
You could write your own script that calls fswebcam feeding it all the
options you want, chmod it executable, and put a copy in your path
somewhere. That won't be touched by upgrades. Not sure about the
user, if you can call sudo or su from a script or not. I don't think
I've ever used fswebcam. Can you add yourself to a camera group?

I wrote this and use it on my Pinebook Pro laptop which as a USB
camera as builtin. Output filenames are date and time .jpg.

#!/bin/bash
adate=`date +"%Y-%m-%d_%H-%M"`
uvccapture -d/dev/video2 -v -x1600 -y1200 -m -o$adate.jpg
Post by o***@disroot.org
Thanks for the forum link! As mentioned there, fswebcam can capture images
after config.txt is setup (again and again).
# fswebcam -F 5 --png --save fsw2.png
gave a 384x288 png image from the camera, with a date-time tag along the
bottom! It's not the highest quality by today's phone standards, but it's
OK.
A tip on making config.txt changes persistent after upgrades, or getting it
to work as non-root user, would be appreciated.
# fswebcam -F 5 --png --save fsw2.png
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing 5 frames...
Captured 5 frames in 0.71 seconds. (7 fps)
--- Processing captured image...
Setting output format to PNG, quality 0
Writing PNG image to 'fsw2.png'.
# file fsw2.png
fsw2.png: PNG image data, 384 x 288, 8-bit/color RGB, non-interlaced
Post by Alan Corey
The CSI cameras are not natively anything like v4l, maybe you can run
something now to make them compliant. The Pi should work with a USB
camera and give v4l.
See the RPI forums at
https://www.raspberrypi.org/forums/viewforum.php?f=43&sid=a62693ef63165f18071bd85d069e6e90
Or in Raspbian look at the raspistill and raspicam programs. They're
more like surplus cell phone cameras than anything with a standard
interface.
Post by Gunnar Wolf
Hi!
Post by o***@disroot.org
I'm experimenting with a Raspberry Pi 4 Model B and can't seem to get
V4L to expose a /dev/video0 device when using the standard CSI camera
module. Raspbian on the same device seems to expose one correctly. I'm
using the 20200707_raspi_4 image.
I was having similar problems with an early Pi 1, Model B+. The following
exposed a /dev/video0 device for me. Maybe it works for a Pi4 too.
I was very happy to see this message! Still...
Post by o***@disroot.org
Installed raspi_0w image.
Added start_x=1 in /boot/firmware/config.txt
Installed v4l-utils, v4l2ucp, v4l-conf.
Installed a bunch of python stuff...
No joy.
Upgraded system to debian testing (to get the bcm2835_v4l2 module, from
the staging directory).
Reboot.
Changed /boot/firmware/config.txt again, because it was overwritten during
upgrade to testing: start_x=1 ; Also added gpu_mem=128 but not sure if
this is needed.
Reboot
Magic! /dev/video0 now exists.
# v4l2-ctl --info
No luck yet :-( I tried this on a RPi4, and while /dev/vide0 exists,
any attempts to use it ends up with a dead camera grabbing program :-(
--
-------------
Education is contagious.
--
-------------
Education is contagious.
Loading...