0 Replies Latest reply: Oct 18, 2010 6:14 AM by 596581 RSS

    usb.windows.USBException: JNI :jusb - ERROR : Unable to read the data !

    596581
      Hi All,

      We are using JUSB API to read data from USB Port. When tried to execute the code we are getting the exception like

      usb.windows.USBException: JNI :jusb - ERROR : Unable to read the data !
      0 [0]
      at usb.windows.JUSB.doInterruptTransfer(Native Method)
      at usb.windows.JUSB.readIntr(JUSB.java:225)
      at usb.cor.EndPoint.recvInterrupt(EndPoint.java:245)


      The code we are using to read the data is as follows

      try
      {
      Host host = HostFactory.getHost();
      Bus bus[] = host.getBusses();
      int total_bus = bus.length;
      for(int i = 0; i < total_bus; i++)
      {
      Device root = bus.getRootHub();
      int total_port = root.getNumPorts();
      label0:
      for(int j = 1; j <= total_port; j++)
      {
      Device device = root.getChild(j);
      if(device == null)
      continue;
      System.out.println("Yes");
      Configuration config = device.getConfiguration();
      DeviceDescriptor dd = device.getDeviceDescriptor();
      int total_interface = config.getNumInterfaces();
      if(!Integer.toHexString(dd.getVendorId()).equals("b67") || !Integer.toHexString(dd.getProductId()).equals("555e"))
      continue;
      int k = 0;
      do
      {
      if(k >= total_interface)
      continue label0;
      Interface itf = config.getInterface(k, 0);
      int total_ep = itf.getNumEndpoints();
      for(int l = 0; l < total_ep; l++)
      {
      Endpoint ep = itf.getEndpoint(l);
      String io_type = ep.getType();
      boolean input = ep.isInput();
      if(!input)
      continue;
      byte b[] = ep.recvInterrupt();
      System.out.println("byte length :" + b.length);
                
      ...........
      ..........



      and getting exception at the lline: byte b[] = ep.recvInterrupt();

      This code works fine with pure USB devices but now we are trying with USB Powered device(USB + Power).
      Please help us in resolving this exception.

      Thanks In Advance
      Eswari