void reboot_efex(void)
{
int flash_handle = 0;
char command[32] = "efex";
int len = 0;
char buf[32] = "test";
memset(command, 0x00, 32);
memset(buf, 0x00, 32);
strcpy(command,"efex");
flash_handle = open("/dev/mtdblock6",O_RDWR);
if (flash_handle < 0)
fprintf(stderr,"in:reboot_efex open mtd device fail\n");
len = write(flash_handle,&command[0],32);
sync();
fprintf(stderr,"in:reboot_efex open mtd device len=%d\n",len);
lseek(flash_handle,0,SEEK_SET);
len = read(flash_handle,buf,strlen(command));
sync();
close(flash_handle);
fprintf(stderr,"in:reboot_efex read mtd device len=%d\n",len);
fprintf(stderr,"in:reboot_efex read mtd device =%s\n",buf);
}
{
int flash_handle = 0;
char command[32] = "efex";
int len = 0;
char buf[32] = "test";
memset(command, 0x00, 32);
memset(buf, 0x00, 32);
strcpy(command,"efex");
flash_handle = open("/dev/mtdblock6",O_RDWR);
if (flash_handle < 0)
fprintf(stderr,"in:reboot_efex open mtd device fail\n");
len = write(flash_handle,&command[0],32);
sync();
fprintf(stderr,"in:reboot_efex open mtd device len=%d\n",len);
lseek(flash_handle,0,SEEK_SET);
len = read(flash_handle,buf,strlen(command));
sync();
close(flash_handle);
fprintf(stderr,"in:reboot_efex read mtd device len=%d\n",len);
fprintf(stderr,"in:reboot_efex read mtd device =%s\n",buf);
}
本文介绍了一个名为reboot_efex的函数,该函数通过与特定设备文件交互来执行efex重启流程。它首先打开设备文件/dev/mtdblock6,然后向设备写入指令“efex”,随后读取设备响应并关闭设备。

5758

被折叠的 条评论
为什么被折叠?



