USB -- scsi命令集

摘自:《圈圈教你玩usb》 241页

SCSI(small computer system interface)是小型计算机系统的缩写,有一套完整的协议规定其命令和命令数据的响应。scsi的命令有很多,但u盘中常用的就几个:INQUIRY,READ CAPACITY , READ(10),WRITE(10)等命令。

 

 

 

 

下面会一个一个总结。

 U盘需要处理的命令如下:

 1:inquiry:设备的一个描述,告诉host你的设备是什么,名字叫什么,用的什么协议,这里用的SCSI协议—SPC2

2:READ FORMAT CAPACITIES:读格式容量(The READ FORMAT CAPACITIES command allows the host to request a list of the possible capacities that can be formatted on the currently installed medium.)

3:READ CAPACITY:读取容量信息

4:READ(10):回发在逻辑单元的数据,既回发MBR(Main Boot Record)主引导扇区

5:SENSE6:目的在于获得设备内部很多潜在的信息,其中包括了是否设置了写保(The MODE SENSE(6) command (see table 62) provides a means for a device server to report parameters to an application client. It is a complementary command to the MODE SELECT(6) command. Device servers that implement the MODE SENSE(6) command shall also implement the MODE SELECT(6) command.)

6:WRITE(10):host向slave发生数据并写在u盘存储器里面。

7:TEST UNIT READY:检查U盘准备好没有。

posted @ 2016-08-30 19:47  prayer521  阅读(2684)  评论(0编辑  收藏  举报