luckfox-pico-sdk/media/sysutils/examples/rk_event_test.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

57 lines
1.3 KiB
C

/*
* Copyright (c) 2022 rockchip
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "rk_event.h"
#include <string.h>
#include <unistd.h>
#include <linux/input.h>
#include <pthread.h>
#include <sys/time.h>
void main_event_handler_t(struct input_event *eventcb) {
if (eventcb == NULL) {
printf("eventcb is null\n");
return;
}
printf("[eventval:sec:%ld, usec:%ld, type:%d, code:%d, value:%d]\n", eventcb->time.tv_sec,
eventcb->time.tv_usec, eventcb->type, eventcb->code, eventcb->value);
}
int main() {
bool is_quit = true;
char str1[] = "/dev/input/event0";
char str2[] = "/dev/input/event1";
char str3[] = "/dev/input/event2";
char str4[] = "/dev/input/event3";
rk_event_register(str1);
rk_event_register(str2);
rk_event_register(str3);
rk_event_unregister(str4);
rk_event_listen_start(main_event_handler_t);
char cmd[64];
printf("\n#Usage: input 'quit' to exit programe!\n");
while (is_quit) {
fgets(cmd, sizeof(cmd), stdin);
if (strstr(cmd, "quit")) {
printf("#Get 'quit' cmd!\n");
break;
}
usleep(500000);
}
rk_event_listen_stop();
return 0;
}