USB serial access from android for Hikey960


I want to access a serial usb device with hikey960 board for simple data transfer. The data will come from android.
Is it possible for someone to tell how to do it or point me to a document or link that helps?

There are a couple of ways to do this;

  1. If your process is a daemon that is started by init:

First, you will need to modify the ueventd.common.rc file in the android device tree to establish permissions on the device.

Second, you will need to adjust selinux policy to allow your daemon’s context to access the device. Look in the android device tree /selinux/file_contexts to SET a context for the device, then write a policy for your daemon to allow access to the context you create for the device.

  1. If your process is an ANDROID USER APPLICATION (i.e., it is something.apk that you install):

DO NOT use approach (1) to solve requirement (2) – this would be deemed a “nasty hack” and would not be transportable across devices.