Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb can list devices but adb shell/logcat doesn't work

Short version

adb devices can list device, but adb shell or adb logcat just hang and don't work.

Long version

Here are various command outputs.

/* system info */
$ uname -a
Linux ubuntu-vm 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64    x86_64 GNU/Linux

/* udev info */
$ cat /etc/udev/rules.d/51-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev" 

$ lsusb
Bus 001 Device 003: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub



$ adb devices -l
List of devices attached 
0A3C294805017006       device usb:1-1 product:full_toroplus model:Full_AOSP_on_Toroplus device:toroplus

$ adb shell
/* no output, just hang */

$ adb logcat
/* no output either */

/* verbose mode */
$ ADB_TARCE=1 adb shell
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/commandline.c::adb_commandline():starting interactive shell
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
..........
4f4b4159 OKAY
system/core/adb/adb_client.c::switch_socket_transport():Switch transport success
system/core/adb/transport.c::writex():writex: fd=3 len=4: 30303036 0006
system/core/adb/transport.c::writex():writex: fd=3 len=6: 7368656c6c3a shell:
system/core/adb/transport.c::readx():readx: fd=3 wanted=4
/* hang at this point */

It seems that adb server is expecting some data from phone but can not get it, thus it's stuck there.

I've tried:

  • kill and restart adb server
  • unplug and then plug phone
  • reboot phone
  • disable usb debug on phone and then enable it

Sometimes, after unplug/plug the phone, it will work for a while (I can do adb shell), but soon it stops working. And most of the time, unplug/plug phone even has no effect at all!

I'm running ubuntu as vmplayer guest. Host is windows 7.

Thanks in advance for any help or hints.

UPDATE

After plug the phone into rear usb port, it suddenly works! But I'm not sure the problem is really solved. Will see.

like image 457
Jinghao Shi Avatar asked Sep 27 '13 02:09

Jinghao Shi


People also ask

Why adb shell is not working?

Make sure USB debugging is enabled and USB is physically plugged in. Make sure everything is ok with the ADB drivers, double-check the device manager. Check if the device appears in "adb devices", make sure its authorized on the device. Try actual adb shell and other relevant adb stuff.

Why is adb not detecting my device?

It might be that you have not enabled USB debugging on your device. Or, it might be that you have not installed the proper ADB drivers on your computer. In a nutshell, this error is the sign that ADB does not recognize your phone is connected to your computer.

How do I enable adb shell?

Enable adb debugging on your device On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.


2 Answers

I had the exact same problem with adb shell hanging. I am running an Ubuntu 12.04 VM guest on an Ubuntu host. The problem for me was the USB Compatibility setting for the VM was set to 1.1, it needs to be at least 2.0. To change the setting power down the VM and choose the "Edit virtual machine settings" in the VMPlayer startup menu. Then select the "USB Controller" device and change "USB Compatibility" to USB 2.0.

like image 138
user3546604 Avatar answered Sep 22 '22 07:09

user3546604


I had the same problem, getting different results (none working good though) by trying different usb-ports on the computer. I finally decided to go to the store and buy a new USB-cable. Now it works flawlessly! I guess USB-cables can be worn or bad...

Short story: Buy a new cable! Worked for me!

like image 27
JohnyTex Avatar answered Sep 21 '22 07:09

JohnyTex