三星移动硬盘在nuc960上无法挂载问题解决方法
1.环境及现象
硬件: nuc960 开发板
软件:linux2.6.17kernel
现象:插入usb时打印如下log:
chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: SAMSUNG Model: HM080GC Rev: 0 0
Type: Direct-Access ANSI SCSI revision: 00
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:<6>sd 0:0:0:0: SCSI error: return code = 0x10070000
end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
sd 0:0:0:0: SCSI error: return code = 0x10070000
end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
unable to read partition table
换用linux2.6.35kernel测试,可以正常挂载。
2.原因
有些设备需要设置US_FL_IGNORE_RESIDUE。
这个设备在写的时候会误报dCSWDataResidue,用社区里面那些伙计的话说就是,这种设备在执行写命令dcswdataresidu的时候,会往dCSWDataResidue填写垃圾信息.本来写操作是正确的执行了,可dcswdataresidu 偏偏要让scsi那边以为操作没有执行成功。对于这种有问题的设备,就必须设置US_FL_IGNORE_RESIDUE这个flag了。
而出现问题的这个三星硬盘盒就是这类需要设置的US_FL_IGNORE_RESIDUE设备,在2.6.35的kernel里已经加入了这个设备,而2.6.17的kernel里没有这个设备。
3.解决办法
找到driver/usb/storage/unusual_devs.h
第1214行插入如下
UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
"Super Top",
"IDE DEVICE",
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
编译后,下载到开发板测试
usb 1-2: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: IC25N020 Model: ATMR04-0 Rev: 0 0
Type: Direct-Access ANSI SCSI revision: 00
SCSI device sda: 39070080 512-byte hdwr sectors (20004 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
SCSI device sda: 39070080 512-byte hdwr sectors (20004 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
sda: sda1 sda2
sd 0:0:0:0: Attached scsi disk sda
能够成功挂载,问题解决。
参考文献:
http://blog.youkuaiyun.com/aaronychen/article/details/2070928