Takin

Takin

1个粉丝

41

问答

0

专栏

0

资料

Takin  发布于  2015-03-17 09:35:33
采纳率 0%
41个问答
5519

海思板子如何实现远程升级

 
请教下诸位
想实现的功能,产品到客户那边如何让其自己更新软件
我来回答
回答7个
时间排序
认可量排序

cdxionghang

0个粉丝

15

问答

0

专栏

0

资料

cdxionghang 2015-03-17 17:15:42
认可0
做个网络升级不就行了?

Takin

1个粉丝

41

问答

0

专栏

0

资料

Takin 2015-03-17 17:34:06
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=13361&ptid=6004]cdxionghang 发表于 2015-3-17 17:15[/url]
做个网络升级不就行了?[/quote]

网络升级,要用web服务器吧
能不能详细讲解下

Takin

1个粉丝

41

问答

0

专栏

0

资料

Takin 2015-03-17 20:36:24
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=13366&ptid=6004]ecomsbz 发表于 2015-3-17 18:50[/url]
网络升级,或者sd在ubooot的时候升级[/quote]

用网络升级,我想到的是上传文件到服务器,
目前我使用的是boa服务器
提交数据到服务器是没问题的,
但提交文件时,在服务器上没有找到
代码如下:
#include
#include
#include
#include
#include
#include"cgic.h"
#define BufferLen 1024

int cgiMain(void){
    cgiFilePtr file;
    int targetFile;
    mode_t mode;
    char name[128];
    char fileNameOnServer[64];
    char contentType[1024];
    char buffer[BufferLen];
    char *tmpStr=NULL;
    int size;
    int got,t;
       
    cgiHeaderContentType("text/html");
    //取得html页面中file元素的值,应该是文件在客户机上的路径名
    if (cgiFormFileName("file", name, sizeof(name)) !=cgiFormSuccess) {
        fprintf(stderr,"could not retrieve filename/n");
        goto FAIL;
    }
       
    cgiFormFileSize("file", &size);
    //取得文件类型,不过本例中并未使用
    cgiFormFileContentType("file", contentType, sizeof(contentType));

        //目前文件存在于系统临时文件夹中,通常为/tmp,通过该命令打开临时文件。临时文件的名字与用户文件的名字不同,所以不能通过路径/tmp/userfilename的方式获得文件
    if (cgiFormFileOpen("file", &file) != cgiFormSuccess) {
        fprintf(stderr,"could not open the file/n");
        goto FAIL;
    }
    t=-1;
    //从路径名解析出用户文件名
    while(1){
        tmpStr=strstr(name+t+1,"//");
        if(NULL==tmpStr)
        tmpStr=strstr(name+t+1,"/");//if "//" is not path separator, try "/"
        if(NULL!=tmpStr)
            t=(int)(tmpStr-name);
        else
            break;
    }
    strcpy(fileNameOnServer,name+t+1);
    mode=S_IRWXU|S_IRGRP|S_IROTH;

        //在当前目录下建立新的文件,第一个参数实际上是路径名,此处的含义是在cgi程序所在的目录(当前目录))建立新文件
    targetFile=open(fileNameOnServer,O_RDWR|O_CREAT|O_TRUNC|O_APPEND,mode);
    if(targetFile<0){
        fprintf(stderr,"could not create the new file,%s/n",fileNameOnServer);
        goto FAIL;
    }
    //从系统临时文件中读出文件内容,并放到刚创建的目标文件中
    while (cgiFormFileRead(file, buffer, BufferLen, &got) ==cgiFormSuccess){
        if(got>0)
            write(targetFile,buffer,got);
    }
    cgiFormFileClose(file);
    close(targetFile);
    goto END;
FAIL:
    fprintf(stderr,"Failed to upload");
    return 1;
END:
//printf("File /"%s/" has been uploaded",fileNameOnServer);
    printf("File  has been uploaded");
    return 0;
}

hisi3518C

0个粉丝

3

问答

0

专栏

0

资料

hisi3518C 2015-03-18 11:54:19
认可0
这个问题不太清楚啊

liyin2005

0个粉丝

18

问答

0

专栏

7

资料

liyin2005 2015-04-20 16:18:15
认可0
自己写一个网络升级工具啊

Takin

1个粉丝

41

问答

0

专栏

0

资料

Takin 2015-04-21 09:17:07
认可0
[quote][url=forum.php?mod=redirect&goto=findpost&pid=15335&ptid=6004]liyin2005 发表于 2015-4-20 16:18[/url]
自己写一个网络升级工具啊[/quote]

thankyou
后我自己用web界面实现了通过http协议升级

ecomsbz

1个粉丝

22

问答

0

专栏

36

资料

ecomsbz 2015-03-17 18:50:25
认可0
网络升级,或者sd在ubooot的时候升级
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区