I'm no longer involved in this spec or implementation, Brian
Weischedel is the current owner, so he probably can help you more.
But I put some responses to obvious issues below.

On Thu, Apr 5, 2012 at 12:28 AM, Hardik Shah <hardik.s...@jetmobile.com> wrote:
> Hi Dan,
>
> Thanks for the Response.
>
> I tried with default control pipe to get response from the device at endpoint 
> 0. But I didn't got any response data. Please find snippet of code.
>
>                // for receiving the response
>
>                byte bmRequestTypeIN = UsbConst.REQUESTTYPE_DIRECTION_IN| 
> UsbConst.REQUESTTYPE_TYPE_CLASS | UsbConst.REQUESTTYPE_RECIPIENT_INTERFACE;
>                byte bRequest = 0x08; /* SET_REPORT */

You can't use SET_REPORT on an input request, you want GET_REPORT,
which is 0x01.

>                short wValue = 0x0300 /* Report Type and Report ID */;
>                short wIndex = 0; /* Interface */
>                byte[] bufferIN = new byte[20];
>
>                // for sending the vendor specific commands
>
>                byte bmRequestTypeOUT = UsbConst.REQUESTTYPE_DIRECTION_OUT | 
> UsbConst.REQUESTTYPE_TYPE_CLASS | UsbConst.REQUESTTYPE_RECIPIENT_INTERFACE;
>                byte bRequestOUT = 0x09; /* SET_REPORT */
>                short wValueOUT = 0x0300 /* Report Type and Report ID */;
>                short wIndexOUT = 0; /* Interface */
>                byte[] bufferOut = {} // vendor specific commands

Typically you want to actually send data with a SET_REPORT command...?

>
>
>                UsbControlIrp usbControlIrpOUT = 
> usbDevice.createUsbControlIrp(bmRequestTypeOUT, bRequestOUT, wValueOUT, 
> wIndexOUT);
>                usbControlIrpOUT.setData(bufferOut);
>
>                UsbControlIrp usbControlIrpIN = 
> usbDevice.createUsbControlIrp(bmRequestTypeIN, bRequest, wValue, wIndex);
>                usbControlIrpIN.setData(bufferIN);
>
>                list.add(usbControlIrpOUT);
>                list.add(usbControlIrpIN);

You don't need to create a list to submit (although it shouldn't
hurt).  A list is only really needed for time-sensitive urbs like
isoc.

>
>                usbDevice.asyncSubmit(list);
>                UsbControlIrp irp = (UsbControlIrp) list.get(1);
>                byte temp [] = irp.getData();

I think you're misunderstanding what the difference between
asyncSubmit and syncSubmit is.  When you asyncSubmit, you regain
control immediately.  When you syncSubmit, your thread is blocked
until the irp completes (successfully or with error).  Your code above
is getting the irp data immedaitely after asyncSubmit, which means
there is pretty much 0% chance that the device has transferred any
data yet.  If you want to write the code as above, use syncSubmit.
Alternately, if you do want to use asyncSubmit, then use a listener,
or have a thread wait for irp.waitUntilComplete().

And of course, I can't speak to whether you're actually following your
device's protocol correctly; if you don't get that right then there is
no guarantee the device will actually send you anything in response to
the GET_REPORT.

>
>        I tried with sending the commands in sequence(one after another) and 
> also with creating list of controlIrp's and then submitting, but was 
> unsuccessful. Can you please tell me what wrong I am doing here.
>
> Thanks
> shah
>
>
>
>
> -----Original Message-----
> From: ddstr...@gmail.com [mailto:ddstr...@gmail.com] On Behalf Of Dan 
> Streetman
> Sent: Wednesday, April 04, 2012 5:38 PM
> To: Hardik Shah
> Subject: Re: [javax-usb-devel] Reg: Endpoints for reading the data
>
> endpoint 0 is the "default" endpoint and not available in any
> interface (it could be argued that the usb spec says it's available in
> "all" interfaces, which is equally unhelpful).  The only access to
> endpoint 0 is the "default control pipe" which is accessed directly
> from the device, via UsbDevice.asyncSubmit(UsbControlIrp) or
> UsbDevice.syncSubmit(UsbControlIrp)
>
> On Wed, Apr 4, 2012 at 3:32 AM, Hardik Shah <hardik.s...@jetmobile.com> wrote:
>> Hi All,
>>
>>
>>
>> I am working on a code which does a read/write operation on usb Device.
>>
>>
>>
>> I am successfully able to read data at endpoint 1.     But I came across a
>> situation where I need to read data from endpoint 0. How can I achieve this.
>>
>>
>>
>> When I try to get number of endpoint for a device. I get one.
>>
>> List eps = interf.getUsbEndpoints();
>>
>> Eps.size()
>>
>>
>>
>> Please tell me how to get multiple endpoints (ep0,ep1) form device.
>>
>>
>>
>> Thanks
>>
>> Shah
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Better than sec? Nothing is better than sec when it comes to
>> monitoring Big Data applications. Try Boundary one-second
>> resolution app monitoring today. Free.
>> http://p.sf.net/sfu/Boundary-dev2dev
>> _______________________________________________
>> javax-usb-devel mailing list
>> javax-usb-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to