luckfox-pico-sdk/project/app/wifi_app/wifi/test/rkwifi_cli.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

58 lines
1.2 KiB
C

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#define RK_CMD_LINE_LEN 1600
#define CLI_SOCKET_PATH "/tmp/rkserver_socket"
int rkwifi_cli(int argc, char *argv[])
{
char command[RK_CMD_LINE_LEN];
struct sockaddr_un ser_un;
int tmp_argc = 1;
int socket_fd = 0;
int ret = 0;
memset(command, 0, sizeof(command));
sprintf(command, "%s", argv[tmp_argc++]);
while (tmp_argc < argc)
{
strcat(command, " ");
strcat(command, argv[tmp_argc++]);
}
socket_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (socket_fd <= 0)
{
printf("open socket err\n");
return -1;
}
memset(&ser_un, 0, sizeof(ser_un));
ser_un.sun_family = AF_UNIX;
strcpy(ser_un.sun_path, CLI_SOCKET_PATH);
ret = connect(socket_fd, (struct sockaddr *)&ser_un, sizeof(struct sockaddr_un));
if(ret < 0)
{
printf("connect err\n");
return -1;
}
printf("rkwifi cmd: %s\n", command);
write(socket_fd, command, strlen(command)+1);
read(socket_fd, command, sizeof(command));
if (strcmp(command, "OK"))
{
printf("send cmd err\n");
return -1;
} else
printf("%s\n", command);
return 0;
}