✅ Successfully cross-compiles for MIPS T31
- Library size: 139KB (libimp.a), 154KB (libimp.so unstripped), 136KB (stripped)
- Total code: 6,038+ lines
- All compilation warnings are expected (unused parameters in stubs, array bounds in codec)
[ 55.572304] Frame channel0 is slake now, Please activate it firstly!
The kernel driver (/dev/framechan0) is reporting that the channel is "slake" (inactive/slack) and needs to be activated before use.
What we're doing:
- Opening
/dev/framechan0withO_RDWR | O_NONBLOCK - Setting format via
ioctl(fd, VIDIOC_SET_FMT, &fmt)(0xc07056c3) - Setting buffer count via
ioctl(fd, VIDIOC_SET_BUFCNT, &count)(0xc0145608) - Starting stream via
ioctl(fd, VIDIOC_STREAM_ON, &enable)(0x80045612)
What might be missing:
- The kernel driver may require an additional "activation" ioctl before STREAM_ON
- There may be a dependency on ISP (Image Signal Processor) being initialized first
- The channel may need to be bound to an ISP device before activation
From IMP_FrameSource_EnableChn at 0x9ecf8, the sequence is:
- Open device:
open("/dev/framechan%d", O_RDWR | O_NONBLOCK) - Get format (if channel 0 and NV12):
ioctl(fd, 0x407056c4, &fmt)- GET_FMT - Set format:
ioctl(fd, 0xc07056c3, &fmt)- SET_FMT - Create VBM pool
- Set buffer count:
ioctl(fd, 0xc0145608, &count)- SET_BUFCNT - Set depth (if fifo):
ioctl(fd, 0x800456c5, &depth)- SET_DEPTH - Fill VBM pool
- Create capture thread
- Stream on:
ioctl(fd, 0x80045612, &enable)- STREAM_ON
-
ISP Initialization: The ISP module may need to be initialized and a sensor added before frame channels can be activated:
IMP_ISP_Open(); IMP_ISP_AddSensor(&sensor_info); IMP_ISP_EnableSensor();
-
Missing ioctl: There may be an activation ioctl we haven't discovered yet. Need to:
- Check if there's a VIDIOC_ACTIVATE or similar command
- Look for ioctls called between SET_BUFCNT and STREAM_ON
-
Binding: The frame channel may need to be bound to an ISP device first
-
Kernel Driver Version: The stock kernel driver may expect a specific initialization sequence that differs from what we've implemented
Before calling IMP_FrameSource_EnableChn, ensure:
IMP_ISP_Open();
// Add sensor configuration
IMP_ISP_EnableSensor();Use strace on the stock libimp.so to see the exact ioctl sequence:
strace -e ioctl prudynt 2>&1 | grep framechanCheck the kernel driver source (if available) for the "slake" error message and what conditions trigger it.
Create a minimal test that just:
- Opens
/dev/framechan0 - Calls each ioctl in sequence
- Logs the return values
- System: Module registry, binding/unbinding, observer pattern
- Encoder: Channel management, codec integration, rate control, threading
- FrameSource: Device management, VBM pools, frame capture threads
- OSD: Group/region management, registration, start/stop
- Audio: Device initialization, threading, channel management
- DMA: Buffer allocation, physical memory mapping
- Hardware Encoder: Integration with
/dev/jz-venc - VBM: Frame queue management, buffer lifecycle
- ISP: All functions are stubs that just log and return success
- IVS: All functions are stubs that just log and return success
- Audio Encoder/Decoder: Stub implementations
- ISP Module: Currently just stubs. May need real implementation for frame channels to work
- Audio Buffers: Channel enable/disable don't allocate actual audio buffers
- OSD Rendering: Region data isn't actually rendered to frames
- IVS Processing: No actual intelligent video analysis
- Immediate: Investigate ISP initialization requirements
- Short-term: Implement ISP device opening and sensor management
- Medium-term: Add proper error handling for kernel driver failures
- Long-term: Implement full ISP tuning and control
- DMA allocation via
/dev/jz-dma - Memory mapping via
/dev/mem - Device file opening (
/dev/framechan*)
- Hardware encoder (
/dev/jz-venc) - Audio device (
/dev/dsp) - ISP device (if exists)
- Frame channel activation (current issue)
- Frame capture from
/dev/framechan0
./build-for-device.shexport CROSS_COMPILE=mipsel-linux-
export PATH=/home/matteius/output/wyze_cam3_t31x_gc2053_rtl8189ftv/per-package/toolchain-external-custom/host/bin/:$PATH
make clean
make CROSS_COMPILE=mipsel-linux- PLATFORM=T31
make CROSS_COMPILE=mipsel-linux- stripscp lib/libimp.so root@device:/usr/lib/
scp lib/libsysutils.so root@device:/usr/lib/-
Enable verbose logging: The library uses stderr for logging. Redirect to see all messages:
prudynt 2>&1 | tee openimp.log
-
Check kernel messages: Use
dmesgto see kernel driver errors:dmesg | tail -50 -
Compare with stock: Run with stock libimp.so and compare behavior:
LD_LIBRARY_PATH=/path/to/stock prudynt
-
Trace system calls: Use
straceto see all system calls:strace -f prudynt 2>&1 | grep -E "open|ioctl|mmap"
- Binary Ninja MCP server:
/home/matteius/ingenic-lib-new/T31/lib/1.1.6/uclibc/5.4.0/libimp.so - Decompilation addresses documented in source code comments
- Kernel driver: Part of stock firmware (proprietary)