yangsong8-a1 opened a new pull request, #22221:
URL: https://github.com/apache/nuttx/pull/22221
## Summary
Add a software-only V4L2 capture driver that generates deterministic test
patterns without camera hardware. Each configured devpath registers its
own device through `capture_register()`. The pattern is eight vertical
bars with a centred panel showing device name, format, frame counter and
stream elapsed time.
`CONFIG_VIDEO_FAKE_DEVICE_PARAMS` is a struct initializer that also needs
to be in the dequote lists of `cmake/nuttx_mkconfig.cmake` and
`tools/cfgdefine.c`.
The first commit fixes pre-existing nxstyle errors in `tools/cfgdefine.c`
(statement-on-same-line and alignment issues).
## Impact
New driver, no existing code changed beyond adding it to the build system
and `drivers_initialize.c`.
## Testing
Build: `sim:nsh` with `DRIVERS_VIDEO`, `VIDEO_STREAM` and `VIDEO_FAKE`
(CMake + Make), no new warnings.
Run on sim: opened `/dev/video0`, set RGB565 320×240, streamed 5 frames
through the V4L2 MMAP path (`REQBUFS`/`QBUF`/`STREAMON`/`DQBUF`):
=== V4L2 Fake Video Test ===
Opened /dev/video0 (fd=3)
Set format: 320x240 RGB565 (sizeimage=0)
Requested 4 buffers, got 3
Buffer[0]: len=153600 addr=0x70b61e9f65a0
Buffer[1]: len=153600 addr=0x70b61ea1bda0
Buffer[2]: len=153600 addr=0x70b61ea415a0
Queued 3 buffers
Streaming ON
Frame 0: idx=0 bytesused=153600 cksum=0x012375b2 first8px=[ffff ffff ffff
ffff ffff ffff ffff ffff]
Frame 1: idx=1 bytesused=153600 cksum=0x012365c2 first8px=[ffff ffff ffff
ffff ffff ffff ffff ffff]
Frame 2: idx=2 bytesused=153600 cksum=0x01236bbc first8px=[ffff ffff ffff
ffff ffff ffff ffff ffff]
Frame 3: idx=0 bytesused=153600 cksum=0x012365c2 first8px=[ffff ffff ffff
ffff ffff ffff ffff ffff]
Frame 4: idx=1 bytesused=153600 cksum=0x01235fc8 first8px=[ffff ffff ffff
ffff ffff ffff ffff ffff]
Streaming OFF after 5 frames
=== Test Complete ===
Each frame is 153600 bytes (320×240×2) and the first pixels are 0xFFFF
(the white bar in RGB565). `VIDIOC_S_FMT` reports `sizeimage` 0; the
buffers from `VIDIOC_REQBUFS` have the full frame size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]