Adb is not connecting to Android device over USB

Trying to debub Android modem from OpenWrt router using attached with no success. Built in put it is not connecting. Does not see android device. Interesting thing is I can connect to the android device IF connected from Ubuntu PC first, then hot swapped to the router

Anyone ever tried to use from OpenWrt? Are there tricks...

From Linux PC -
linux-PC$ sudo adb kill-server
linux-PC$ sudo adb usb

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *
    restarting in USB mode
    linux-PC$ sudo adb tcpip 5555
    linux-PC$ sudo adb connect 192.168.1.1
    connected to 192.168.1.1:5555
    linux-PC$ sudo adb devices
    List of devices attached
    1234567890 device
    192.168.1.1:5555 device

From OpenWrt router
root@router:/# adb kill-server
root@router:/# adb devices

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *
    List of devices attached

root@router:/# adb usb
error: device not found
root@router:/# adb tcpip 5555
error: device not found
root@router:/# adb connect 192.168.1.1
connected to 192.168.1.1:5555
root@router:/# adb devices
List of devices attached
192.168.1.1:5555 device

From Linux PC -
linux-PC$ sudo adb kill-server
linux-PC$ sudo adb usb

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *
    restarting in USB mode
    linux-PC$ sudo adb tcpip 5555
    linux-PC$ sudo adb connect 192.168.1.1
    connected to 192.168.1.1:5555
    linux-PC$ sudo adb devices
    List of devices attached
    1234567890 device
    192.168.1.1:5555 device

From OpenWrt router
root@router:/# adb kill-server
root@router:/# adb devices

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *
    List of devices attached

root@router:/# adb usb
error: device not found
root@router:/# adb tcpip 5555
error: device not found
root@router:/# adb connect 192.168.1.1
connected to 192.168.1.1:5555
root@router:/# adb devices
List of devices attached
192.168.1.1:5555 device

USB enumerates
[ 81.103143] usb 2-1: new SuperSpeed USB device number 3 using xhci-hcd
[ 81.123634] usb 2-1: Parent hub missing LPM exit latency info. Power management will be impacted.
[ 81.136085] usb 2-1: New USB device found, idVendor=05c6, idProduct=90f8
[ 81.153478] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 81.165985] usb 2-1: Product: SM8150-MTP _SN:1AB5AD49
[ 81.170037] usb 2-1: Manufacturer: QUALCOMM
[ 81.174634] usb 2-1: SerialNumber: 1234567890
[ 81.204395] cdc_ether 2-1:1.0 usb0: register 'cdc_ether' at usb-xhci-hcd.0.auto-1, CDC Ethernet Device, a2:f9:a2:bd:0a:07
[ 81.230385] GobiSerial 2-1:1.2: GobiSerial converter detected
[ 81.236903] usb 2-1: GobiSerial converter now attached to ttyUSB0
[ 81.253000] GobiSerial 2-1:1.3: GobiSerial converter detected
[ 81.259618] usb 2-1: GobiSerial converter now attached to ttyUSB1
[ 81.276919] GobiSerial 2-1:1.4: GobiSerial converter detected
[ 81.285319] usb 2-1: GobiSerial converter now attached to ttyUSB2
[ 81.296852] GobiSerial 2-1:1.5: GobiSerial converter detected
[ 81.305737] usb 2-1: GobiSerial converter now attached to ttyUSB3
[ 81.334965] GobiSerial 2-1:1.6: GobiSerial converter detected
[ 81.341058] usb 2-1: GobiSerial converter now attached to ttyUSB4
[ 81.352263] GobiSerial 2-1:1.7: GobiSerial converter detected
[ 81.363926] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[ 81.374822] usb 2-1: GobiSerial converter now attached to ttyUSB5
[ 81.392105] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready
[ 16.921838] i2c_geni 890000.i2c: i2c error :-107
[ 16.926654] i2c_geni 890000.i2c: i2c error :-107
[ 16.931472] i2c_geni 890000.i2c: i2c error :-107
[ 16.936342] msm-usb-ssphy-qmp 88e

root@router:/# ls -la /dev/tty*
crw-r--r-- 1 root root 5, 0 Jan 1 1970 /dev/tty
crw-r--r-- 1 root root 251, 0 Jun 4 18:41 /dev/ttyMSM0
crw-r--r-- 1 root root 249, 0 Jan 1 1970 /dev/ttyQHS0
crw-r--r-- 1 root root 4, 64 Jan 1 1970 /dev/ttyS0
crw-r--r-- 1 root root 4, 65 Jan 1 1970 /dev/ttyS1
crw-r--r-- 1 root root 188, 0 Jun 4 18:40 /dev/ttyUSB0
crw-r--r-- 1 root root 188, 1 Jun 4 18:40 /dev/ttyUSB1
crw-r--r-- 1 root root 188, 2 Jun 4 18:40 /dev/ttyUSB2
crw-r--r-- 1 root root 188, 3 Jun 4 18:40 /dev/ttyUSB3
crw-r--r-- 1 root root 188, 4 Jun 4 18:40 /dev/ttyUSB4
crw-r--r-- 1 root root 188, 5 Jun 4 18:40 /dev/ttyUSB5

Something seems strange... You're connecting to the phone from a linux PC over IP, not USB...

It seems like something is wrong (in general) with ABD-over-usb connectivity...

I'm a bit rusty but I'm 90% certain ADB does not use any of the ttys, it's a custom protocol and the adb tools use libusb. (As I said, it's been a while).

It's also strange that your phone is enumerating THAT many serial devices...

just tested on openwrt@master in x86 vbox

adb usb works fine.....

Entropy512 -
Just showing the interfaces as proof of electronic connection.
The only way to connect to the device is to first do a usb/tcpip/connect from the PC. Then do a connect from the router. Only way I can get adb on the router to see android device
The Android is a modem that has many different data and debug ports. That's why some many tty's enumerated...

wulfy23 -
Can you tell me which USB drivers are instantiated in your build?

Thanks

# dmesg | grep usb
[    0.071060] usbcore: registered new interface driver usbfs
[    0.071605] usbcore: registered new interface driver hub
[    0.072135] usbcore: registered new device driver usb
[    0.247298] usbcore: registered new interface driver usb-storage
[    0.267513] usbcore: registered new interface driver usbhid
[    0.268811] usbhid: USB HID core driver
[    0.540201] usb 1-1: new high-speed USB device number 2 using ehci-pci
[11768.898198] usb 1-1: USB disconnect, device number 2
[11769.855696] usb 1-1: new high-speed USB device number 3 using ehci-pci
[15645.762618] usb 1-1: USB disconnect, device number 3
[20738.672984] usb 1-1: new high-speed USB device number 4 using ehci-pc
Bus 001 Device 004: ID 1xyz:4xyz Google Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x18d1 Google Inc.
  idProduct          0x4xyz 
  bcdDevice            3.18
  iManufacturer           1 motorola
  iProduct                2 XT1685
  iSerial                 3 ZY2323232323
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 
      bInterfaceProtocol      1 
      iInterface              6 ADB Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
# adb devices -l
List of devices attached 
ZY2323232323      device usb:1-1 product:Moto G5 Plus model:XT1685 device:potter

# adb version
Android Debug Bridge version 1.0.32

I don't know why the PC connection is helping you, but:
The adb utilities have a specific list of USB VID/PID pairs that are "supported". Some oddball devices don't use standard VIDs/PIDs and have to have those added to a config file somewhere. I don't remember the details.

It turned out adb/usb_linux.c needed a patch to correctly handle USB3.0 message headers. The reason is worked when I used the PC was the PC uses USB2.0. Once connected messages did not have the unsupported header... lol. Here's the patch...

diff -u adb-6fe92d1a3fb17545d82d020a3c995f32e6b71f9d_old/adb/usb_linux.c adb-6fe92d1a3fb17545d82d020a3c995f32e6b71f9d/adb/usb_linux.c
--- adb-6fe92d1a3fb17545d82d020a3c995f32e6b71f9d_old/adb/usb_linux.c	2019-06-12 17:50:55.948335690 -0700
+++ adb-6fe92d1a3fb17545d82d020a3c995f32e6b71f9d/adb/usb_linux.c	2019-06-12 17:51:33.172336147 -0700
@@ -237,8 +237,20 @@
                             // looks like ADB...
                         ep1 = (struct usb_endpoint_descriptor *)bufptr;
                         bufptr += USB_DT_ENDPOINT_SIZE;
+                            // For USB 3.0 SuperSpeed devices, skip potential
+                            // USB 3.0 SuperSpeed Endpoint Companion descriptor	
+                        if (bufptr+2 <= devdesc + desclength &&
+                            bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
+                            bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
+                            bufptr += USB_DT_SS_EP_COMP_SIZE;
+                        }
                         ep2 = (struct usb_endpoint_descriptor *)bufptr;
                         bufptr += USB_DT_ENDPOINT_SIZE;
+                        if (bufptr+2 <= devdesc + desclength &&
+                            bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
+                            bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
+                            bufptr += USB_DT_SS_EP_COMP_SIZE;
+                        }
 
                         if (bufptr > devdesc + desclength ||
                             ep1->bLength != USB_DT_ENDPOINT_SIZE ||
2 Likes

If you've got the energy, posting the patch to the openwrt-devel mailing list might benefit others.

I'm a noob, what is the full openwrt-devel mailing list address?

https://openwrt.org/submitting-patches

Thanks bro! It resolve my issue when connect to Android phone using USB3.0.