GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > GSM & CDMA Phones / Tablets Software & Hardware Area > Android based Phones / Tablets > Android Development and Modding


Reply
 
LinkBack Thread Tools Display Modes
Old 01-02-2015, 03:40   #1 (permalink)
Super Moderator
 
Join Date: Jul 2008
Location: Villa del rosario/Nsd Colombia
Posts: 3,605
Member: 813309
Status: Offline
Thanks Meter: 1,912
adb from smartphone to android wear with just bluetooth (no cables needed)


Hey folks,

Just wanted to share something I found that might be useful from time to time: how to send adb commands to android wear directly from your phone without any cables nor an extra PC.

This is a combination from different tutorials, made for different goals, so almost all credit goes to them

This worked from my Nexus 5 (4.4.4 stock, rooted) to a LG G Watch R (5.0.1)... but it should work with any combination as long as, your smartphone is rooted

First thing first, start bluetooth debugging in your android wear device (from the developer menu)

Now from your smartphone, start USB debugging (developer menu too)

At the bottom of the settings in the android wear app you should see a new option "Debugging over bluetooth", turn it on. You should get a message just below:
Host: disconnected
Target: connected

You will also get a permanent notification to remind you that debugging over bluetooth is active.

Disclaimer: su commands are powerful and with great powers comes great responsibility... so pay attention to what you do. In any case, I'm not responsable for any damage incurred to your phone, your android wear device, your cat, your home, your neighborhood, etc...

Open a terminal emulator in the smartphone paired to your wear device, where you can do "su" stuff, and run the following commands:

> su
> export HOME=/sdcard
> setprop service.adb.tcp.port 5555
> stop adbd
> start adbd
> adb devices <--- this should show you your own smartphone (with a emulator-5554, in my case)... you can actually shell into it if you like recursions .

SECURITY NOTE: This will allow the adb daemon to listen for tcp/ip connections from other machines connected to your wifi hotspot... I guess it will also allow machines sharing the same 4G cellular network you are using to connect, but what are the odds... In any case, and if I'm not wrong, any android version since 4.3 should give you a message telling you to accept the connection or not.... maybe in airplane mode with just bluetooth activated it would work and it would also be safer.

Continuing in terminal (the typical stuff we know already):

> adb forward tcp:4444 localabstract:/adb-hub
> adb connect localhost:4444

At this point your smartphone should buzz and ask you to allow a connection from your own phone. This time is the real deal, but just in case read carefully the message. It should say "Allow Wear Debugging?", so accept the connection and optionally mark the always accept option.

You will now have two emulated devices:

> adb devices
emulator-5554 device <--- the smartphone
localhost:4444 device <--- the android wear device

you need to specify for now on the target of your adb commands. For instance if you want to have a shell in the android wear device:

> adb -s localhost:4444 shell

That's it. Hope it works for everyone.

Ah! just one thing the value service.adb.tcp.port we set before disappears with a reboot (you can replace the word service with persist if you prefer to have it surviving the reboot... but I do not recommend it).

If you do not want to reboot but you want to disable it, run, as root:

> setprop service.adb.tcp.port -1
> stop adbd
> start adbd

to clean-up, from the terminal and as root:
> adb kill-server

You can also disable the adb debugging from the developer menu.

N.B. 1 . I guess the easiest thing to do would be to put all those commands in a script file and then just run as root:

> sh script_to_adb_wear.sh

N.B.2. I have not tried with fastboot... but that would surprise me if it works.... In any case, and IMHO, fastboot should only be used with the device connected to a computer via usb.
  Reply With Quote
The Following User Says Thank You to Braycel For This Useful Post:
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 



All times are GMT +1. The time now is 02:15.



Powered by Searchlight © 2024 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -
Page generated in 0.21978 seconds with 9 queries

SEO by vBSEO