Files
meta-openembedded/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools-conf/android-gadget-setup
T
Etienne Cordonnier d3f4e68512 android-tools 10: import version from meta-clang
Imported from:
https://github.com/kraj/meta-clang.git
Commit 87d41f7dd7a69bbf159

This version is on the one hand newer than the version currently in meta-openembedded (version 10 vs 5)
and on the other hand based on the debian sources, which already contain some
makefiles added by debian (android normally compiles with Android.bp files) and should
thus be easier to maintain than current version.

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-03-14 09:39:58 -07:00

38 lines
1.6 KiB
Bash

#!/bin/sh
[ ! -e /dev/pts ] && mkdir -p /dev/pts
[ ! -e /dev/pts/0 ] && mount devpts /dev/pts -t devpts
# TODO enable the lines below once we have support for getprop
# retrieve the product info from Android
# manufacturer=$(getprop ro.product.manufacturer Android)
# model=$(getprop ro.product.model Android)
# serial=$(getprop ro.serialno 0123456789ABCDEF)
#below are now needed in order to use FunctionFS for ADB, tested to work with 3.4+ kernels
if grep -q functionfs /proc/filesystems; then
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb
#android-gadget-setup doesn't provide below 2 and without them it won't work, so we provide them here.
echo adb > /sys/class/android_usb/android0/f_ffs/aliases
echo ffs > /sys/class/android_usb/android0/functions
fi
manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)"
model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)"
# get the device serial number from /proc/cmdline directly(since we have no getprop on
# GNU/Linux)
serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')"
echo $serial > /sys/class/android_usb/android0/iSerial
echo $manufacturer > /sys/class/android_usb/android0/iManufacturer
echo $model > /sys/class/android_usb/android0/iProduct
echo "0" > /sys/class/android_usb/android0/enable
echo "18d1" > /sys/class/android_usb/android0/idVendor
echo "D002" > /sys/class/android_usb/android0/idProduct
echo "adb" > /sys/class/android_usb/android0/functions
echo "1" > /sys/class/android_usb/android0/enable
sleep 4