dandycheung / microbridge

Automatically exported from code.google.com/p/microbridge
0 stars 0 forks source link

Library not working anymore with Android 4.2+ #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It seems like the microbridge library does not work with Andrdoid 4.2+, is that 
linked to the fact that devices using the Adb now have to authenticate?

Did anyone get it working on the recent Android devices?

Original issue reported on code.google.com by d...@evrythng.com on 16 Jun 2013 at 8:38

GoogleCodeExporter commented 9 years ago
For me on Nexus 4 with Android 4.3 microbridge library also stopped working.

Original comment by s.gen...@googlemail.com on 13 Aug 2013 at 9:27

GoogleCodeExporter commented 9 years ago
I did some digging on this (I REALLY need this type of comm). The short answer 
is this will not work without a non-trivial amount of updating and testing.

The long answer is, as of 4.2 Android requires that the adb server respond to a 
new AUTH request before accepting the connection. That part is reasonably 
straightforward...
https://android.googlesource.com/platform/system/core/+/master/adb/

The problem comes in sending a correct response: RSA encryption is used and I 
couldn't find any easy libraries for arduino. There are some libraries designed 
for embedded processors which could probably be ported, but it is at best 
non-trivial.

Original comment by rya...@gmail.com on 14 Aug 2013 at 5:05

GoogleCodeExporter commented 9 years ago
I did some digging into this too. Maybe this Project can help. 
https://github.com/arpitchauhan/cryptographic-protocols-arduino-and-PC?files=1
Let me know what you are thinking of it. 

Original comment by s.gen...@googlemail.com on 14 Aug 2013 at 5:30

GoogleCodeExporter commented 9 years ago
Yeah, that library might do the trick although I know almost nothing about 
cryptography so can't say for sure. 

I'm up against a deadline right now so have to revert back to an old phone just 
to get my experiments done. After that, though, I might play with it and see if 
I can get it going.

Original comment by rya...@gmail.com on 14 Aug 2013 at 5:40

GoogleCodeExporter commented 9 years ago
Good luck with your experiments. Looking forward to see the library working 
with Android above 4.2. Without it there is no "native" way for communicating 
between all Android devices and Arduino. 
ADK is only available for some devices above   Android 2.3.4. It's really a 
mess and it seems that using a Bluetooth solution such as Amarino 
http://www.amarino-toolkit.net/index.php/home.html is best for 
supporting the greatest Number of Phones. 

Original comment by s.gen...@googlemail.com on 14 Aug 2013 at 6:09

GoogleCodeExporter commented 9 years ago
You can do a workaround version without any encryption, if you are willing to 
OK authorization each time you connect.  This might work fine for some uses.

After adding the code to handle the AUTH messages in the protocol, have 
microbridge respond to the AUTH message with a RSAPUBLICKEY.  It can be any 
string.  A dialog now appears on the Android device asking "Allow USB 
Debugging".  Touching OK will allow microbridge to use ADB while maintaining a 
CNXN. Checking "Always allow this computer" only works if you return a 
SIGNATURE of the TOKEN, based on the prior RSAPUBLICKEY.

Original comment by k...@zk.com on 21 Aug 2013 at 11:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here's a patch file for the minimal version. Every time the phone connects you 
will have to authenticate.

To avoid this, the RSAPUBLICKEY response needs to include a valid public key 
which you can tell the phone to save. The next connection, then, you need to 
sign the random data sent by the phone with the authenticate message. This 
requires understanding more about cryptography protocols (SHA1, etc) than I 
know so I haven't done this part.

Original comment by rya...@gmail.com on 28 Nov 2013 at 6:24

Attachments: