2024年4月6日发(作者:子车锦)
如何实现Linux下的U盘(USB Mass Storage)驱动
How to Write Linux USB MSC (Mass Storage Class) Driver
版本: 0.4
作者: crifan
联系方式:green-waste (at)
版本历史
版本
0.4
时间
2011-07-01
内容更新
1.介绍如何在Linux下实现U盘驱动
作者
crifan
目录
1
正文之前 ......................................................................................................................... 6
1.1
1.2
1.3
2
2.1
2.2
2.3
3
3.1
本文目的 ................................................................................................................. 6
阅读此文所需要的前提知识 ................................................................................ 7
声明 ......................................................................................................................... 7
USB的硬件 ............................................................................................................ 8
USB相关的协议 .................................................................................................... 8
USB相关的软件实现 ........................................................................................... 8
USB Mass Storage相关的协议 ..................................................................... 13
3.1.1.1
3.1.1.2
USB MSC Control/Bulk/Interrupt (CBI) Transport ............... 14
USB MSC Bulk-Only (BBB) Transport ....................................... 15
USB基本知识 ................................................................................................................ 8
USB Mass Storage大容量存储的基本知识 ........................................................... 9
3.1.1
USB Mass Storage相关协议简介 ............................................................ 14
3.1.1.2.1
为何USB MSC中Bulk-only Transport被叫做 BBB .......... 15
3.1.1.2.2
为何已经有了CBI,又再弄出个BBB ........................................ 15
3.1.1.3
3.1.1.4
3.1.1.5
3.1.1.6
3.1.1.7
USB MSC UFI Command Specification .................................... 16
USB MSC Bootability Specification ........................................... 16
USB MSC Compliance Test Specification ............................... 17
USB Lockable Storage Devices Feature Specification ........ 17
USB MSC USB Attached SCSI Protocol (UASP) ..................... 17
3.1.1.7.1
已有SCSI协议,为何还要再弄一个UASP .............................. 17
3.1.2
USB MSC的各个协议之间关系总结 ......................................................... 19
3.1.3
U盘与USB中的Class,Subclass和Protocol的对应关系 .............. 20
3.1.3.1
3.1.3.2
3.1.3.3
3.2
4
5
bInterfaceClass=0x08=Mass Storage ...................................... 21
bInterfaceSubClass=0x06=SCSI Transparent ........................ 21
bInterfaceProtocol=0x50=Bulk Only Transport ................... 21
USB Mass Storage相关的软件实现 ............................................................. 22
实现U盘驱动的整个流程是什么样的 .................................................................... 23
Linux系统下,USB驱动的框架已经做了哪些事情 ............................................ 24
2024年4月6日发(作者:子车锦)
如何实现Linux下的U盘(USB Mass Storage)驱动
How to Write Linux USB MSC (Mass Storage Class) Driver
版本: 0.4
作者: crifan
联系方式:green-waste (at)
版本历史
版本
0.4
时间
2011-07-01
内容更新
1.介绍如何在Linux下实现U盘驱动
作者
crifan
目录
1
正文之前 ......................................................................................................................... 6
1.1
1.2
1.3
2
2.1
2.2
2.3
3
3.1
本文目的 ................................................................................................................. 6
阅读此文所需要的前提知识 ................................................................................ 7
声明 ......................................................................................................................... 7
USB的硬件 ............................................................................................................ 8
USB相关的协议 .................................................................................................... 8
USB相关的软件实现 ........................................................................................... 8
USB Mass Storage相关的协议 ..................................................................... 13
3.1.1.1
3.1.1.2
USB MSC Control/Bulk/Interrupt (CBI) Transport ............... 14
USB MSC Bulk-Only (BBB) Transport ....................................... 15
USB基本知识 ................................................................................................................ 8
USB Mass Storage大容量存储的基本知识 ........................................................... 9
3.1.1
USB Mass Storage相关协议简介 ............................................................ 14
3.1.1.2.1
为何USB MSC中Bulk-only Transport被叫做 BBB .......... 15
3.1.1.2.2
为何已经有了CBI,又再弄出个BBB ........................................ 15
3.1.1.3
3.1.1.4
3.1.1.5
3.1.1.6
3.1.1.7
USB MSC UFI Command Specification .................................... 16
USB MSC Bootability Specification ........................................... 16
USB MSC Compliance Test Specification ............................... 17
USB Lockable Storage Devices Feature Specification ........ 17
USB MSC USB Attached SCSI Protocol (UASP) ..................... 17
3.1.1.7.1
已有SCSI协议,为何还要再弄一个UASP .............................. 17
3.1.2
USB MSC的各个协议之间关系总结 ......................................................... 19
3.1.3
U盘与USB中的Class,Subclass和Protocol的对应关系 .............. 20
3.1.3.1
3.1.3.2
3.1.3.3
3.2
4
5
bInterfaceClass=0x08=Mass Storage ...................................... 21
bInterfaceSubClass=0x06=SCSI Transparent ........................ 21
bInterfaceProtocol=0x50=Bulk Only Transport ................... 21
USB Mass Storage相关的软件实现 ............................................................. 22
实现U盘驱动的整个流程是什么样的 .................................................................... 23
Linux系统下,USB驱动的框架已经做了哪些事情 ............................................ 24