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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to