<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Apparently my OSTC was just as tired as I was (I sent that last email at 3:30am).<div class="">Replacing the (new) AA Alkaline with an (old) Saft battery was enough to give it the</div><div class="">boost to start up again.</div><div class="">So for now I'm back in business with a "working" FTDI dive computer (the DC has</div><div class="">been broken for a long time, but it at least responds on FTDI and therefore I can</div><div class="">test any FTDI connection issues)</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 30, 2019, at 3:30 AM, Dirk Hohndel <<a href="mailto:dirk@hohndel.org" class="">dirk@hohndel.org</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I started this response email, wanting to send you a dump of what we already</div><div class="">log about the new device that's connected after we get the intent, but unfortunately </div><div class="">I can't seem to revive my my last FTDI dive computer. It had been super flaky the </div><div class="">last couple of times I played with it, but I now can't turn it on anymore.</div><div class=""><br class=""></div><div class="">If you connect your FTDI dive computer, we are logging a string representation</div><div class="">of the UsbDevice structure </div><div class=""><br class=""></div><div class=""><a href="https://github.com/Subsurface-divelog/subsurface/blob/eecca6aab0a1970c7474df7ac8408d810a5d0bbd/core/android.cpp#L179" class="">https://github.com/Subsurface-divelog/subsurface/blob/eecca6aab0a1970c7474df7ac8408d810a5d0bbd/core/android.cpp#L179</a></div><div class=""><br class=""></div><div class="">Do you have code that can convert that into a libusb_device structure? </div><div class="">Because if you have that code, I think I can piece the rest together. Well,</div><div class="">maybe. If I had a working FTDI dive computer to test with...</div></div></div></blockquote><br class=""></div><div>So this is a textual representation of what we get:</div><div><br class=""></div><div>UsbDevice[mName=/dev/bus/usb/001/002,mVendorId=1027,mProductId=24577,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=HW,mProductName=HeinrichsWeikamp OSTC3,mVersion=6.00,mSerialNumber=A4SHCQSJ,mConfigurations=[\nUsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=50,mInterfaces=[\nUsbInterface[mId=0,mAlternateSetting=0,mName=HeinrichsWeikamp OSTC3,mClass=255,mSubclass=255,mProtocol=255,mEndpoints=[\nUsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=64,mInterval=0]\nUsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=64,mInterval=0]]]]"<br class=""></div><br class=""></div><div class="">What we need is </div><div class=""><br class=""></div><div class=""><font face="Courier New" class="">struct libusb_device {<br class="">        /* lock protects refcnt, everything else is finalized at initialization<br class="">         * time */<br class="">        usbi_mutex_t lock;<br class="">        int refcnt;<br class=""><br class="">        struct libusb_context *ctx;<br class=""><br class="">        uint8_t bus_number;<br class="">        uint8_t port_number;<br class="">        struct libusb_device* parent_dev;<br class="">        uint8_t device_address;<br class="">        uint8_t num_configurations;<br class="">        enum libusb_speed speed;<br class=""><br class="">        struct list_head list;<br class="">        unsigned long session_data;<br class=""><br class="">        struct libusb_device_descriptor device_descriptor;<br class="">        int attached;<br class=""><br class="">        PTR_ALIGNED unsigned char os_priv[ZERO_SIZED_ARRAY];<br class="">};<br class=""></font><br class=""></div><div class=""><font face="Courier New" class="">bus/port</font> should be 1/2</div><div class="">what do I use as <font face="Courier New" class="">parent_dev</font>?</div><div class="">what's the <span style="font-family: 'Courier New';" class="">device_address </span>and<span style="font-family: 'Courier New';" class=""> </span><span style="font-family: 'Courier New';" class="">num_configurations</span></div><div class="">I assume that the list is something that libusb maintains internally?</div><div class="">And then of course I still need a<span style="font-family: 'Courier New';" class=""> device_descriptor </span>- which has plenty of other fields to fill...</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font face="Courier New" class="">struct libusb_device_descriptor {</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Size of this descriptor (in bytes) */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bLength;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Descriptor type. Will have value</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">         * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">         * context. */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bDescriptorType;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB specification release number in binary-coded decimal. A value of</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">         * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint16_t bcdUSB;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB-IF class code for the device. See \ref libusb_class_code. */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bDeviceClass;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB-IF subclass code for the device, qualified by the bDeviceClass</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">         * value */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bDeviceSubClass;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB-IF protocol code for the device, qualified by the bDeviceClass and</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">         * bDeviceSubClass values */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bDeviceProtocol;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Maximum packet size for endpoint 0 */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bMaxPacketSize0;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB-IF vendor ID */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint16_t idVendor;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** USB-IF product ID */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint16_t idProduct;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Device release number in binary-coded decimal */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint16_t bcdDevice;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Index of string descriptor describing manufacturer */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  iManufacturer;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Index of string descriptor describing product */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  iProduct;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Index of string descriptor containing device serial number */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  iSerialNumber;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><font face="Courier New" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        /** Number of possible configurations */</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font face="Courier New" class="">        uint8_t  bNumConfigurations;</font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font face="Courier New" class="">};</font></span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font face="Courier New" class=""><br class=""></font></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">Some of those are obvious, others... not so much.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">I'll keep hacking on this and see how far I get. Any insights and pointers in the meantime would be welcome</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">/D</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></body></html>