From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: USB Missile launcher
Date: Fri, 31 Oct 2014 13:34:30 +0100
Date: 2014-10-31T13:34:30+01:00 [thread overview]
Message-ID: <m2vvib$r0j$1@dont-email.me> (raw)
In-Reply-To: <02e31162-4f29-484a-a726-b046b30b6bef@googlegroups.com>
On 2014-10-29 18:43, kadrickhenderson008@yahoo.com wrote:
The device connects to the pc via USB.
I've had success running the K8055 boards from Velleman via
libusb both on Windows and Linux.
It came with a driver/dll but if I remember correctly,
I had to loop through all usb looking at Vendor and device
interfaceing.
Looking around I can't find the code at work, might be at home.
But for the linux part, I took the c-code from
http://sourceforge.net/projects/libk8055
and rewrote it (parts of it) in Ada.
And one part was to get hold of the correct usb,
and open it. (The library supports 4 cards)
libk8055.c function OpenDevice
should give you some ideas.
The data passing mechanism is of course different,
But the 8055 has
/* globals for datatransfer */
struct k8055_dev {
unsigned char data_in[PACKET_LEN+1];
unsigned char data_out[PACKET_LEN+1];
struct usb_dev_handle *device_handle;
int DevNo;
};
and is written to by
/* Actual write of data to the device endpont, retry 3 times if not
reponding correctly */
static int WriteK8055Data(unsigned char cmd)
{
int write_status = 0, i = 0;
if (CurrDev->DevNo == 0) return K8055_ERROR;
CurrDev->data_out[0] = cmd;
for(i=0; i < 3; i++)
{
write_status = usb_interrupt_write(CurrDev->device_handle,
USB_OUT_EP, (char *)CurrDev->data_out, PACKET_LEN, USB_TIMEOUT);
if (write_status == PACKET_LEN) return 0;
if (DEBUG)
fprintf(stderr, "Write retry\n");
}
return K8055_ERROR;
}
where I think usb_interrupt_write is libusb
the datastructure for your missile is perhaps
found in https://code.google.com/p/thunder-missile-api/
and MissileLauncher.cs from there idicates
* HID interface by private UsbHidPort USB;
* The data structure , which seems to be treated as a bytearray
There are other libraries out there to see the actual protocol.
I'll see if I can find the usb-connecting code I did in Ada
--
Björn
next prev parent reply other threads:[~2014-10-31 12:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 17:43 USB Missile launcher kadrickhenderson008
2014-10-29 18:19 ` David Botton
2014-10-29 18:33 ` kadrickhenderson008
2014-10-29 18:42 ` kadrickhenderson008
2014-10-29 20:59 ` Dmitry A. Kazakov
2014-10-30 20:25 ` Jacob Sparre Andersen
2014-10-31 12:34 ` Björn Lundin [this message]
2014-10-31 18:06 ` björn lundin
2014-11-04 18:24 ` kadrickhenderson008
2014-11-05 9:06 ` Björn Lundin
2014-11-01 22:08 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox