Files
luckfox-eng29 485f09ece6 Pullrequest mis5001 clear patch 0305 (#242)
* project/app : Add uvc_app_tiny application

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* project/cfg/BoardConfig_IPC/overlay : Add Ubuntu system support for Rockit and RKNN libraries

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/of : Add support for dynamic device tree

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/usb/serial : Add CH343 driver support

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/staging : Disable partial logging of fbtft

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/pinctrl/pinctrl-rockchip.h : Fix pinctrl configuration failure issue

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/include/dt-bindings/soc/rockchip,boot-mode.h : Add support for the reboot U-Boot command in the BusyBox system

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/video : Add logo display support for LF40-480480-ARK and LF40-720720-ARK

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/arch/arm/boot/dts : Add device tree files for the Luckfox RV1103/RV1106 series boards

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/arch/arm/configs : Add device tree files for the Luckfox RV1103/RV1106 series boards

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/u-boot/drivers/mmc/mmc.c : Fix the issue where some Micro SD cards fail to boot

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/u-boot/common/image-fit.c : Add U-Boot support for luckfox-config

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/rkbin/bin/rv11 : Add firmware with a serial baud rate of 115200 and back up the original firmware

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/u-boot/arch/arm/dts : Add device tree files for the Luckfox RV1103/RV1106 series boards

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/u-boot/configs : Add defconfig files for the Luckfox RV1103/RV1106 series boards

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/uboot/u-boot : Add support for the reboot U-Boot command in the BusyBox system

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/drivers/media/i2c : Add MIS5001 driver support

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/source/kernel/arch/arm : Add default support for MIS5001 on Luckfox RV1106 series boards

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/tools/board : Delete irrelevant overwrite files and patch files

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/drv_ko/insmod_ko.sh : Register mis5001 driver during boot process

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* media/isp/release_camera_engine_rkaiq_rv1106_arm-rockchip830-linux-uclibcgnueabihf/isp_iqfiles : Add mis5001 iqfile

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* project/app/rkipc/rkipc/src/rv1106_ipc : Add rkipc application support for mis5001 sensor

Signed-off-by: eng29 <eng29@luckfox.com>

* project/cfg/BoardConfig_IPC : Enable default retrieval of mis5001 iqfile and include ROCKIT and RKNN libraries of RV1106 series board

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* project/build.sh : Remove operations related to applying and deleting patches

Signed-off-by: eng29 <eng29@luckfox.com>

* project/build.sh : Modify build system menu description; Apply lightweight system processing only during Buildroot and BusyBox system compilation

Signed-off-by: eng29 <eng29@luckfox.com>

* sysdrv/tools/board/buildroot/luckfox_pico_w_defconfig : Add pppd and pgrep for 4G module

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>

* sysdrv/tools/board/kernel/rv1106-luckfox-pico-ultra-ipc.dtsi : Add uart4m1 support for lastest luckfox-config tool

Signed-off-by: eng29 <eng29@luckfox.com>

---------

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
Signed-off-by: eng29 <eng29@luckfox.com>
2025-03-05 17:21:58 +08:00

190 lines
4.6 KiB
C
Executable File

#include "camera_control.h"
#include "isp.h"
#include "param.h"
#include "rk_mpi_sys.h"
#include "uevent.h"
#include "uevent.h"
#include "uvc_control.h"
#include "uvc_log.h"
#include "uvc_video.h"
#include <getopt.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#ifdef COMPILE_FOR_UVC_UAC
#include "uac_control.h"
#include "uac_log.h"
#include "uac_uevent.h"
#include <pthread.h>
#include <sys/prctl.h>
#endif
#define LOG_TAG "rk_mpi_uvc"
#define UVC_VERSION "SDK V2.01"
enum { LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG };
int rkuvc_log_level = LOG_DEBUG;
char *rkuvc_ini_path_ = NULL;
char *rkuvc_iq_file_path_ = NULL;
// int enable_minilog = 0;
// int rk_mpi_uvc_log_level = LOG_LEVEL_INFO;
// int app_quit;
static const char short_options[] = "c:a:l:";
static const struct option long_options[] = {
{"config", required_argument, NULL, 'c'},
{"aiq_file", no_argument, NULL, 'a'},
{"log_level", no_argument, NULL, 'l'},
{"help", no_argument, NULL, 'h'},
{0, 0, 0, 0}};
static void usage_tip(FILE *fp, int argc, char **argv) {
fprintf(fp, "Usage: %s [options]\n"
"Version %s\n"
"Options:\n"
"-c | --config rkuvc ini file, default is "
"/userdata/rkuvc.ini, need to be writable\n"
"-a | --aiq_file aiq file dir path, default is /etc/iqfiles\n"
"-l | --log_level log_level [0/1/2/3], default is 2\n"
"-h | --help for help \n\n"
"\n",
argv[0], "V1.0");
}
#ifdef COMPILE_FOR_UVC_UAC
void *uac_app_thread(void *arg) {
prctl(PR_SET_NAME, "uac_pthread", 0, 0, 0);
LOG_INFO("uac uevent version = 1.0\n");
// create uac control
char *ch;
int type = 0; // UAC_API_MPI;
// rkuac_get_opt(argc, argv);
int result = uac_control_create(type);
if (result < 0) {
LOG_ERROR("uac_control_create fail\n");
goto err_monitor;
}
// register uevent monitor
uac_uevent_monitor_run();
while (1) {
usleep(100000);
}
err_monitor:
pthread_detach(pthread_self());
pthread_exit(NULL);
}
int uac_app_run() {
pthread_t tid;
return pthread_create(&tid, NULL, uac_app_thread, NULL);
}
#endif
void rkuvc_get_opt(int argc, char *argv[]) {
for (;;) {
int idx;
int c;
c = getopt_long(argc, argv, short_options, long_options, &idx);
if (-1 == c)
break;
switch (c) {
case 0: /* getopt_long() flag */
break;
case 'c':
rkuvc_ini_path_ = optarg;
break;
case 'a':
rkuvc_iq_file_path_ = optarg;
break;
case 'l':
rkuvc_log_level = atoi(optarg);
break;
case 'h':
usage_tip(stdout, argc, argv);
exit(EXIT_SUCCESS);
default:
usage_tip(stderr, argc, argv);
exit(EXIT_FAILURE);
}
}
}
void sigterm_handler(int sig) {
LOG_INFO("signal %d\n", sig);
app_quit = sig;
}
int main(int argc, char *argv[]) {
int fd;
int ret;
unsigned int handle;
char *buffer;
int handle_fd;
size_t size;
int i = 0;
int width, height;
int y, uv;
int extra_cnt = 0;
uint32_t flags = 0;
int media_set = 0;
RK_S32 s32Ret = RK_FAILURE;
rk_mpi_uvc_log_level = LOG_LEVEL_INFO;
app_quit = 0;
signal(SIGQUIT, sigterm_handler);
signal(SIGTERM, sigterm_handler);
char *log_level = getenv("rk_mpi_uvc_log_level");
if (log_level) {
LOG_INFO("rk_mpi_uvc_log_level=%d", atoi(log_level));
rk_mpi_uvc_log_level = atoi(log_level);
}
LOG_INFO("VERSION:%s %s %s \n", UVC_VERSION, __DATE__, __TIME__);
rkuvc_get_opt(argc, argv);
LOG_INFO("rkuvc_ini_path_ is %s, rkuvc_iq_file_path_ is %s, rkuvc_log_level "
"is %d\n",
rkuvc_ini_path_, rkuvc_iq_file_path_, rkuvc_log_level);
rk_param_init(rkuvc_ini_path_);
camera_control_init();
s32Ret = RK_MPI_SYS_Init();
if (s32Ret != RK_SUCCESS) {
LOG_ERROR("RK_MPI_SYS_Init %x\n", s32Ret);
return -1;
}
uvc_control_start_setcallback(camera_control_start);
uvc_control_stop_setcallback(camera_control_stop);
uevent_monitor_run(UVC_CONTROL_CAMERA);
uvc_control_run(UVC_CONTROL_CAMERA);
#ifdef COMPILE_FOR_UVC_UAC
uac_app_log_level = LOG_DEBUG;
char *uac_log_level = getenv("uac_app_log_level");
if (uac_log_level) {
uac_app_log_level = atoi(uac_log_level);
}
if (rk_param_get_int("video.source:enable_uac", 0))
uac_app_run();
#endif
while (1) {
if (0 == uvc_control_loop())
break;
usleep(100000);
}
uvc_video_id_exit_all();
camera_control_deinit();
#ifdef COMPILE_FOR_UVC_UAC
if (rk_param_get_int("video.source:enable_uac", 0)) {
LOG_INFO("uac control destory...\n");
uac_control_destory();
}
#endif
RK_MPI_SYS_Exit();
rk_param_deinit();
LOG_INFO("uvc_app exit.\n");
return 0;
}