Menu

Unable to read but can read - bug?

Help
2009-03-19
2012-12-06
  • koya koyatan

    koya koyatan - 2009-03-19

    Hi,

    First of all, thank you for such a wonderful project!

    When I try writing to my USB device, I get the following error:

    LibusbJava.usb_interrupt_write: _usb_setup_async: invalid endpoint 0x81

    I ran the TestLibUsbJava class and got this output for my device:

      wTotalLength:         34
      bNumInterfaces:       1
      bConfigurationValue:  1
      iConfiguration:       0
      bmAttributes:         80h
      MaxPower:             50
        bInterfaceNumber:   0
        bAlternateSetting:  0
        bNumEndpoints:      1
        bInterfaceClass:    3
        bInterfaceSubClass: 0
        bInterfaceProtocol: 0
        iInterface:         0
          bEndpointAddress: 81h
          bmAttributes:     03h
          wMaxPacketSize:   7
          bInterval:        18
          bRefresh:         0
          bSynchAddress:    0

    (if you're wondering, this is exactly where it ends, no more output)

    This is what I use to open the connection:

    .open (1, 0, 0)

    Reading works perfectly with IN address 0x81.... The output doesn't even show an OUT end point address... I am not sure why that is?? I tried writing to address 0x81 but it didn't work... I tried doing an open loop from 0 to 20000 on the send port address bu same error!

    I tried both modes for sending: interrupt and bulk, and same error.

    Please help, been stuck on this for 2 days now and no clue how to proceed... Any help is highly appreciated.

    Thank you!!!!!

     
    • andi

      andi - 2009-03-21

      In the Javadoc http://libusbjava.sourceforge.net/wp/res/doc/ch/ntb/usb/Usb_Endpoint_Descriptor.html#getBEndpointAddress\() it is mentioned that bit 7 is set if this is an IN or OUT endpoint.
      So 0x81 (the endpoint in your descriptor) is an IN endpoint and the correct address is 0x81. Note that IN/OUT relates to the view of the host:
      IN: Receive data from device
      OUT: Send data from host to device

      The correct call to open is device.open(bConfigurationValue, bInterfaceNumber, bAlternateSetting). For your descriptor that is: device.open(1,0,0). So that looks fine.
      Have a look at http://sourceforge.net/forum/message.php?msg_id=5714354 to see the correct mapping. You can use ch.ntb.usb.test.TestLibUsbJava to get that output (you already did that :) ).

      Are you sure your device is capable of receiving data? From the descriptors I don't see an OUT endpoint (address e.g. 0x01) which is required for sending data to the device.
      What kind of device is it?

      BTW: there's a very helpful documentation about USB here: http://www.beyondlogic.org/usbnutshell/usb4.htm

       
      • koya koyatan

        koya koyatan - 2009-03-21

        Thanks for responding Spandi. I spent hours on this without success.

        The USB device that I am working with is a simple RFID Reader from: phidgets.com. Yes, I am sure that it is capable of receiving data because ti comes with software from its vendor that can control it with a few options. So...

        Yes I don't understand why there is no OUT endpoint displayed in the output. No idea why........

        Completely stuck. Any ideas what else I could try?

         
        • andi

          andi - 2009-03-21

          Do you have the specification of the USB interface and what commands can be sent? Very often settings are send over the control endpoint (endpoint 0) using vendor specific commands. So there's no own endpoint required.

          You can send control messages using ch.ntb.usb.Device.controlMsg(int, int, int, int, byte[], int, int, boolean)
          Here is an example of sending control messages to the device:
          ch.ntb.usb.test.DeviceTest.controlMsg()

          You could try to use an usb sniffer to see the transfer using the dlls. But maybe that information is already somewhere on the net.

           

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.