More about STALL
http://fx.damasgate.com/more-about-stall/
In other USB classes, a sender can indicate the end of a transfer
by transmitting a short packet, which is a data packet that contains
zero data bytes or any quantity fewer than wMaxPacketSize.
The mass-storage class is unique in its use of the STALL handshake
to end bulk transfers. In contrast, mass-storage devices
use STALL for this purpose and to respond to other error conditions.
After a bulk endpoint returns STALL, the endpoint is in the halt condition.
To resume communications with the endpoint, the host must issue a Clear
Feature(ENDPOINT_HALT) control request with the endpoint’s address
in the Setup transaction’s wIndex field.
Endpoint zero can also use the STALL handshake. On receiving a
Get Max LUN request, a device with a single LUN may return a STALL
to indicate that the device doesn’t support the command.
The endpoint resumes normal operation on receiving a new Setup transaction.
A mass-storage device must stall one or both bulk endpoints in these situations:
If a device sends less than the requested amount of data in the data-transport phase,
the device must stall the bulk IN endpoint.
If a received CBW isn’t valid, the device must stall the bulk IN endpoint and must
either stall the bulk OUT endpoint
or accept and discard any received data on the endpoint.
On experiencing an internal error that requires a reset, a device must
either stall the endpoint being used in any data transfer in progress and set bCSWStatus = 02h
or stall the bulk IN and bulk OUT endpoints until a reset recovery.
A mass-storage device may stall a bulk endpoints in these situations:
If a device expects to send more data than the host specified in the CBW,
after sending the requested quantity of data,
the device may stall the bulk IN endpoint.
If a device expects to receive a different quantity of
data than the host specified in the CBW,
the device may stall the bulk OUT endpoint.
If a device determinines that it can’t complete a command
during the data-transport phase, the device may stall
the bulk IN or bulk OUT endpoint as appropriate.
The thirteen cases described below have more about
the use of STALL with mass-storage commands.
Thirteen Cases for Any Situation
The mass-storage bulk-only transport specification spells out
how the host and device should behave after the host sends a command
in each of thirteen cases.
Cases 1, 6, and 12 (in bold) are the normal cases,
where the host and device each expect the same quantity
and direction of data transfer in the data-transport phase.
The other cases are situations where the host and device have differing expectations.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本