2 Replies Latest reply on Jun 15, 2018 9:31 AM by jeea_1580276

    Migrating from ezusb.sys to cyusb3.sys

      So I am trying to get my host application to work with the new cyusb3.sys. As mentioned in the PDF, some of the IOCTL definitions have changed. I am not a coder and am just the tech trying to get it to work. I have all the source code etc...

       

      I could use some help with changing the code. Here is the IOCTL code from the host application.

      ' ************************************

      '        IOCTL Definitions

      ' ************************************

      ' Set the base of the IOCTL control codes

      Private Const Ezusb_IOCTL_INDEX = &H800

       

      ' (DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)

      ' note: DeviceType for each control code is FILE_DEVICE_UNKNOWN

      '       FILE_DEVICE_UNKNOWN * 2^16 = &H220000

      '       'Access' = FILE_ANY_ACCESS = 0

       

      Public Const IOCTL_Ezusb_GET_PIPE_INFO = &H220000 + METHOD_BUFFERED + (Ezusb_IOCTL_INDEX + 0) * 4

      Public Const IOCTL_Ezusb_GET_DEVICE_DESCRIPTOR = &H220000 + METHOD_BUFFERED + (Ezusb_IOCTL_INDEX + 1) * 4

       

      Public Const IOCTL_EZUSB_BULK_READ = &H220000 + METHOD_OUT_DIRECT + (Ezusb_IOCTL_INDEX + 19) * 4

      Public Const IOCTL_EZUSB_BULK_WRITE = &H220000 + METHOD_IN_DIRECT + (Ezusb_IOCTL_INDEX + 20) * 4

       

       

      Public Const IOCTL_Ezusb_RESETPIPE = &H220000 + METHOD_IN_DIRECT + (Ezusb_IOCTL_INDEX + 13) * 4

      Public Const IOCTL_Ezusb_ABORTPIPE = &H220000 + METHOD_IN_DIRECT + (Ezusb_IOCTL_INDEX + 15) * 4

      Public Const IOCTL_Ezusb_SETINTERFACE = &H220000 + METHOD_BUFFERED + (Ezusb_IOCTL_INDEX + 16) * 4

       

      '---- Usage

      'result = DeviceIoControl(hUSB, IOCTL_Ezusb_RESETPIPE, PipeNumber, 0, 0, 0, lBytesReturned, 0)

      'result = DeviceIoControl(hUSB, IOCTL_Ezusb_ABORTPIPE, PipeNumber, 0, 0, 0, lBytesReturned, 0)

      'result = DeviceIoControl(hUSB, IOCTL_Ezusb_SETINTERFACE, tSetInterfaceIn, Len(tSetInterfaceIn), 0, 0, lBytesReturned, 0)

       

      '#define IOCTL_Ezusb_RESETPIPE  CTL_CODE(FILE_DEVICE_UNKNOWN,  \

      '                                                   Ezusb_IOCTL_INDEX+13,\

      '                                                   METHOD_IN_DIRECT,  \

      '                                                   FILE_ANY_ACCESS)

      '

      '#define IOCTL_Ezusb_ABORTPIPE  CTL_CODE(FILE_DEVICE_UNKNOWN,  \

      '                                                   Ezusb_IOCTL_INDEX+15,\

      '                                                   METHOD_IN_DIRECT,  \

      '                                                   FILE_ANY_ACCESS)

      '

      '#define IOCTL_Ezusb_SETINTERFACE  CTL_CODE(FILE_DEVICE_UNKNOWN,  \

      '                                                   Ezusb_IOCTL_INDEX+16,\

      '                                                   METHOD_BUFFERED,  \

      '                                                   FILE_ANY_ACCESS)