1 Reply Latest reply on Jul 18, 2013 5:13 AM by gaya

    DeviceIOControl and Linux libusb/cyusb libraries

    oleg.mironov

      Hello!

         

      The problem is, that I'm trying to rewrite my existing Windows program to Linux. The program uses DeviceIoControl() function to communicate with the CY7C68013A controller. I used it like this:
                 
                  VENDOR_OR_CLASS_REQUEST_CONTROL    myRequest;
                  int nBytes = 0;
                  myRequest.direction = 0x00;
                  myRequest.index = 0xBEEF;
                  myRequest.recepient = 0x00;
                  myRequest.request = 0xA2;
                  myRequest.requestType = 0x02;
                  myRequest.requestTypeReservedBits = 0x01;
                  myRequest.value = 0x007F & addr_I2C;
                 
                  DeviceIoControl (handle,
                                                 IOCTL_EZUSB_VENDOR_OR_CLASS_REQUEST,
                                                 &myRequest,
                                                 sizeof(VENDOR_OR_CLASS_REQUEST_CONTROL),
                                                 buffer,
                                                 bufferSize,
                                                 (unsigned long *)&nBytes,
                                                 NULL);

      to set some control data into the device, and

                      BULK_TRANSFER_CONTROL bulkControl;
                      DWORD ioctl_val = IOCTL_EZUSB_BULK_READ;
                      int nBytes = 0;
                      bulkControl.pipeNum = 2;
                      DeviceIoControl (handle,
                                                      ioctl_val,
                                                     &bulkControl,
                                                     sizeof (BULK_TRANSFER_CONTROL),
                                                     buffer,
                                                     MAX_DATA_SIZE,
                                                     (unsigned long *)&nBytes,
                                                     NULL);

      to get some bulk data from the device.
      Now I'd like to rewrite these code fragments to Linux using libusb or cyusb libraries. Could you help me, please, to find any information source that shows the existing code analogs of Win32 and Linux libusb/cyusb for the CY7C68013A controller programming?