MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.82k stars 494 forks source link

Raspberry Pi | Legacy camera apps fail on Bookworm #6848

Open supertevran opened 8 months ago

supertevran commented 8 months ago

G_DIETPI_VERSION_CORE=8 G_DIETPI_VERSION_SUB=25 G_DIETPI_VERSION_RC=1 G_GITBRANCH='master' G_GITOWNER='MichaIng' bookworm 1 Linux Therme 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux RPi B (armv6l) 944f7361-e48c-4480-9b04-6f8c96ec6d09

Fresh Install. Pi Camera Module. vcgencmd get_camera supported=1 detected=1, libcamera interfaces=0 /dev/video0: HDIO_GET_IDENTITY failed: Inappropriate ioctl for device

Unfortunately not working. Thx. for any help. BTW: On this setup RPi Cam Control & motionEye NOT working as well - Unable to open Video Device

MichaIng commented 8 months ago

Indeed, with Bookworm, the legacy camera interface has been removed. See also here: https://dietpi.com/forum/t/mjpg-streamer-on-rpi0/18843

Can you try this:

G_AGP libraspberrypi-dev
/boot/dietpi/func/dietpi-set_hardware rpi-opengl vc4-kms-v3d
G_CONFIG_INJECT 'camera_auto_detect=' 'camera_auto_detect=1' /boot/config.txt
sed -i -e '/libraspberrypi-dev/d' -e '/input_raspicam.so/d' /boot/dietpi/dietpi-software
dietpi-software reinstall 137

This enables the modern KMS video and camera stack and compiles mjpg-streamer without the legacy RPi camera module support. Instead it will try to grab the stream from /dev/video0 with the normal UVC module. Let's see whether this works.

supertevran commented 8 months ago

Hi.Thx. for your reply. Unfortunately no change....

MichaIng commented 8 months ago

But vcgencmd get_camera should show now:

supported=1 detected=1, libcamera interfaces=1

(1 at the end), isn't it?

Generally to test the functionality of the camera with the modern driver stack, you can use this package and command:

apt install rpicam-apps-lite
rpicam-hello
supertevran commented 8 months ago
vcgencmd get_camera
supported=1 detected=0, libcamera interfaces=1
rpicam-hello
[15:07:33.786468000] [6565]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+118-563cd78e
[15:07:36.212857000] [6570]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[15:07:36.238956000] [6570]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c@7e804000/ov5647@36 to Unicam device /dev/media2 and ISP device /dev/media0
[15:07:36.241038000] [6570]  INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Preview window unavailable
Mode selection for 1296:972:12:P
    SGBRG10_CSI2P,640x480/0 - Score: 3296
    SGBRG10_CSI2P,1296x972/0 - Score: 1000
    SGBRG10_CSI2P,1920x1080/0 - Score: 1349.67
    SGBRG10_CSI2P,2592x1944/0 - Score: 1567
Stream configuration adjusted
[15:07:36.393557000] [6565]  INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-YUV420 (1) 1296x972-SGBRG10_CSI2P
[15:07:36.397122000] [6570]  INFO RPI vc4.cpp:608 Sensor: /base/soc/i2c@7e804000/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
#0 (0.00 fps) exp 33222.00 ag 5.50 dg 1.00
#1 (30.03 fps) exp 33222.00 ag 5.50 dg 1.00
#2 (30.01 fps) exp 33222.00 ag 5.88 dg 1.00
#3 (30.01 fps) exp 33222.00 ag 5.38 dg 1.00
#4 (30.02 fps) exp 33222.00 ag 5.38 dg 1.00
#5 (15.00 fps) exp 33222.00 ag 5.25 dg 1.02
#6 (30.03 fps) exp 33222.00 ag 5.25 dg 1.02
#7 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#8 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#9 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#10 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#11 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#12 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#13 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#14 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#15 (15.00 fps) exp 33222.00 ag 5.25 dg 1.02
#16 (30.04 fps) exp 33222.00 ag 5.25 dg 1.02
#17 (30.00 fps) exp 33222.00 ag 5.25 dg 1.02
#18 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#19 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#20 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#21 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#22 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#23 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#24 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#25 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#26 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#27 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#28 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#29 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#30 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#31 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#32 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#33 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#34 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#35 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#36 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#37 (30.03 fps) exp 33222.00 ag 5.25 dg 1.02
#38 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#39 (29.95 fps) exp 33222.00 ag 5.25 dg 1.02
#40 (30.07 fps) exp 33222.00 ag 5.25 dg 1.02
#41 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#42 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#43 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#44 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#45 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#46 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#47 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#48 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#49 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#50 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#51 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#52 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#53 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#54 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#55 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#56 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#57 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#58 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#59 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#60 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#61 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#62 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#63 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#64 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#65 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#66 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#67 (30.00 fps) exp 33222.00 ag 5.25 dg 1.02
#68 (30.00 fps) exp 33222.00 ag 5.25 dg 1.02
#69 (30.04 fps) exp 33222.00 ag 5.25 dg 1.02
#70 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#71 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#72 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#73 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#74 (15.00 fps) exp 33222.00 ag 5.25 dg 1.02
#75 (30.06 fps) exp 33222.00 ag 5.25 dg 1.02
#76 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#77 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#78 (29.99 fps) exp 33222.00 ag 5.25 dg 1.02
#79 (30.04 fps) exp 33222.00 ag 5.25 dg 1.02
#80 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#81 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#82 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#83 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#84 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#85 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#86 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#87 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#88 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#89 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#90 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#91 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#92 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#93 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#94 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#95 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#96 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#97 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#98 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#99 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#100 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#101 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#102 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#103 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#104 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#105 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#106 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#107 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#108 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#109 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#110 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#111 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
#112 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#113 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#114 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#115 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#116 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#117 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#118 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#119 (30.02 fps) exp 33222.00 ag 5.25 dg 1.02
#120 (30.01 fps) exp 33222.00 ag 5.25 dg 1.02
#121 (15.01 fps) exp 33222.00 ag 5.25 dg 1.02
MichaIng commented 8 months ago

Seems to work. I guess you need to run this from within a desktop/X session to have an actual preview window show up, but the frames are collected successfully.

Interesting is this:

Unicam device /dev/media2 and ISP device /dev/media0

We were always looking for /dev/video* devices, but probably those /dev/media* devices need o be used.

But I was looking around a little more, and it seems that is not gonna work either, at least not without libcamerify, which I do not want to spend much time with for now.

But, there is a fork with libcamera support: https://github.com/ArduCAM/mjpg-streamer Also discussed here: https://forums.raspberrypi.com/viewtopic.php?t=346053 Let me create a PR with this fork and its input_libcamera module compiled. This sounds promising.