foocie
驱动牛犊
驱动牛犊
  • 注册日期2009-09-01
  • 最后登录2011-02-20
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望151点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:3428回复:1

求助,有写过USB智能卡读卡器驱动的兄弟吗?

楼主#
更多 发布于:2009-11-28 22:03
刚接触USB接口的智能卡驱动,最近碰到一个问题,怎么也解决不了。
在驱动中调用WdfUsbTargetPipeReadSynchronously,总是会报c00000b5(STATUS_IO_TIMEOUT)的错误,下面是我输出的调试信息:
------加载驱动
PCSC_EvtDeviceAdd: Enter
PCSC_EvtDeviceAdd: Register close callback
PCSC_EvtDeviceAdd: Initialize attributes and a context area for the device object
PCSC_EvtDeviceAdd: Device create
PCSC_EvtDeviceAdd: Set pnp capabilities
PCSC_EvtDeviceAdd: Get Device Extension
PCSC_EvtDeviceAdd: InterlockedIncrement - ff522b00
PCSC_EvtDeviceAdd: Add an extra stack location
PCSC_EvtDeviceAdd: tell the interface
PCSC_EvtDeviceAdd: parallel queue create
PCSC_EvtDeviceAdd: EvtIoDeviceControl regist
PCSC_EvtDeviceAdd: WdfDeviceConfigureRequestDispatching
PCSC_EvtDeviceAdd: manual queue
PCSC_EvtDeviceAdd: WDF_INTERRUPT_CONFIG_INIT
PCSC_EvtDeviceAdd: PscrRegisterWithSmcLib
PscrRegisterWithSmcLib: Enter
PscrRegisterWithSmcLib: ReaderExtension
PscrRegisterWithSmcLib: vendor attribute
PscrRegisterWithSmcLib: vendor name - PSCR
PscrRegisterWithSmcLib: ifd type - USB Reader
PscrRegisterWithSmcLib: DeviceInstanceNo - 1
PscrRegisterWithSmcLib: Card Initialize
PscrRegisterWithSmcLib: SmartCardCreateLink linkName - 2c002a
PscrRegisterWithSmcLib: Exit
PCSC_EvtDeviceAdd: Exit
EvtDevicePrepareHardware: begins
EvtDevicePrepareHardware: select interface
SelectInterfaces: Enter
SelectInterfaces: Interrupt Pipe - 005C70F0
SelectInterfaces: Write Pipe - 0064B240
SelectInterfaces: Read Pipe - 00AC3D18
SelectInterfaces: Exit
CBGetICCState: Enter
CBGetICCState: Exit
EvtDevicePrepareHardware: Exit
PscrEvtDeviceD0Entry: Enter
CBUpdateCardState: Enter - 0
CBUpdateCardState: Smartcard - inserted
CBUpdateCardState: Enter
PscrEvtDeviceD0Entry: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_ATTRIBUTE, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_ATTRIBUTE, ATTRIBUTE - 60150
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff52b008
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_ATTRIBUTE, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_ATTRIBUTE, ATTRIBUTE - 10100
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff52b008
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_ATTRIBUTE, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_ATTRIBUTE, ATTRIBUTE - 10101
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff52b008
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_ATTRIBUTE, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_ATTRIBUTE, ATTRIBUTE - 7fff0001
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff52b008
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_IS_PRESENT, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_IS_PRESENT
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff5233b8
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_STATE, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_STATE, STATE - 0
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff5233b8
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_POWER, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, irp - ff5233b8
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, POWER CODE - 1
CBICCPower: Enter, Request - ColdReset
CmdICCPowerOn: Enter
READ_USB_BULK: Read Failed with status - 0xc00000b5
^^^^^^^^^^^^^有问题的地方
CmdICCPowerOn: Read Error - c00000b5
CmdICCPowerOn: Exit
CBICCPower: Exit c00000b5
PscrSmcLibComplete: Enter, Called - c00000b5
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff5233b8
PscrEvtIoDeviceControl: SmartcardDeviceControl status - c00000b5
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_POWER, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, irp - ff5233b8
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, POWER CODE - 1
PscrSmcLibComplete: Enter, Called - c0000184
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff5233b8
PscrEvtIoDeviceControl: SmartcardDeviceControl status - c0000184
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_POWER, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, irp - ff5233b8
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_POWER, POWER CODE - 1
PscrSmcLibComplete: Enter, Called - c0000184
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff5233b8
PscrEvtIoDeviceControl: SmartcardDeviceControl status - c0000184
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_IS_ABSENT, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_IS_ABSENT
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff9792e0
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_IS_PRESENT, Request - 0xac0718
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_IS_PRESENT
CBCardTracking: Enter
CBCardTracking: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff9792e0
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 103
PscrEvtIoDeviceControl: Exit
----卸载驱动
PscrEvtIoDeviceControl: Enter, called - IOCTL_SMARTCARD_GET_STATE, Request - 0x7eacc0d0
PscrEvtIoDeviceControl: IOCTL_SMARTCARD_GET_STATE, STATE - 0
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff9cfb10
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: Exit
PscrEvtIoCanceledOnQueue: Enter
PscrEvtIoCanceledOnQueue: InterlockedExchangePointer
PscrEvtIoCanceledOnQueue: Exit
PscrEvtFileCleanup: Enter
PscrEvtFileCleanup called
PscrEvtFileCleanup: Exit
PscrEvtDeviceD0Exit: Enter
PscrEvtDeviceD0Exit: WdfPowerDeviceD3Final
PscrEvtDeviceD0Exit: Exit
EvtDeviceReleaseHardware: Enter
EvtDeviceReleaseHardware: Exit
PscrEvtDeviceContextCleanup: Enter
PscrEvtDeviceContextCleanup: InterlockedDecrement - ff522b00
PscrEvtDeviceContextCleanup: Exit
foocie
驱动牛犊
驱动牛犊
  • 注册日期2009-09-01
  • 最后登录2011-02-20
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望151点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2009-11-28 22:03
另外,如果我在WdfDeviceCreateDeviceInterface的时候不使用&SmartCardReaderGuid,而是自己随即创建一个GUID的话,同样的PowerOn是可以执行,并正确返回的。下面是输出的调试信息:
----设备加载
PCSC_EvtDeviceAdd: Enter
PCSC_EvtDeviceAdd: Register close callback
PCSC_EvtDeviceAdd: Initialize attributes and a context area for the device object
PCSC_EvtDeviceAdd: Device create
PCSC_EvtDeviceAdd: Set pnp capabilities
PCSC_EvtDeviceAdd: Get Device Extension
PCSC_EvtDeviceAdd: InterlockedIncrement - ff0bc788
PCSC_EvtDeviceAdd: Add an extra stack location
PCSC_EvtDeviceAdd: tell the interface
PCSC_EvtDeviceAdd: parallel queue create
PCSC_EvtDeviceAdd: EvtIoDeviceControl regist
PCSC_EvtDeviceAdd: WdfDeviceConfigureRequestDispatching
PCSC_EvtDeviceAdd: manual queue
PCSC_EvtDeviceAdd: WDF_INTERRUPT_CONFIG_INIT
PCSC_EvtDeviceAdd: PscrRegisterWithSmcLib
PscrRegisterWithSmcLib: Enter
PscrRegisterWithSmcLib: ReaderExtension
PscrRegisterWithSmcLib: vendor attribute
PscrRegisterWithSmcLib: vendor name - PSCR
PscrRegisterWithSmcLib: ifd type - USB Reader
PscrRegisterWithSmcLib: DeviceInstanceNo - 1
PscrRegisterWithSmcLib: Card Initialize
PscrRegisterWithSmcLib: SmartCardCreateLink linkName - 2c002a
PscrRegisterWithSmcLib: Exit
PCSC_EvtDeviceAdd: Exit
EvtDevicePrepareHardware: begins
EvtDevicePrepareHardware: select interface
SelectInterfaces: Enter
SelectInterfaces: Interrupt Pipe - 00C984F8
SelectInterfaces: Write Pipe - 00F488A0
SelectInterfaces: Read Pipe - 00F489A8
SelectInterfaces: Exit
CBGetICCState: Enter
CBGetICCState: Exit
EvtDevicePrepareHardware: Exit
PscrEvtDeviceD0Entry: Enter
CBUpdateCardState: Enter - 0
CBUpdateCardState: Smartcard - inserted
CBUpdateCardState: Enter
PscrEvtDeviceD0Entry: Exit
----响应程序发送请求
PscrEvtIoDeviceControl: Enter, called - Unknow_ioctl, Request - 0x7eacc0d0
PscrEvtIoDeviceControl: SmartcardAcquireRemoveLock, status - 0
PscrGenericIOCTL: Enter
PscrGenericIOCTL: PCSC_POWER_ON
CmdICCPowerOn: Enter
CmdICCPowerOn: Read Success - 0, size - c
CmdICCPowerOn: Exit
PscrGenericIOCTL: Exit
PscrSmcLibComplete: Enter, Called - 0
PscrSmcLibComplete: Exit
PscrEvtIoDeviceControl: SmartcardDeviceControl irp - ff9d6008
PscrEvtIoDeviceControl: SmartcardDeviceControl status - 0
PscrEvtIoDeviceControl: SmartcardReleaseRemoveLock, status - 0
PscrEvtIoDeviceControl: Exit
游客

返回顶部