On Thu, Oct 22, 2009 at 4:05 PM, Andre Juffer <ajuf...@sun3.oulu.fi> wrote:
> Hi,
>
> Sorry to bother you again. I am still messing with the second
> case/example that I explained in previous emails. On a positive note,
> all standard requests work now without any problems.

good.

> For your information. I am dealing with USB base station that receives
> signals from 'nodes' (sensors). To check that the communication between
> the station and node is up, there is a 'short ping' command. The manual
> says:
>
> Command byte: 0x02
> Command data:
>   byte 1: node address (MSB)
>   byte 2: node address (LSB)
> Response success:
>   byte 1: 0x02  (2)
> Response fail:
>   Byte 1: 0x21  (33)

That isn't enough information.  It doesn't specify what pipe(s) to use
for communication, and if the DCP is supposed to be used it doesn't
specify what the setup packet fields should be.

> I an trying to this working with the default (control) pipe. I have
> switched off the node, so pinging the node should result in response
> fail. I have tried many things, among other things the following test code:
>
> <code>
> UsbDevice usbDevice = ...;
> int nodeAddress = 111;  // Given by sensor, cannot change.
>
> byte bmRequestType =
>   UsbConst.REQUESTTYPE_DIRECTION_IN | UsbConst.REQUESTTYPE_TYPE_VENDOR |
>   UsbConst.REQUESTTYPE_RECIPIENT_ENDPOINT;
> byte bRequest = (byte)0x02;   // Command byte.
> short wValue = 0;
> short wIndex = 0;
> UsbControlIrp usbControlIrp =
>     usbDevice.createUsbControlIrp(bmRequestType, bRequest,
>                                   wValue, wIndex);
>
> byte[] data = new byte[2];    // Holds command data.
> data[0] = 0;   // MSB node number.
> data[1] = 111; // LSB node number.
> usbControlIrp.setData(data);
> usbDevice.syncSubmit(usbControlIrp);
> </code>

Does your spec specify those setup packet values or did are you just
guessing that you should use the DCP and making up setup packet
values?

> OUTPUT/RESPONSE (from simple listened attach to usbDevice):
> UsbDeviceDataLogger  - Number of bytes transferred: 2
> UsbDeviceDataLogger  - Content of data:
> data[0] = 32
> data[1] = 0

Again, not enough information.  What pipe are you getting this "response" from?

> Whatever I do, I never get the fail response (pretty much always the
> same response). The usbControlIrp must be wrong, but I simply do not
> understand how to get the command byte and command data to the device
> and to get the device responding appropriately. Note again, all standard
> requests work perfectly fine.

Unless your device spec has more information that you haven't shared,
you do not have enough info to successfully communicate with your
device.

>
> Thanks again for your help.
> --
> Andre H. Juffer              | Phone: +358-8-553 1161
> Biocenter Oulu and           | Fax: +358-8-553-1141
> Department of Biochemistry   | Email: andre.juf...@oulu.fi
> University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
> StruBioCat                   | WWW: www.strubiocat.oulu.fi
> NordProt                     | WWW: www.nordprot.org
> Triacle Biocomputing         | WWW: www.triacle-bc.com
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> javax-usb-devel mailing list
> javax-usb-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to