/** ****************************************************************************** * @file hgics.c * @author HUGE-IC Application Team * @version V1.0.0 * @date 2022-05-18 * @brief hgic smac driver daemon. ****************************************************************************** * @attention * *

© COPYRIGHT 2022 HUGE-IC

* ****************************************************************************** */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "hgic.h" #include "iwpriv.c" int main(int argc, char *argv[]) { int fd = -1; int i = 0; int len = 0; char cmd[512]; char *buff; int ret = 0; if (argc < 2) { return -1; } buff = malloc(4096); if (buff == NULL) { printf("no mem\r\n"); return -1; } fd = open("/proc/hgics/iwpriv", O_RDONLY); if (fd != -1) { HGIC = "hgics"; } else { fd = open("/proc/hgicf/iwpriv", O_RDONLY); if (fd != -1) { HGIC = "hgicf"; } else { printf("open iwpriv file fail\r\n"); free(buff); return -1; } } close(fd); for (i = 1; i < argc; i++) { len += sprintf(cmd + len, "%s ", argv[i]); } cmd[len - 1] = 0; memset(buff, 0, 4096); ret = hgic_iwpriv_do(cmd, 0, 0, buff, 4096); printf("RESP:%d\r\n%s\r\n", ret, buff); free(buff); return 0; }