xwfang
驱动牛犊
驱动牛犊
  • 注册日期2002-08-19
  • 最后登录2004-12-12
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:961回复:0

IOCTL_EZUSB_ISO_WRITE该怎么使用?

楼主#
更多 发布于:2003-11-23 19:35
我想使用IOCTL_EZUSB_ISO_WRITE从host向device发送一些控制信息,在该命令前先有IOCTL_Ezusb_SETINTERFACE和IOCTL_Ezusb_RESETPIPE而且都返回了true,但是IOCTL_EZUSB_ISO_WRITE却老是返回false,我是不是还有什么地方不正确阿,望知道的人回一下,真的好急阿!我把我的程序代码贴在下面,请指教!
  hDevice := bOpenDevice;
  if ( hDevice <> INVALID_HANDLE_VALUE) then
    showmessage(\'Opened Driver Successfully\')
  else
  begin
    showmessage(\'Failed to Open Driver\');
    exit;
  end;
  if (hDevice <> 0)  then
  begin
   // bulkControl.pipeNum := 8;
   SetInterface.alternateSetting:=2;  //配置USB接口
   SetInterface.interfaceNum:=0;
   bResult := DeviceIoControl (hDevice,
                               IOCTL_Ezusb_SETINTERFACE,
                               @SetInterface,
                               sizeof(SET_INTERFACE_IN),
                               nil,
                               0,
                               nBytes,
                               nil);
  if bResult then
  begin
    isoControl.pipeNum := 0;
    pipeNumber := 0;
    isoControl.PacketSize := 8;
    isoControl.PacketCount := 2;
    isoControl.FramesPerBuffer := 10;
    isoControl.BufferCount := 2;
    outBuffer[0] := 68; //ox44
    OutBuffer[1] := 2;
    outPacketSize := 2;
    bResult := DeviceIoControl (hDevice,
                              IOCTL_Ezusb_RESETPIPE,
                              @pipeNumber,
                              sizeof(ULONG),
                              nil,
                              0,
                              nBytes,
                              nil);

    if bResult then
    begin
    //写下的字节数
    bResult := DeviceIoControl (hDevice,
                                IOCTL_EZUSB_ISO_WRITE,
                                @isoControl,
                                sizeof(ISO_TRANSFER_CONTROL),
                               // @outBuffer[0],
                                @outbuffer,
                                outPacketSize,
                                nBytes,
                                nil);
游客

返回顶部