免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1663 | 回复: 2
打印 上一主题 下一主题

[嵌入式] usb驱动已经写好了,完全可用,想用程序往U盘里写文件!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-26 14:10 |只看该作者 |倒序浏览
如题,我的思路是这样:当插入U盘后,调用shell命令挂载U盘,然后对U盘对应的文件进行读写。
源程序如下:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
        char *mountusb="mount -t -vfat /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/udisk";
        /*char *mountusb="mount /mnt/usb";*/
        printf("Now the usb flash will be mounted, please waiting...\n");
       
        if(system(mountusb)==0)
        {
                printf("OK! You can use the usb flash now!\n");
                system("ls /tmp/udisk");
        }
        else
                printf("There is something wrong!\n");
        return 0;
}
用arm-linux-gcc编译通过,但下载到板子上之后运行时出现了:找不到denpendence file /lib/modules/2.4.18-rmk-pxal 的错误,我看了一下板子上的文件,在/lib目录下却是没有modules这个文件夹,请各位高手帮忙解决一下,太感谢了!!
开发板是优龙s3c2440a,linux内核是2.4.18-rmk-pxal,装有busybox,有mount命令。

论坛徽章:
0
2 [报告]
发表于 2006-06-10 23:59 |只看该作者
你还没挂接成功,有mount系统调用的,你man一下就知道怎么用了

论坛徽章:
0
3 [报告]
发表于 2006-06-11 16:25 |只看该作者
用system或者直接用mount系统调用都是可以的,问题不在这里。

楼主可以手动试试mount是否是OK的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP