Hikey960 does not show up as USB device


#1

I am not able to connect with adb to my HiKey960 device.
I have flashed the Android factory image from 2017-08-16 onto the device.
I am trying to follow the steps described in https://android.stackexchange.com/questions/144966/how-do-i-get-my-device-detected-by-adb-on-linux
but lsusb does not list the device at all. USB with fastboot works fine.
Using the same hardware with the preinstalled firmware just worked fine.

any help is appreciated.
Thanks
Matthias


#2

Hi Matthias,

So you enabled developer options and USB debugging right ?
Is there any output in dmesg (or /proc/kmsg) when you plug the device ?


#3

Do you have access to a console to check the output of getprop sys.usb.configfs?

If not, try connecting via tcp?

adb tcpip 5555
adb connect 192.168.0.9:5555

#4

Hi Loic,
yes, I have enabled developer mode and USB debug is switched on (by default).
When booting the device in fastboot, I see in dmesg
[Thu Aug 24 14:14:42 2017] usb 3-13.1: new high-speed USB device number 16 using xhci_hcd
[Thu Aug 24 14:14:42 2017] usb 3-13.1: New USB device found, idVendor=18d1, idProduct=d00d
[Thu Aug 24 14:14:42 2017] usb 3-13.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Thu Aug 24 14:14:42 2017] usb 3-13.1: Product: HI3650
[Thu Aug 24 14:14:42 2017] usb 3-13.1: Manufacturer: Fastboot2.0
[Thu Aug 24 14:14:42 2017] usb 3-13.1: SerialNumber: 8298875412000000

when I boot the device in normal mode into Android, dmesg does not show any message.


#5

some more details…

I find it strange that although I have USB-C plugged in, the normal USB port with mouse and keyboard are still working. The 960 documentation is saying, I can use only USB-C or the other USB interfaces.

Flashing through USB-C works fine. The USB-C interface seems to work hardware-wise.


#6

I have also tried to deploy the reference firmware built from the source. Here I have checked that sys.usb.configfs in device/linaro/hikey/init.common.usb.rc is set to 1. I have flashed this version w/o success regarding my problem.

I am not able to connect to the device console. I have ordered a UART board.
adb tcpip 5555 is not working: error: device ‘(null)’ not found -> need to have a connected device via USB!?


#7

OK, I have now connected the Mezzanine UART board to the Hikey960 and I can see the system console. Here are some observations

When I plug in the USB-C cable (which is connected to the Linux development machine), I do not see any reactions. No USB log messages about new devices.
When I do the same with a mouse, I can see USB connection messages identifiying the mouse.

Could it be that the USB-C interface is configured as USB host and does not accept connections to other hosts, like the Linux machine?
How can I reconfigure the USB-C interface so it accepts the Linux connection?


#8

Upgrade your android image.

I use the hikey960-linaro-2017.08.20 image without any adb issue. Could you please upgrade and use the flash-all script (to have all aligned, kernel, DTS…).

Check USB related I/O

Can you please check at the following interrupt/gpio via UART/console:

  1. Display IRQ/GPIO info :

    $ cat /proc/interrupts | grep type_c
    283: 45 0 0 0 0 0 0 0 pl061 3 Edge type_c_port0-IRQ
    $ cat /d/gpio | grep hub_vbus
    gpio-470 ( |hub_vbus_int_gpio ) out hi

  2. Plug your usb TYPE C cable

  3. Display IRQ/GPIO info (IRQ count should be increased, hub_vbus should be low):

    $ cat /proc/interrupts | grep type_c
    283: 48 0 0 0 0 0 0 0 pl061 3 Edge type_c_port0-IRQ
    $ cat /d/gpio | grep hub_vbus
    gpio-470 ( |hub_vbus_int_gpio ) out lo

Force USB mode

$ cd /sys/devices/platform/soc/ff200000.hisi_usb

you can display the current state with:

$ cat plugusb
current state: USB_STATE_DEVICE

you can force state with:

$ echo hostoff > plugusb
$ echo deviceon > plugusb

#9

OK, I have flashed the device with hikey960-linaro-2017.08.28-factory-bb671c20.zip (not the 08/20 version you suggested).
Behavior didn’t change.

Then I explored the usb setting via UART console as you suggested. Below is the protocol.

  • I get different results and “permission denied” messages.
  • After pluging-in the device, I see “avc: denied” messages
  • Pluging in, does not show any differences in interrupt configurations

hikey960:/ $ cat /proc/interrupts | grep type_c
283: 2 0 0 0 0 0 0 0 pl061 3 Edge type_c_port0-IRQ
hikey960:/ $ cat /d/gpio | grep hub_vbus
cat: /d/gpio: Permission denied

// plugged in usb-c cable
1|hikey960:/ $ [ 76.167382] type=1400 audit(55.171:84): avc: denied { create } for pid=3060 comm=“main” name=“cgroup.procs” scontext=u:r:zygote:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[ 76.184374] type=1400 audit(85.391:85): avc: denied { write } for pid=2085 comm=“Binder:2085_2” name=“xt_quota” dev=“proc” ino=4026532076 scontext=u:r:netd:s0 tcontext=u:object_r:proc_net:s0 tclass=dir permissive=0

1|hikey960:/ $ cat /proc/interrupts | grep type_c
283: 2 0 0 0 0 0 0 0 pl061 3 Edge type_c_port0-IRQ
hikey960:/ $ cat /d/gpio | grep hub_vbus
cat: /d/gpio: Permission denied
1|hikey960:/ $ cd /sys/devices/platform/soc/ff200000.hisi_usb
hikey960:/sys/devices/platform/soc/ff200000.hisi_usb $ cat plugusb
cat: plugusb[ 169.139106] type=1400 audit(85.391:85): avc: denied { write } for pid=2085 comm=“Binder:2085_2” name=“xt_quota” dev=“proc” ino=4026532076 scontext=u:r:netd:s0 tcontext=u:object_r:proc_net:s0 tclass=dir permissive=0
: Permission denied
[ 169.160691] type=1400 audit(178.359:86): avc: denied { read } for pid=3095 comm=“cat” name=“plugusb” dev=“sysfs” ino=13491 scontext=u:r:shell:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
hikey960:/sys/devices/platform/soc/ff200000.hisi_usb $ echo hostoff > plugusb
/system/bin/sh: can’t create plugusb: Permission denied
echo deviceon > plugusb <
/system/bin/sh: can’t create plugusb: Permission denied


#10

Yes, I forgot to mention you need to switch to root before anything else:
$ su

Are you sure about your USB cable, did you try with an other one ? (I know fastboot works but maybe it’s because usb is by default in device mode).
Did you try to plug to a different computer ?


#11

Loic, I tested one more cable and it works now. With this new cable, the device was immediately recognized. No need to switch from host to device mode.

Thanks for your support and patience.
Matthias


#12

Hi,

I am using hikey960 with Android master branch (Pie)

I have tried the below steps to connect to adb:

  1.    adb version is > 26. It is 1.0.40
    
  2.    adb kill-server
        adb start-server
    
  3.    Using only one USB type-c connector and by disconnecting mouse and keyboard
    
  4.    Tried removing the adbkeys and repeated step 2
    

Inspite of the above efforts , # adb devices still shows that the device is offline and # adb usb / #adb shell shows that no device/emulator found.

Can you please provide some insights wrt adb connection?

Thanks for your support!