http://social.msdn.microsoft.com/Forums/windowsdesktop/zh-CN/35620a05-43be-46a8-8cbe-846bc8295d85/usb-mass-storage-cWe have an USB mass storage / Memory Stick device with an additional device on it. We communicate with PassThrough mechanism to the device.

Normally USB spec says that on USB level not more than 64K can
send with one Bulk-Only-Transport (BOT) command to the device.
On Win7 (and earlier) the mass storage driver has split the package
automatically into smaller BOT packages if the original package
has a volume of more than 64K. 
This is currently  not longer working on Win8.
If I send an answer buffer length of more than 64k then the DeviceIoControl()
was failing with error 87 (invalid Parameter).
If I send an answer buffer less the 64K it is working.
But I need a bigger buffer because our device can send more than 64K answer contents.

Does anybody know why this was changed. 
Is that behavior wanted and if yes, why?  
Is that a bug? 
THIS_SCSI_PASS_THROUGH_DIRECT sptd;
memset(&sptd, , sizeof(THIS_SCSI_PASS_THROUGH_DIRECT));
sptd.msptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
...
sptd.msptd.DataTransferLength = cbData; // <<==== !!!
sptd.msptd.DataBuffer = pData;
// send receive command
if ( !DeviceIoControl(hDevice, IOCTL_SCSI_PASS_THROUGH_DIRECT,&sptd,
sizeof(THIS_SCSI_PASS_THROUGH_DIRECT), &sptd,
sizeof(THIS_SCSI_PASS_THROUGH_DIRECT), &cbRecvData, NULL))
{
// failed
int nErrD= (int)wbs::SystemInfo::GetLastError();// error 87 (invalid parameter)

There is a known problem in Win8 builds before 8320,
where non-page aligned transfers fail for lengths falling
within the range [(64K - 4K), 64K].

The problem is fixed in builds 8320 or later.

I'm not sure when a newer build will be generally available.
In the meantime here are a few things to try.

The following per-device setting can be used to
increase the maximum transfer length from 64K to 128K,
enabling IOCTL_SCSI_PASS_THROUGH_DIRECT to transfer
more than 64K to the device.
As an added bonus it may also increase general I/O throughput to the device.
This setting is implemented on Windows Vista and above, 
however use it with caution and thoroughly test with
a particular device to ensure the device can tolerate this change.
Some devices have been observed to have problems functioning properly
when this setting is modified.

With bit value 0x8 set on this DWORD registry value,
USBSTOR increases the maximum transfer length reported
for the specific device to 128KB. Otherwise the default value is 64KB.

HKLM\System\CurrentControlSet\Control\usbstor\VVVVPPPP
DWORD: "DeviceHackFlags"

Where “VVVV” represents the 4-digit USB Vendor ID for the device
and “PPPP” represents the 4-digit Product ID.
Leading 0’s are required. Restart the device
(e.g. enable/disable or unplug/plug) for this setting to take effect.

To obtain Vendor/Product ID for the device open device manager
and select View -> Devices by connection.
Right click on “USB Mass Storage Device”
which is the parent of the recognized disk device.
Then select Propertiesfrom the pop-up menu to bring up the Properties dialog.

From the Properties dialog, select Details tab, then Hardware Idsproperty:

Also in Windows 8, a larger maximum transfer length value
is enabled by default for USB 3.0 mass storage devices.

The problem seems to be solved with Windows 8 Build 8400.

USB Mass Storage communication with PassThrough / more than 64K data length的更多相关文章

  1. Android USB Connections Explained: MTP, PTP, and USB Mass Storage

    Android USB Connections Explained: MTP, PTP, and USB Mass Storage Older Android devices support USB ...

  2. usb mass storage device

    Problem adding USB host device to KVM Windows guest machine. Status: CLOSED CURRENTRELEASE   Aliases ...

  3. USB Mass Storage学习笔记-STM32+FLASH实现U盘

    一.内容概述  采用STM32内部自带USB控制器外加大页NAND FLASH K9F1G08U0A实现一个128M的U盘. 1.STM32的USB控制器 STM32F103的MCU自带USB从控制器 ...

  4. usb mass storage之旅

    前面总结了usb hid keyboard,现在总结usb mass storage,在枚举阶段没什么好总结的,hid和mass storage差不多,都是同样的枚举过程,但是在他们的配置描述符.接口 ...

  5. USB Mass Storage协议分析

    目录 简介 指令数据和状态协议 CBW指令格式 CSWCommand Status Wrapper状态格式 SCSI命令集 Format Unit Inquiry MODE SELECT 简介 USB ...

  6. USB mass storage协议

    这一节主要把在实现“linux模拟U盘功能”过程中的一些调试过程记录下来,并加以解析. 一.背景知识     1.USB Mass Storage类规范概述        USB 组织在univers ...

  7. 实现Linux下的U盘(USB Mass Storage)驱动

    如何实现Linux下的U盘(USB Mass Storage)驱动 版本:v0.7 How to Write Linux USB MSC (Mass Storage Class) Driver Cri ...

  8. 如何实现Linux下的U盘(USB Mass Storage)驱动

    如何实现Linux下的U盘(USB Mass Storage)驱动 版本:v0.7 How to Write Linux USB MSC (Mass Storage Class) Driver Cri ...

  9. USB Mass Storage大容量存储的基本知识

    http://www.crifan.com/files/doc/docbook/usb_disk_driver/release/htmls/ch02_msc_basic.html 目录 2.1. US ...

随机推荐

  1. file.getPath() getAbsolutePath() getCanonicalPath()区别

    package file; import java.io.File; import java.io.IOException; public class getFilePath { public sta ...

  2. git —— 分支冲突

    解决冲突 冲突需手动解决 $ git status 查看冲突的文件 <<<<<<<,=======,>>>>>>> ...

  3. SQL SERVER 比较两个数据库中表和字段的差异

    在开发过程中线上的数据库表字段和本地数据库表字段是存在的,也许我们在本地数据库中所增加的表字段都会有记录到SQL文件中,但当增加的表及字段名称较多时总会出现漏网之鱼,发布真是版本的时候回出现很多很多的 ...

  4. sql查询与修改数据库逻辑文件名,移动数据库存储路径

    USE mydb GO --1.查询当前数据库的逻辑文件名 ) ) AS 'File Name 2'; --或通过以下语句查询: --SELECT name FROM sys.database_fil ...

  5. Centos6.5安装步骤(U盘安装)

    https://blog.csdn.net/hochoy/article/details/80697454

  6. php 根据ip获取城市以及网络运营商名称(利用qqwry.dat)

    根据用户IP地址判定出所在城市以及网络运营商 qqwry.dat下载地址:http://files.cnblogs.com/guangxiaoluo/qqwry.rar  解压出来即可 //获取用户真 ...

  7. keras Variable set_value错误解决

    问题: 如: from keras import backend as K varib = K.variable(0.) new_value = np.min([0.1, 1.0]) varib.se ...

  8. loadrunner——常见函数

    loadrunner——常见函数 分类: LoadRunner 2012-04-11 20:41 703人阅读 评论(0) 收藏 举报 loadrunnersearchweb服务器脚本stringwe ...

  9. HTTP Status 500 - Request processing failed; nested exception is org.apache.ibatis.binding.BindingException

    在使用Maven工程管理工具整合SSM框架时,Mybatis使用逆向工程生成的pojo,mapper接口及映射文件,把mapper接口和映射文件放在DAO工程的同一级src/main/java目录下. ...

  10. Numpy的简单用法

    Numpy的简单用法 import numpy as np 一.创建ndarray对象 列表转换成ndarray: >>> a = [1,2,3,4,5] >>> ...