Friday, June 3, 2011

[android-developers] Re: usb MissileLauncher

What is a USB Missile Launcher? Some kind of toy?

On Jun 4, 7:13 am, MartyMoose <ma...@bruner-consulting.com> wrote:
> I thought I would add a post about the usb MissileLauncher code found
> in the samples.   I discovered that the unit I bought did not work
> with the given code.  I could only find the STORM launcher online so I
> knew there were probably some differences.
>
> First using the AdbTest code, I found out that the vender ID was 8483
> and the product ID was 4112.  So I had to modify the device_filter.xml
> to include an entry for my launcher.
>
> <resources>
>     <!-- vendor and product ID for Dream Cheeky USB Missle Launcher --
>
>     <usb-device vendor-id="2689" product-id="1793" />
>     <!-- vendor and product ID for Dream Cheeky Wireless USB Missle
> Launcher -->
>     <usb-device vendor-id="2689" product-id="65281" />
>      <!-- vendor and product ID for Dream Cheeky Storm USB Missile
> Launcher (Gray)-->
>      <usb-device vendor-id="8483" product-id="4112" />
> </resources>
>
> When I reran the code, I found that only the "down" command would work
> (after realizing that I had to unplug and replug in the device).  So I
> suspected the commands were different.
>
> I found a really nice python program that handles several different
> kinds of USB missile launchers:
>
> http://code.google.com/p/pyrocket/
>
> My particular device required an 8 byte command so I modified
> sendCommand to support this format.  Please forgive my Java (I'm still
> learning the language).  I'm sure there is a much cleaner way to do
> this:
>
>         synchronized (this) {
>             if (control != COMMAND_STATUS) {
>                 Log.d(TAG, "sendMove " + control);
>             }
>             if (mConnection != null) {
>                 byte[] message = new byte[8];
>                 //message[0] = (byte) control;
>
> // for my device, I need an eight byte command.
>                 message[0] = (byte) 2;
>                 message [1]= (byte) control;
>                 message [2] = 0;
>                 message [3] = 0;
>                 message [4] = 0;
>                 message [5] = 0;
>                 message [6]= 0;
>                 message [7] = 0;
>                 // Send command via a control request on endpoint zero
>                 mConnection.controlTransfer(0x21, 0x9, 0x200, 0,
> message, message.length, 0);
>             }
>         }
>     }
>
> Anyway, after these modifications, the application works perfectly.
> Anyway, I hope this helps anyone trying to get the code to work with
> their launcher.
>
> Marty

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate