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

Đang mở Phù hợp với người mới
#7,399 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
c, linux, raspberry-pi

Hướng nghiên cứu

Bắt đầu trong hàm cfe_notify của driver rp1-cfe và kiểm tra việc xử lý V4L2_DEVICE_NOTIFY_EVENT cũng như kiểm tra NODE_REGISTERED được mô tả trong issue. Tái hiện bằng v4l2-ctl --wait-for-event=source_change, sau đó xác minh rằng V4L2_EVENT_SOURCE_CHANGE do cảm biến CSI-2 gửi đến được ứng dụng userspace nhận.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C
Star
13.2k
Fork
5.5k
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
22

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của raspberrypi/linux

Tất cả issue của raspberrypi/linux

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.