嵌入式linux实现即插即用(热插拔)USB盘问题
时间:2007-10-18
来源:互联网
如果我要实现即插即用(热插拔)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
下面是我已经实现的功能和打印信息:
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
作者: schuang333 发布时间: 2007-10-18
你好.我首先挂载上去.如何卸载呢?就是不知道如何卸载,所以每次我都是直接拔出,就出现和你一样的问题.请你楼主你是如何解决你的问题呢?因为我遇到的问题和你一样.先谢谢了.
作者: no74 发布时间: 2008-06-19
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28