Open main menu

DAVE Developer's Wiki β

Changes

Embedded Android FAQs

1,417 bytes added, 08:22, 15 March 2018
additional note on group membership apply
{{AppliesToAndroid}}
{{InfoBoxBottom}}
__FORCETOC__
==Introduction==
As known, Android is conceived to address mobile devices such as smartphones and tablets. Nevertheless, it is gaining popularity in the industrial applications as well. The main reason is the availability of a well-known cross-platform software interface/environment for the development and the execution of application layer programs (the apps). Even though there is no doubt about the fact that this is an appealing feature, it is worth remembering that Android is not designed to be portable to embedded devices which are not compliant with the [https://source.android.com/compatibility/cdd Android Compatibility Definition Document]. Generally speaking, the embedded platforms used to build devices for the industrial/telecom/biomedical markets do not comply with these requirements because the presence of interfaces which are not used in the mobile devices.
==FAQs==
 
===Q: How to get the hardware serial number? (NXP i.MX6-based systems only)===
The hardware serial number (as defined [https://developer.android.com/reference/android/os/Build.html#SERIAL here]) can be programmatically accessed as described in this page: [https://stackoverflow.com/questions/11029294/android-how-to-programmatically-access-the-device-serial-number-shown-in-the-avthis page]. It is worth to remember that the hardware serial number is stored in this pseudo file: <code>/proc/device-tree/som/uniqueid</code>. ===Q: How to get the network interfaces' MAC address?===The network interfaces' MAC address is stored in this pseudo file: <code>/sys/class/net/<net_if>/address</code> e.g.: for the primary ethernet interface <code>eth0</code> the MAC address is stored in the file <code>/sys/class/net/eth0/address</code> For more details, please see [https://stackoverflow.com/questions/7332931/get-android-ethernet-mac-address-not-wifi-interface this page]. ===Q: Why am I getting <code>socket: Permission denied</code> when I run <code>ping</code> as root? === Android kernels by default uses <code>CONFIG_ANDROID_PARANOID_NETWORK</code> configuration, to enable Internet permission check with its API. This requires that all process that want to access network resources belongs to specific hardcoded GID First of all you need to add those special GID to you root file system: <pre>groupadd -g 3001 aid_btgroupadd -g 3002 aid_bt_netgroupadd -g 3003 aid_inetgroupadd -g 3004 aid_net_rawgroupadd -g 3005 aid_admin</pre> And then add <code>root</code> (or the user you want to allow to access network resources) to those group, e.g.: <pre>usermod -a -G aid_bt,aid_bt_net,aid_inet,aid_net_raw,aid_admin root</pre> Please note that you have to logout and login again to apply group membership.
It is wort to remember that the hardware serial number is stored in this pseudo fileReference: https: <code>/proc/device-treestackoverflow.com/somquestions/uniqueid<36451444/code>.what-can-cause-a-socket-permission-denied-error
768
edits