Galaxy Nexus execute AT commands? - android

Would it be possible to send AT commands to the Galaxy Nexus using Hyperterminal or an other program?
If so, is there also a way to directly execute the commands on the phone?

I haven't send AT commands to the Galaxy Nexus, but it is possible with other mobile phones. They act like Plug and Pr/lay devices when you connect them to a Windows computer.
Plug the phone in, then check Windows Device Manager to see if there's a modem port for the phone.
If you can see the phone as a modem, then that's the port to which you can send AT commands via Hyperterminal.
I'm not aware of any phones that let you enter AT commands into the phone via its keypad (that's what you mean, isn't it?). The interface just isn't there.
If the phone shows up on the computer as a Windows Mobile Broadband device, you could also use Mobile Broadband API - documentation here. You would have to write some code for that.
It depends on the driver support whether this is possible or not.

It's possible on Linux (haven't tried on Win), but you'll need root on your GNex:
Connect rooted GNex to Linux PC with USB cable (debug mode and superuser access over adb must be enabled)
Go into adb shell and change to root with su command:
adb shell
su
as root execute the following:
echo MODEM > /sys/devices/tuna_otg/usb_sel
This would drop you out of the adb shell and you should now have 7 new pseudo-tty devices in /dev named ttyACM[0-6]. You should now be able to use /dev/ttyACM0 to send AT commands to you GNex.
Personally, I use atinout to send the AT commands.

Related

Unpluging usb cable also disconnects wireless adb connection [duplicate]

I develop on my tablet using android studio.
The tablet is connected to the computer by wifi using
adb connect <ip_andress>:5555
My application contains listeners for USB devices attached/detached.
But unfourtunately, when I connect/disconnect usb device to/from the tablet, the adb connection is getting killed, and I can no longer see the device under "adb devices".
It is not a adb-connection-by-wifi what gets killed. It is just that USB enumerations affect the sys.usb.* system properties which on many devices is causing restart of adbd regardless whether it's being used over USB or tcpip.
Do grep "stop adbd" /init*rc to see what I mean.
You could either comment out those stop adbd lines or just disconnect the USB cable before running your adb connect command.
I was never able to connect my cellphone with my computar through wi-fi.
I had already given up. I followed all the instructions and tips, and nothing worked.
Finally, I did what no one said to do.
I've connected the phone to the WiFi network provided by the cable modem itself and not to some (not all) additional networks that are included in the router.
At home I use one of these networks, because I use a Deco Tp-Link router, which propagates the signal to my entire house, but this network is NOT compatible with ADB. It does not identify it as belonging to the same network.
After this, I use the normal procedure described here.
a) Connect cellphone with a USB cable
b) Find the IP_Phone depends on system in the cell phone. Here I use Settings, About Phone, Status and IP address.
c) Run the following adb commands in Command Prompt (Windows) or Terminal (Linux), where IP_Phone is the IP above mentioned. Normally adb.exe is an executable stored in computer path. adb is already included in Android Studio package.
adb tcpip 5555
adb connect IP_Phone
d) Now disconnect USB cable and it's ready. The cellphone model continues to appear in the status line in the top of Android Studio.
-/-
The best wifi is that defined in Cable Modem. It, unlike an any account defined in my router, answers to a ping command.
ping IP_Phone
Disconnect the usb cable just before running adb connect <*ip_address_of_your_phone*>

Remotely turning on display and opening Apps

I have a tablet connected to my home automation system. I would like my tablet to open an app when specific conditions are met.
My idea was to install some sort of SSH server on the tablet. When my server wants the tablet to open the App, it logins into the tablet and executes a command turn on the display and open the App.
In theory this works but I haven't been able to find any documentation on the web on how to do this.
I've got as far as installing SSHDroid however when the tablet locks, the SSH disconnects. I'm also unable to find any commands which turn on the display and open apps.
From a computer, if you have USB access already (no root required), check this answer more details.
Connect your tablet with computer(has adb installed) and run
adb tcpip 5555
Then you can control your tablet over wifi by run
adb connect 192.168.0.101:5555 // you can use port forward in you gateway to enable you connect over internet.
Now after connected with tablet you are able to use adb shell commands.
Turn Screen On
adb shell input keyevent KEYCODE_POWER
Start an Application
adb shell am start -n com.package.name/com.package.name.ActivityName

How "adb reboot bootloader" works internally?

I am seeing an issue with my android images where the command adb reboot bootloader simply reboots back the android, instead of going to bootloader mode.
In order to fix the issue, I did some study and find that there are acually two things, adb and adbd and the host and target devices communicate using the TCP protocol over sockets.
So, the interesting thing is commands like adb shell and adb devices are working but not the reboot bootloader. I want to understand what the adbd on receiving the reboot bootloader. Does it change the boor order, sets some flag, changes EFI vars....?
Can you please point to some good links or understanding you can share?
PS : I am working on embedded device environ, similar to raspberry pi...
This is how adb reboot bootloader works on a standard Android device connected via USB (the only transport supported by the standard Android bootloader in the fastboot mode):
adb client sends the reboot bootloader command to the adb server (over TCP)
adb server forwards the reboot bootloader command to the adbd on the device (over USB)
adbd sets the sys.powerctl property to reboot,bootloader
sys.powerctl change triggers the init.rc rule which runs powerctl init's built-in
which does _NR_reboot syscall
which sets the reboot to bootloader flag and reboots the device
On the next power up the bootloader would see the flag and go to the fastboot mode. But only if USB is connected.

ADB over wireless without USB

I know it.s possible to connect with adb to a non-rooted android device by connecting by USB and running the command:
adb tcpip 5555
adb connect {device ip}
But last week my phone got wet and it.s impossible to connect/charge via USB. I can charge it with a wireless charger (it.s a Nexus 4)
So i.m left with a device that works perfectly but it.s not rooted and you can.t connect the USB.
Is there any way I can connect adb via wireless so I can still develop with this phone?
Or is it possible to root my phone without USB? (I rrpeat, i.m using a Nexus 4).
You can use memory card. Install ClockworkMod first, copy ROM to memory card, push the card (sdcard) to device, flash it via ClockworkMod.

Android Host Mode USB debugging

I am developing an application where my android phone connects to a USB accessory. However, when the accessory is connected is there any easy way to debug the application?
Can we use a micro usb hub or similar device?
When debugging applications that use USB accessory or host features, you most likely will have USB hardware connected to your Android-powered device. This will prevent you from having an adb connection to the Android-powered device via USB. You can still access adb over a network connection. To enable adb over a network connection:
Connect the Android-powered device via USB to your computer.
From your SDK platform-tools/ directory, enter adb tcpip 5555 at the command prompt.
Enter adb connect <device-ip-address>:5555 You should now be connected to the Android- powered device and can issue the usual adb commands like adb logcat.
To set your device to listen on USB, enter adb usb.
source: Android developer site
You could write an app that reads the logcat output on the phone and displays it on the screen and/or saves it to a file which you can pull with adb afterwards.
The app must be given READ_LOGS permission, which you can do with adb shell pm grant com.package.appname android.permission.READ_LOGS (at least on a rooted phone).
Another alternative might be to log over WiFi. adb has an option to connect over TCP/IP, but this is not something I've tried so I don't know how difficult it is to set up or how well it works.
Unless your logs are really verbose it's sometimes enough to run through your USB accessory use-case and then unplug the accessory and connect the phone to your computer to catch the logcat output. The logs are buffered up to a certain amount, so you can get a reasonable amount of logs using this method.
You could run an Android image in Virtualbox. This would allow you to connect your USB device to the virtual device, and debug over the bridged network connection.
I haven't figured out how to convert the SDK .img OS images to VDIs for use in Virtualbox, but there are plenty of canned VDIs out there.

Categories

Resources