title: Linux, Java and USB
body: <p>Kind of a followup to <a href="https://stackoverflow.com/questions/23764742/unable-to-claim-interface-resource-busy/23767856#23767856">this</a> question, I have been able to:</p>
  
  <p>Find the device for with which I am working, disconnect it from the kernel, and claim the (single) interface. . . and that's about as far as I can get.</p>
  
  <p>When I try to write to the device (which is a custom wireless transceiver, not my own design), I get (when using LibUsb.bulkTransfer with the endpoint 0x00):</p>
  
  <pre><code>LibUsb.bulkTransfer(handle, (byte)0x00, bb, transfered, 5000);
  </code></pre>
  
  <p>an Input/Output error, and (when using LibUsb.bulkTransfer with the endpoint 0x81):</p>
  
  <pre><code>LibUsb.bulkTransfer(handle, (byte)0x81, bb, transfered, 5000);
  </code></pre>
  
  <p>a TimeOut error.</p>
  
  <p>I'm pretty sure I have absolutely NO idea what I'm doing here (which doesn't help my position), and this is way deeper than I am accustomed to going as far as communicating with devices on a lower level (the most I've done is interop with .Net).</p>
  
  <p>I've seen the lsusb command and executed it and gotten... a lot of stuff, and I can recognize some of it, but most of it I'm kind of lost with and was hoping for someone to hold my hand, or point me to a sort of... USB for Dummies guide that might help me figure out what I need to do.</p>
  
  <p>The end result (ideally) will be a Java package that allows cross-platform communication with the device without any sort of tinkering on behalf of the end-user (and by cross-platform I mean, windows, linux and mac, which is why I'm using the java4usb java library).</p>
  
  <p>Where I am right now is, using the output from the lsusb command, I'm hoping to be able to send commands from the transceiver to the external device with which it communicates. (basically it sends commands to a device connected to an LED that can turn the LED on and off, and make it flash, and it also can receive commands from that device and respond accordingly to them, but baby steps).</p>
  
  <p>The lsusb output you can find <a href="http://pastebin.com/AUv90fV1" rel="nofollow noreferrer">here</a> (it's quite verbose, and I didn't want to flood the question with more than necessary). Any help or direction would be tremendously appreciated.</p>
  
  <p>EDIT: A bit more research reveals (from the lsusb output) that the 0x81 endpoint is an interrupt type. Putting 2 and 2 together lead me to the conclusion that I wanted neither a bulk transfer nor a control transfer but an interrupt transfer:</p>
  
  <pre><code>  Endpoint Descriptor:
      bLength                 7
      bDescriptorType         5
      bEndpointAddress     0x81  EP 1 IN
      bmAttributes            3
        Transfer Type            Interrupt
        Synch Type               None
        Usage Type               Data
      wMaxPacketSize     0x0002  1x 2 bytes
      bInterval
  
  LibUsb.interruptTransfer(handle, (byte)0x81, bb, transfered, 1000);
  </code></pre>
  
  <p>Unfortunately I'm still getting a Timeout error.</p>
  
  <p>EDIT: Some more information is needed:</p>
  
  <p>It has been suggested for Synchronous control (which is fine for half of what I need to do) that I should use the usb4java.LibUsb controlTransfer method, which is fine but there are several parameters that need to be filled, and I do not know what it is with that they need to be filled:</p>
  
  <pre><code>public static int controlTransfer(DeviceHandle handle, //I know this.
                byte bmRequestType, //&lt;--- What goes here?
                byte bRequest,      //&lt;--- What goes here?
                short wValue,       //&lt;--- What goes here?
                short wIndex,       //&lt;--- What goes here?
                ByteBuffer data,    //&lt;--- What goes here?
                long timeout)       //&lt;--- What goes here?
  </code></pre>
  
  <p>Any and all direction to the answer to what I need to populate these fields with would be a great help and greatly appreciated.</p>