Commit 0b99c0ed authored by Dafna Hirschfeld's avatar Dafna Hirschfeld

scripts that crashes vimc when it is unbound:

trash.sh - crashes when vimc is unbound while streaming

media-trash.sh - crashes when vimc is unbound while the media
device runs G_TOPOLOGY
parent dddd20f5
#!/bin/bash
echo 15 > /proc/sys/kernel/printk
#echo "file drivers/media/platform/vimc/* +p" > /sys/kernel/debug/dynamic_debug/control
gcc media_syscall.c -o media_syscall
for ((i=1;i<=1000000000000000;i++));
do
echo $i
modprobe vimc
./media_syscall &
sleep 1;
echo -n vimc.0 >/sys/bus/platform/drivers/vimc/unbind
echo -n vimc.0 >/sys/bus/platform/drivers/vimc/bind
modprobe vimc -r
done
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/sysmacros.h>
#include <dirent.h>
#include <linux/media.h>
//#include <media-info.h>
int main() {
int fd = open("/dev/media0", O_RDWR);
struct media_v2_topology topology;
if (fd == -1) {
printf("err open media\n");
return -1;
}
for (int i =0; i<1000000000; i++) {
memset(&topology, 0, sizeof(topology));
if (ioctl(fd, MEDIA_IOC_G_TOPOLOGY, &topology)) {
perror("topology err\n");
printf("iteration %d\n", i);
return -1;
}
}
return 0;
}
#!/bin/bash
echo 15 > /proc/sys/kernel/printk
#echo "file drivers/media/platform/vimc/* +p" > /sys/kernel/debug/dynamic_debug/control
for ((i=1;i<=100;i++));
do
echo $i
modprobe vimc
media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
v4l2-ctl --stream-mmap --stream-count=1000 -d /dev/video2 & sleep 1; echo -n vimc.0 >/sys/bus/platform/drivers/vimc/unbind
echo -n vimc.0 >/sys/bus/platform/drivers/vimc/bind
modprobe vimc -r
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment