leo - 2011-09-10

Hi, i am trying to run the next code,

public class ReadWrite {

  private static void logData(byte data) {
    System.out.print("Data: ");
    for (int i = 0; i < data.length; i++) {
      System.out.print("0x" + Integer.toHexString(data_ & 0xff) + " ");
    }
    System.out.println();
  }

  public static void main(String args) {
     

    Device dev = USB.getDevice((short) 0x0483, (short) 0x7554);
    try {

      byte data = "atz".getBytes();
      byte readData = new byte;

      System.out.println("probando: ");
      logData(data);

      dev.open(1, 0, 2);

      //dev.writeInterrupt(0x03, data, data.length, 2000, false);

      System.out.println("conectando: "+dev.isOpen());

      //dev.writeInterrupt(0x02, data, data.length, 2000, false);

      dev.writeBulk(0x1, data, data.length, 2000, true);
      System.out.println("ya escribimos");

      // read some data from the device
      // 0x84 is the endpoint address of the IN endpoint 4 (from PC to
      // device)
      // bit 7 (0x80) is set in case of an IN endpoint
      //dev.readInterrupt(0x84, readData, readData.length, 2000, false);
      // log the data from the device
      //logData(readData);
      // close the device
      dev.close();
    } catch (USBException e) {
      // if an exception occures during connect or read/write an exception
      // is thrown
        System.out.println("Exception: "+e.getMessage());
        e.printStackTrace();
    }
  }
}

but i get:

"Exception: LibusbJava.usb_bulk_write: libusb0-dll: err  submitting request failed, win error: El parámetro no es correcto"

the device is a Smart Link USB56 and i want to send AT command for finally read the answer

Many thanks in advance_