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. 配置sql server 2000以允许远程访问

    配置sql server 2000以允许远程访问适合故障:1. 用sql企业管理器能访问sql server 2000(因为它是采用命名管道(named pipes)方式进行方式),但用ado.net ...

  2. BFC 从了解到放弃

    最近工作中我突然产生了一个想法,就如我们人类面临的终极问题一般,我从哪里来?我到哪里去?在撸代码进行CSS布局的时候,我会去想,我为什么这么做?,为什么浮动的元素要用overflow?,为什么要用cl ...

  3. awk调用shell命令的两种方法:system与print

    from:http://www.oklinux.cn/html/developer/shell/20070626/31550.htmlawk中使用的shell命令,有2种方法: 一.使用所以syste ...

  4. Keras中RNN不定长输入的处理--padding and masking

    在使用RNN based model处理序列的应用中,如果使用并行运算batch sample,我们几乎一定会遇到变长序列的问题. 通常解决变长的方法主要是将过长的序列截断,将过短序列用0补齐到一个固 ...

  5. 安装CDM遇到的坑

    其实主要就是一个坑,就是版本不对应的问题. 我的环境是centos6.5,而官方提供的版本是分别针对centos6和centos5的,之前我进行软件实施的时候,下载的是centos5...... ht ...

  6. (转)最短路算法--Dijkstra算法

    转自:http://blog.51cto.com/ahalei/1387799         上周我们介绍了神奇的只有五行的Floyd最短路算法,它可以方便的求得任意两点的最短路径,这称为“多源最短 ...

  7. mysql (主从复制)(proxy , Amoeba)

    原址如下: http://heylinux.com/archives/1004.html Mysql作为目前世界上使用最广泛的免费数据库,相信所有从事系统运维的工程师都一定接触过.但在实际的生产环境中 ...

  8. 基于 Laravel 开发博客应用系列 —— 设置 Linux/Mac 本地开发环境

    1.不同 Linux 发行版本的区别 不同的 Linux 发行版本之间有一些细微区别,尤其是包管理器:CentOS 和 Fedora 使用 yum 作为包管理器,而Ubuntu 使用  apt,在 O ...

  9. 【定时任务】Timer

    Java原生api Timer类就可以实现简单的定时任务.下面将简单介绍一下Timer. 一.使用 Timer 实现定时任务 具体代码如下. 可以看到我们主要是分三步进行的 1.new Timer() ...

  10. 三种显著性检测算法(SR,HFT,GBMR)

    一.谱残差(Spectral Residual, SR)  一种简单的图像显著性计算模型 http://www.cnblogs.com/CCBB/archive/2011/05/19/2051442. ...