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. JMeter接口&性能测试

    JMeter接口测试 目前最新版本发展到5.0版本,需要Java7以上版本环境,下载解压目录后,进入\apache-jmeter-5.0\bin\,双击ApacheJMeter.jar文件启动JMem ...

  2. (转载)使用SQL-Server创建一个银行数据管理系统Ⅰ

    首先,要创建一个完整的数据管理系统,不是一蹴而就的,一定要要一步一步的来,不断完善,最终方能达到自己想要的结果,所以我在这里也是一点一点分步来做的. 创建数据库,数据库属性在这里用的是默认(不推荐使用 ...

  3. Fix Valgrind's must-be-redirected error in Gentoo

    Last week, I tried to use Valgrind to identify potential memory related bugs, since segmentation fau ...

  4. 20165203 学习基础和C语言基础调查

    一.技能学习经验及体会 对于课外技能来说,我对很多领域都略知一二,但涉足不深,例如体育领域.摄影领域.绘画领域.书法领域等等,我所能拿得出手的就是体育领域的乒乓球了.娄老师的作业题目让我的思绪又回到了 ...

  5. git/github 生成密钥

    当从本地提交文件到github的时候,提交不成功,报错,可能问题就是你还没有生成ssh秘钥 github要使用ssh密钥的原因: git使用https协议,每次pull, push都要输入密码,相当的 ...

  6. CCF CSP 201709-4 通信网络

    CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201709-4 通信网络 问题描述 某国的军队由N个部门组成,为了提高安全性,部门之间建立了M ...

  7. js把json数据转化成树形数据

    /*转化函数*/ function(data, attributes) { let resData = data; let tree = []; for(let i = 0; i < resDa ...

  8. QT STUDY 模型-视图-控制器

  9. 磁盘清理-安全转移C盘中软件的缓存文件

    C盘飘红啦~~~ 安装软件时,默认会安装到C盘,并不会特意去改(尤其C盘是固态硬盘时).或者,根本就没有给你修改的机会. 可是啊,有些软件的缓存数据目录会比较大,实在太占C盘空间.想移出去,但又不想重 ...

  10. sublime3176注册码破解汉化及常用插件

    官方网站下载地址:https://www.sublimetext.com/3 破解软件下载地址:https://www.lanzous.com/i1a7zfi 破解软件下载地址备用:https://d ...