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

Open Beginner friendly
#7,399 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
c, linux, raspberry-pi

Research direction

Start in the rp1-cfe driver's cfe_notify function and inspect the V4L2_DEVICE_NOTIFY_EVENT handling and NODE_REGISTERED check described in the issue. Reproduce with v4l2-ctl --wait-for-event=source_change, then verify that a V4L2_EVENT_SOURCE_CHANGE sent by the CSI-2 sensor reaches the userspace application.

Written by the indexing model from the issue text.

Description

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

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 18h
Merged PRs (30d)
22

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.