matthewlee
驱动牛犊
驱动牛犊
  • 注册日期2002-11-03
  • 最后登录2003-11-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:957回复:0

关于USB选择配置的问题,急求大家帮忙看看!

楼主#
更多 发布于:2003-09-13 16:06
感觉应该是很基本的操作啊,搞不懂为何不成功,请教大虾。

后面是我的代码,通过USBD_ParseConfigurationDescriptorEx可以得到非NULL的id,我看了一下,也是对的,比如: 09 04 00 00 03 00 00 00 05

可是CallUSBDI得到的status却是不成功的:
status:                C000000D
urb->UrbHeader.Status: 80000500

请问是什么原因。
或者有文档介绍NTSTATUS错误码的吗?如何通过上述status码来查错误原因啊?

很急,多谢大家了!

NTSTATUS UsbSelectConfiguration( IN PUSBKBD_DEVICE_EXTENSION dx)
{
dx->UsbPipeHandle = NULL;

PUSB_CONFIGURATION_DESCRIPTOR Descriptors = NULL;
ULONG size;
NTSTATUS status = UsbGetConfigurationDescriptors( dx, Descriptors, 0, size);
if( !NT_SUCCESS(status))
{
FreeIfAllocated(Descriptors);
return status;
}

PUSB_INTERFACE_DESCRIPTOR id = USBD_ParseConfigurationDescriptorEx(
Descriptors, Descriptors, 0, -1, -1, -1, -1);
if( id==NULL)
{
FreeIfAllocated(Descriptors);
return STATUS_NO_SUCH_DEVICE;
}

USBD_INTERFACE_LIST_ENTRY ilist[2];
ilist[0].InterfaceDescriptor = id;
ilist[0].Interface = NULL;
ilist[1].InterfaceDescriptor = NULL;

        PURB urb = USBD_CreateConfigurationRequestEx( Descriptors, ilist);

status = CallUSBDI( dx, urb);

if( !NT_SUCCESS(status) || !USBD_SUCCESS( urb->UrbHeader.Status ))
{
status = STATUS_UNSUCCESSFUL;
}
else
{
            //......
  }

FreeIfAllocated(urb);
FreeIfAllocated(Descriptors);
return status;
}
游客

返回顶部