From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?B?QmrDtnJuIEx1bmRpbg==?= Newsgroups: comp.lang.ada Subject: Re: USB Missile launcher Date: Fri, 31 Oct 2014 13:34:30 +0100 Organization: A noiseless patient Spider Message-ID: References: <02e31162-4f29-484a-a726-b046b30b6bef@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 31 Oct 2014 12:33:15 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="23e59b4906029a0ce22afc4c4b1f25ee"; logging-data="27667"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qeQ2ojiQVMc4cy1d+QYK+" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.1.2 In-Reply-To: <02e31162-4f29-484a-a726-b046b30b6bef@googlegroups.com> Cancel-Lock: sha1:0mysLEqNMe+ulqZRwRwp4H896EI= Xref: number.nntp.giganews.com comp.lang.ada:190249 Date: 2014-10-31T13:34:30+01:00 List-Id: 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