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. P2733 家的范围 Home on the Range

    又是一校内模拟赛见的题 不知道为什么出题人怎么这么喜欢USACO的Farmer John的他的牛... 感觉这道题不是特别的难,但也不很水 同机房的神仙们都说这个题是一道二维前缀和的裸题,但我当时的确 ...

  2. 洛谷P3811乘法逆元

    传送门 线性递推 #include <iostream> #include <cstdio> #include <cstring> #include <alg ...

  3. MySQL学习笔记:生成时间维度表2

    实现目的: 测试: # 测试 加一秒 SECOND), INTERVAL SECOND); SECOND),'%H%i%s');# 第一秒 SECOND),'%H%i%s');# 最后一秒 SELEC ...

  4. GridView练习题

    package com.example.wang.myapplication; import android.os.Bundle; import android.support.v7.app.AppC ...

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

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

  6. 最小圆覆盖 gym-102006 I

    #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk mak ...

  7. 移动端自动化测试(二)之 Appium常用的API(python)函数介绍

    上一章节已经介绍了Appium的环境搭建,其实只要掌握了Appium的工作原理,前期的准备工作和安装过程是比较简单的.那么当我们搭建好Appium环境后接下来做些什么呢?通常思路是开始appium的第 ...

  8. 43:n个骰子的点数

    算法分析: 算法1.基于递归求色子点数,时间效率不高 现在我们考虑如何统计每一个点数出现的次数.要向求出n个骰子的点数和,可以先把n个骰子分为两堆:第一堆只有一个,另一个有n-1个.单独的那一个有可能 ...

  9. Redis的安装与部署(CentOS6.5)

    一.下载安装包 wget http://redis.googlecode.com/files/redis-2.4.5.tar.gz 二.编译源程序 tar -zxvf redis-2.4.5.tar. ...

  10. caffe 如何训练自己的数据图片

    申明:此教程加工于caffe 如何训练自己的数据图片 一.准备数据 有条件的同学,可以去imagenet的官网http://www.image-net.org/download-images,下载im ...