rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app

オープン 初心者向け
#7,399 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
c, linux, raspberry-pi

調査の方向性

rp1-cfeドライバーのcfe_notify関数から始め、issueで説明されているV4L2_DEVICE_NOTIFY_EVENTの処理とNODE_REGISTEREDチェックを調査します。v4l2-ctl --wait-for-event=source_changeで再現し、その後、CSI-2センサーが送信したV4L2_EVENT_SOURCE_CHANGEがuserspaceアプリケーションに到達することを確認します。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

Currently, I am developing driver for csi-2 camera, and noticed that when I execute v4l2_subdev_notify_event in my driver, it is not being received by my userspace application.
What I do:

memset(&ev, 0, sizeof(ev));
ev.type = V4L2_EVENT_SOURCE_CHANGE;
ev.u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION;
v4l2_subdev_notify_event(my_subdev, &ev);

After a quick debugging I found the reason in rp1-cfe driver. It looks that the check whether the node in NODE_REGISTERED state in function cfe_notify is incorrect:

case V4L2_DEVICE_NOTIFY_EVENT:
for (i = 0; i < NUM_NODES; i++) {
struct cfe_node *node = &cfe->node[i];

  	if (check_state(cfe, NODE_REGISTERED, i))
  		continue;

  	v4l2_event_queue(&node->video_dev, arg);

According to this code, the event will be sent only if the corresponding cfe node is not in NODE_REGISTERED state..
The fix is trivial:

if (!check_state(cfe, NODE_REGISTERED, i))

Steps to reproduce the behaviour
  1. Start listening for V4L2_EVENT_SOURCE_CHANGE event using v4l2-ctl:
    v4l2-ctl -d /dev/video0 --all --verbose --wait-for-event=source_change
  2. Try to send event from csi-2 sensor driver using v4l2_subdev_notify_event
  3. v4l2-ctl doesn't receive corresponding event
Device (s)

Raspberry Pi 5

System

raspinfo | head -n 17
System Information
Raspberry Pi 5 Model B Rev 1.0
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"

Raspberry Pi reference 2025-12-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 4997bf4e4e49bc3305eb182a4a08bd023529da04, stage4

Linux raspberrypi 6.12.47+rpt-rpi-2712 https://github.com/raspberrypi/linux/issues/1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
Revision : d04170
Serial : 7c04ad32b8996900
Model : Raspberry Pi 5 Model B Rev 1.0
Throttled flag : throttled=0x0

vcgencmd version
2025/11/05 17:37:18
Copyright (c) 2012 Broadcom
version 57db150d (release) (embedded)

Logs

No response

Additional context

No response

主要言語
C
スター
13.2k
フォーク
5.5k
平均マージ
2日 18時間
マージ済み PR(30日)
22

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

raspberrypi/linux のほかの issue

raspberrypi/linux の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。