Not clear what you are doing, but perhaps you are needing to get/set
report to a feature (wValue = 0x0301) insteadt of IN and OUT?
On Mon, 2008-08-11 at 10:49 -0400, Bourothu Rahul wrote:
> Hello,
>
> Following is a part of my code for sending SET_ and GET_REPORT's to
> the USB Device. When I try to send the GET_REPORT request after having
> sent the SET_REPORT to the DCP, i get a DCP Submission failed error.
> Could anyone tell me where the problem is?
>
> UsbConfiguration config = usbDevice.getActiveUsbConfiguration();
> List interfaces = new ArrayList();
> interfaces = config.getUsbInterfaces();
> UsbInterface interface0 = (UsbInterface)interfaces.get(0); // my
> device has only one interface, i.e, 0
> try{
> interface.claim(new UsbInterfacePolicy() {
> public boolean
> forceClaim(UsbInterface usbInterface){
> return true;
> }
> });
> UsbInterfaceDescriptor interfaceDescriptor =
> interface0.getUsbInterfaceDescriptor();
> Byte iClass = new Byte(interfaceDescriptor.bInterfaceClass());
> System.out.println("Interface Class is: " +
> iClass.toString()); // It gives me 3, meaning a HID class device
> }catch(Exception e){
> System.out.println("Interface not claimed! Exception! " +
> e.getMessage());
> }
>
> //SET_REPORT
> byte bmRequestType = 0x21; <request type for SET_REPORT>
> byte bRequest = 0x09; <SET_REPORT: 0x09>
> short wValue = 0x0201; <i/o type: OUT, 02><report number:01>
> short wIndex = 0; <Interface number :0>
> byte[] sendBuffer = {0x01,0x00,0x06,0x22,(byte)0xA0,(byte)0x85,0x00};
> <ByteStream command to be sent to the device>
> UsbControlIrp controlIrp1 =
> usbDevice.createUsbControlIrp(bmRequestType,
> bRequest,wValue,wValue,wIndex);
> controlIrp1.setData(sendBuffer);
>
> if(!sendUsbControlIrp(usbDevice, controlIrp1)){
> System.out.println("SET_REPORT Not sent successfully");
> }
> System.out.println("Bytes sent to the device for SET_REPORT: " +
> controlIrp1.getActualLength());
>
> //GET_REPORT
> byte bmRequestType = 0xA1; <request type for GET_REPORT>
> byte bRequest = 0x01; <GET_REPORT: 0x01>
> short wValue = 0x0101; <i/o type: IN, 01><report number:01>
> short wIndex = 0; <Interface number :0>
> byte[] recieveBuffer = new byte[22]; <I Assume this is the buffer
> where our requested data would come into, it is of 22 bytes>
> UsbControlIrp controlIrp2 =
> usbDevice.createUsbControlIrp(bmRequestType,
> bRequest,wValue,wValue,wIndex);
> controlIrp2.setData(sendBuffer);
>
> if(!sendUsbControlIrp(usbDevice, controlIrp2)){
> System.out.println("SET_REPORT Not sent successfully");
> }
> System.out.println("Bytes sent to the device for GET_REPORT: " +
> controlIrp2.getActualLength());
>
>
> I am not able to find out why i am not able to make the GET_REPORT
> request to the device after having sent the SET_REPORT request. Could
> anyone help me on this please!
>
> Also, my USB RFID Reader has just 1 IN_Interrupt pipe from where the
> data originates. When i issue the GET_REPORT to the DCP, do I get the
> report via the DCP or do I have to use the UsbPipe of the In_Interrupt
> pipe to read the tag information?
> Please help needed! I am stuck!
>
> Regards and thanks in advance!
>
> Rahul Bourothu
>
>
>
> On 8/7/08, Bourothu Rahul <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am using a USB RFID Reader to read the EPC code associated
> with a RFID tag on a Linux platform(using JSR80). The device
> uses ByteStream Protocol to communicate with the host. This
> protocol requires use of HID Report number 1.
> The read tag command as provided in the device specification
> is : <01><00><06><22><A0><85><00>
>
> I believe I have to use SET_REPORT(to send control) and
> GET_REPORT(to recieve data) to enable communication.
>
> In order to issue the read tag command, i am using the
> following header values(from the usb 1.1 HID specification):
>
> bmRequestType: 0x21
> bRequest: 0x09 (SET_REPORT, to the device)
> wValue: 0x0201 (<I/O Type><Report Number>)
> wIndex: 0x0000 (Interface number)
> wLength: 0x07 (Number of Bytes to send to the
> device)
> Data: <01><00><06><22><A0><85><00>
>
> I wrap this data in a UsbControlIrp, and send it to the device
> using syncSubmit method.
>
> Later i have to read the report from the device using
> GET_REPORT. For this I would use the headers as follows:
> (The INPUT Report from the device would be of size 22 bytes)
> bmRequestType: 0xA1
> bRequest: 0x01 (GET_REPORT, from the device)
> wValue: 0x0101 (<I/O Type><Report Number>)
> wIndex: 0x0000 (Interface number)
> wLength: 0x16 (Number of Bytes to be recieved
> from the device, 22 in HEX)
> Data: <empty> < I assume the data read from
> the device will be stored here>
>
> I again wrap this data in a UsbControlIrp and send it to
> the device using syncSubmit method.
> Is my approach correct or am I going wrong somewhere?
>
> Please let me know!
>
> Thank You
> Regards
> Rahul Bourothu
>
>
>
> --
> Rahul Bourothu
> School of Engineering and Applied Science,
> University of Pennsylvania,
> Philadelphia, PA - 19104
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ javax-usb-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
javax-usb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel