On Tue, 10 Jun 2003, Benjamin Milde wrote: >response[] is an empty buffer, created with "byte[] response = new byte[2];" >(my bMaxPacketSize is 16), >this should be ok, isn't it?
yes, 2 bytes should be ok as far as the host-side is concerned. The device will probably send a full bMaxPacketSize number of bytes, but if you only care about the first 2 you should be ok. You could try a 16-byte buffer also/instead. >also myConfig.getUsbInterfaces().size()=1 and >dev.getUsbConfigurations().size()=1, >so that you mean with "does your device by chance have more than one >configuration >and/or multiple interface alternate settings?" yep, you don't have multiple configs or alt settings...still not sure about the "didn't claim interface" messages...hmm... >I also tested also another usb implementation for java, jusb, and got the same >result: >I can send data to the device, but not get some. > >So, what can I do? I think you're doing everything ok except for the submission to the input pipe. The device is going to be much faster than your program, i.e. you're waiting until after you expect the device to send the data to actually provide the buffer, so the device may see that it's not getting polled (i.e. there's no buffer to put its data in) and just drop the data. Try submitting the 2-byte (or 16-byte) buffer before you send the out-direction commands. In fact, I would recommend that if you want to listen to an in-direction pipe you always keep at least one buffer pending on it, i.e., submit the input buffers first (they will not complete until you actually get data) and re-submit them, or new ones, as you get them back. To submit the input-direction buffer first, you either need to asyncSubmit it or syncSubmit in a dedicated Thread. If you asyncSubmit, you can either use a pipe listener, or just check the UsbIrp.isComplete() after you send the output commands. Of course I could be totally wrong here :) but assuming you've got the protocol right, that's the best thing I can think of. -- Dan Streetman [EMAIL PROTECTED] --------------------- 186,272 miles per second: It isn't just a good idea, it's the law! ------------------------------------------------------- This SF.NET email is sponsored by: eBay Great deals on office technology -- on eBay now! Click here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ javax-usb-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/javax-usb-devel