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.

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)

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>

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

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.

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

Reply via email to