Forum Discussion
Altera_Forum
Honored Contributor
20 years agoproblem with usb driver
hi, I have boot uclinux kernel successful,then i plug a usb disk on my board,that's ok.But it show errors when i run the follow code: [/CODE]fdisk -l /dev/sda fdisk:Bad command or file name [...
Altera_Forum
Honored Contributor
20 years ago --- Quote Start --- originally posted by nacide@Jun 13 2006, 04:05 AM zhengkaike,
you need to have the commands that are called like mount, umount, grep, test, echo and sleep in your rootfs.
maybe it will also work with the busybox versions but i did not test this.
i call the shellscript from the rc script in /etc
for example
automount.sh &
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16150)
--- quote end ---
--- Quote End --- Hi,nacide, Thank you! May be my busybox has some bugs,there are many errors when compiled. I have resolved the problem by using mount() and umount(), it can work successful although it's not a best method. The code: <div class='quotetop'>QUOTE </div> --- Quote Start --- char spe_file[20]="/dev/sda1"; char cur_dir[]="/mnt/usb"; char um_dir[]="/mnt"; char subum_dir[]="usb/"; int main(void) { if(mkdir(cur_dir,O_RDWR)==-1) { //"/mnt/usb"exsit if(umount(cur_dir)==-1) { printf("erro : umount usb!\n"); exit(1); } chdir(um_dir); if(rmdir(subum_dir)==-1) { printf("error rmdir %s \n",subum_dir); exit(1); } printf("umount usb ok!\n"); return 0; } if(mount(spe_file,cur_dir,"vfat",2,(char *)NULL)==-1) { printf("error :mount"); exit(1); } printf("mount usb ok!\n"); return 0; }[/b] --- Quote End --- Thank you for your reply again.