21 Apr 2009 15:53
Re: My Code
Dan Streetman <ddstreet <at> ieee.org>
2009-04-21 13:53:11 GMT
2009-04-21 13:53:11 GMT
I don't know what you are trying to do, so I can't say if it's right or wrong.
2009/4/17 Hsieh Dinow <dinow46 <at> gmail.com>:
> 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 <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>
------------------------------------------------------------------------------
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 <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
RSS Feed