UsbDevice upsUsbDevice =
findUPS();                                                       //Find out
USBDevice
  if(upsUsbDevice == null){
   System.err.println("There is no any USB to Serial cable attached!");
  }
  UsbConfiguration config =
upsUsbDevice.getActiveUsbConfiguration();         //USBDevice =>
USBConfiguration
  UsbInterface theInterface =
config.getUsbInterface((byte)0);                        //USBConfiguration
=> USBInterface

  byte bmRequestType =UsbConst.REQUESTTYPE_DIRECTION_OUT
|UsbConst.REQUESTTYPE_TYPE_STANDARD | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE;
  byte bRequest = UsbConst.REQUEST_SET_FEATURE;
  short wValue = UsbConst.DESCRIPTOR_TYPE_DEVICE << 8;
  short wIndex = 0;
  byte[] buffer = new byte[]{0,96,9,0,0,3};
  UsbControlIrp usbControlIrp
=upsUsbDevice.createUsbControlIrp(bmRequestType, bRequest, wValue, wIndex);
  usbControlIrp.setData(buffer);
  upsUsbDevice.syncSubmit(usbControlIrp);

//Is any wrong ?
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
javax-usb-devel mailing list
javax-usb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to