<p dir="ltr">Picking this up again! </p>
<p dir="ltr">I had a look again at both your code and the official Android Accessory SDK. It seems that the Accessory SDK allows you to open a socket to talk between the two ends. Your implementation using libusb is nice because we don't need to depend on the Accessory SDK but doesn't provide that simple socket abstraction. How can we communicate the two devices after connecting them with your approach? I like the idea of using the USB cable when possible to reach a device, and if we manage to abstract it to a simpe socket it should be super easy to implement, but I don't see how to do it. </p>
<p dir="ltr">Albert</p>
<div class="gmail_quote">On Jul 30, 2015 8:50 AM, "Floris Stoica-Marcu" <<a href="mailto:floris.sm@gmail.com">floris.sm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Awesome, so here is the link to the repo:<div><br><div><a href="https://github.com/SMFloris/qt-android-accessory" target="_blank">https://github.com/SMFloris/qt-android-accessory</a><br></div></div><div><br></div><div>Few mentions: </div><div>1. The device needs to be in some sort of transfer mode other than the install-mode (the one with the drivers for windows); MTP and USB 3.0 mode work fine</div><div>2. After putting the phone in accessory mode, it gets the vID-18d1 (Google) and a *seemingly random* pID I am unsure what will happen if I connect 2 Samsung devices (one of them got drained), for example, because they might get the same pID after being in accessory mode. So our Device class should also include hardware addresses/ports together with original pIDs and vIDs</div><div>4. The code works for already connected devices as well!</div><div>5. I tested on the Galaxy S5, S2, an Allview P5 and a Serioux tablet; The two Galaxies had the exact same pID in their USB modes (6860 for MTP and USB 3.0). It should work with all Android devices with a supported API >= 10 (if we also use the support library, otherwise it is >= 12)</div><div>3. In order for the code to work, make sure you have at least libusb>=1.0.16</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 July 2015 at 23:36, Albert Vaca <span dir="ltr"><<a href="mailto:albertvaka@gmail.com" target="_blank">albertvaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Either post a review board with the code [1] or push it to a github repo and send the link.<br><br></div>[1] <a href="http://reviewboard.kde.org/" target="_blank">http://reviewboard.kde.org/</a><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 29, 2015 at 12:44 PM, Floris Stoica-Marcu <span dir="ltr"><<a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">No, actually, I managed without! xD</p>
<p dir="ltr">I made a libusb hotplug thingy that scans every usb device and tries to connect with it via the Android Accessory API. Every new device is also handled once it is plugged in (or out). It works, but I ran into problems integrating it into kdeconnect itself. </p>
<p dir="ltr">Where can I upload the UsbServer I made so we can discuss how to integrate it? I tried to follow some guidelines regarding how providers and devicelinks work. For now, this is all it does (I still need to write the android part in java), it puts the phone into accessory mode :)</p>
<p dir="ltr">The transfers are capped for Android at 16384 unsigned chars, but will have to write the Java part to test properly.<br>
</p><div><div>
<div style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Do you need to have a list of all Android vendor IDs for it to work? :S<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 27, 2015 at 12:05 PM, Floris Stoica-Marcu <span dir="ltr"><<a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually the pairinghandler works great since I use Libusb to pair them up. Any advice as to what is the best way to implement the vendor/product ids? So far I have only the list of vendor ids (bottom of page):<div><br><div><a href="http://developer.android.com/tools/device.html" target="_blank">http://developer.android.com/tools/device.html</a><br></div></div><div><br></div><div>I also noticed that the phone has different product ids, depending on what usb mode it is set to.</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 27 July 2015 at 20:15, Albert Vaca <span dir="ltr"><<a href="mailto:albertvaka@gmail.com" target="_blank">albertvaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Cool!<br><br></div>Note that we are refactoring some of the backends code, so we might need to make some changes to what you are implementing before we can merge it. Namely, we have split the pairing code into a "pairing handler" class, so every backend can implement its own way to pair. It would be nice if you could have a look at this branch with the changes [1] and see if they make sense for you and for your new backend.<br><br><a href="https://github.com/grgvineet/kdeconnect-kde/tree/pairinghandler" target="_blank">https://github.com/grgvineet/kdeconnect-kde/tree/pairinghandler</a><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 27, 2015 at 3:34 AM, Floris Stoica-Marcu <span dir="ltr"><<a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, a socket implementation is more than possible. I looked over the current backends so it should function almost the same.<div><br></div><div>You are right regarding the USB detection, it would be nice to get the connected android devices from Dolphin somehow. Currently for the testing I am doing I am providing the vendor id and pid manually. Weirdly enough the VendorID changes from time to time ... I have Samsung Galaxy S5 and sometimes the VID is 0x04e8, sometimes its 0x04E8. </div><div><br></div><div>The good news is that the accesory API does not interfere with MTP, so you can have both at the same time.</div><div><br></div><div>I'll get back with some sample code tomorrow!</div><span><font color="#888888"><div><br></div><div>Floris.</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 27 July 2015 at 03:47, Albert Vaca <span dir="ltr"><<a href="mailto:albertvaka@gmail.com" target="_blank">albertvaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Users should not have debugging enabled on their phones, so the ADB approach doesn't seem a good option. I have no idea about what you can do with the Android accessories API, but it sounds better even if old phones are not supported. Can you implement whatever protocol you like on top of that API? Basically what we need is to open a socket between the PC and the device. Do you think it can do that?<div><br></div><div>And something related: right now when you connect your phone through USB, we are not smart enough to know that the phone connected by USB and the phone connected by KDE Connect are the same phone, and Dolphin displays it twice. That is: you end up with two interfaces to send files, one that works through MTP and another through KDE Connect. I think that's a bad user experience and we should get to a point where we are able to show the phone only once in Dolphin, and when the user wants to send a file we use the better communication channel we have available (probably MTP). For me, this would be the final goal for USB integration in KDE Connect :)</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 25, 2015 at 8:36 PM, Floris Stoica-Marcu <span dir="ltr"><<a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>So I've recently been experimenting with some USB connection methods for Android. I would like your opinion on what is best to implement for KDE Connect. I found two ways that could work, each with their own advantages and disadvantages:</div><div><br></div><div>1. An USB backend through adb ( would require the user to have it installed, but will work on most Android versions) [0]</div><div>2. An USB backend that takes advantage of the whole Android accessory API. Writing the PC stuff in libusb it is possible to essentially turn the whole computer into an Android accessory, that can transfer bytes and whatnot to and from the Android device. ( will work only on newer versions of Android, but the user will not have to install anything extra ) [1]</div><div><br></div><div>Quick note on the method through adb, it also requires to have the device in usb-debugging mode. There is also the method of the custom usb driver, but I determined it to be far too fidgety (especially if you already have some drivers intalled).</div><div><br></div><div>I will attach some resources on the topics:</div><div>[0] <a href="http://qtcstation.com/2011/03/connecting-android-to-the-pc-over-usb/" target="_blank">http://qtcstation.com/2011/03/connecting-android-to-the-pc-over-usb/</a><br></div><div>[1] <a href="http://source.android.com/accessories/custom.html" target="_blank">http://source.android.com/accessories/custom.html</a> </div><div><div><br></div><div>What method would be the most convenient for KDE connect?</div><span><font color="#888888"><div><br></div><div>Floris.</div><span><font color="#888888"><span><font color="#888888">-- <br><div><div dir="ltr"><div>Stoica-Marcu "FlowRiser" Floris-Andrei<br></div><div><a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a><br></div></div></div>
</font></span></font></span></font></span></div></div><span><font color="#888888"><span><font color="#888888">
<br>_______________________________________________<br>
KDEConnect mailing list<br>
<a href="mailto:KDEConnect@kde.org" target="_blank">KDEConnect@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kdeconnect" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/kdeconnect</a><br>
<br></font></span></font></span></blockquote></div><span><font color="#888888"><br></font></span></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br><div><div dir="ltr"><div>Stoica-Marcu "FlowRiser" Floris-Andrei<br></div><div><a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a><br></div></div></div>
</font></span></font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div>Stoica-Marcu "FlowRiser" Floris-Andrei<br></div><div><a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a><br></div></div></div>
</font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br></font></span></div></div>
</div>
</div></div></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div>Stoica-Marcu "FlowRiser" Floris-Andrei<br></div><div><a href="mailto:floris.sm@gmail.com" target="_blank">floris.sm@gmail.com</a><br></div></div></div>
</div>
</blockquote></div>