嵌入式linux插拔usb系统重启,嵌入式linux实现即插即用(热插拔)USB盘问题

如果我要实现即插即用(热插拔)USB盘,我还需要怎么做谢谢高手们指点。

下面是我已经实现的功能和打印信息:

BusyBox v1.2.1 (2007.09.12-03:35+0000) Built-in shell (ash)

Enter 'help' for a list of built-in commands.

~ # usb 1-1: new full speed USB device using ppc-soc-ohci and address 2  插入USB盘检测到的信息

usb 1-1: configuration #1 chosen from 1 choice

scsi0 : SCSI emulation for USB Mass Storage devices

scsi 0:0:0:0: Direct-Access     Hitachi  HTS541280H9AT00  0000 PQ: 0 ANSI: 0

SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)

sda: Write Protect is off

sda: assuming drive cache: write through

SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)

sda: Write Protect is off

sda: assuming drive cache: write through

sda: sda1 sda2

sd 0:0:0:0: Attached scsi disk sda

ls

bin          home         linuxrc      opt          sbin         var

dev          lib          lost+found   proc         tmp

etc          license.txt  mnt          root         usr

~ # usb 1-1: USB disconnect, address 2                          拔出USB盘

usb 1-1: new full speed USB device using ppc-soc-ohci and address 3  再次插入USB盘信息,到这是不是说明我的USB盘已经具有热插拔功能了 ?

usb 1-1: configuration #1 chosen from 1 choice

scsi1 : SCSI emulation for USB Mass Storage devices

scsi 1:0:0:0: Direct-Access     Hitachi  HTS541280H9AT00  0000 PQ: 0 ANSI: 0

SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)

sda: Write Protect is off

sda: assuming drive cache: write through

SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)

sda: Write Protect is off

sda: assuming drive cache: write through

sda: sda1 sda2

sd 1:0:0:0: Attached scsi disk sda

~ #

/mnt/samba # mount /dev/sda2 /mnt/samba  这是我手动mount如果我要实现当检测到sda2时自动挂载到samba中,当拔出时自动卸载samba我该如何实现????

/mnt/samba # cd samba

~ # cd /mnt/samba

/mnt/samba # ls

FAT: Filesystem panic (dev sda2)

fat_get_cluster: invalid cluster chain (i_pos 0)

File system has been set read-only

ls: ./schuang333: Input/output error

MiniNT        boot.ini      ibmbio.com    rexx.exe      tpplgm6.exe

Preboot       bootsect.dos  ibmdos.com    rxdinfo.rx    tpplgt1.exe

Recovery      command.com   launchit.bat  tpdiag.exe    tpplgt2.exe

Recycled      config.icr    ntdetect.com  tpdiag2.exe   tpplgw10.exe

Win51         config.sys    ntldr         tpplga10.exe  tpplgw11.exe

Win51IP       dos           pcycle.exe    tpplgd14.002  tptools

Win51IP.SP2   fcopy.ini     peldr         tpplgd14.exe  version.id

autoexec.bat  finddrv.bat   plnrchk.bat   tpplgd15.exe

autoexec.icr  himem.sys     psphd.done    tpplge3.exe

mnt/samba # cd ..

/mnt # cd ..

~ # usb 1-1: USB disconnect, address 3

usb 1-1: new full speed USB device using ppc-soc-ohci and address 4

usb 1-1: configuration #1 chosen from 1 choice

scsi2 : SCSI emulation for USB Mass Storage devices

scsi 2:0:0:0: Direct-Access     Hitachi  HTS541280H9AT00  0000 PQ: 0 ANSI: 0

SCSI device sdb: 156301488 512-byte hdwr sectors (80026 MB)

sdb: Write Protect is off

sdb: assuming drive cache: write through

SCSI device sdb: 156301488 512-byte hdwr sectors (80026 MB)

sdb: Write Protect is off

sdb: assuming drive cache: write through

sdb: sdb1 sdb2

sd 2:0:0:0: Attached scsi disk sdb

~ # cd mnt

/mnt # cd samba

/mnt/samba # ls

scsi 1:0:0:0: rejecting I/O to dead device

scsi 1:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 20376) failed

scsi 1:0:0:0: rejecting I/O to dead device

FAT: Directory bread(block 20377) failed

scsi 1:0:0:0: rejecting I/O to dead device

--------------------next---------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值