blob: 26cf30edddfed1b0fceb0f25f86dc73094dea625 [file] [log] [blame]
Patrick Williamsddad1a12017-02-23 20:36:32 -06001#!/bin/sh
2
Brad Bishop34ae6002019-04-08 15:21:03 -04003[ ! -e /dev/pts ] && mkdir -p /dev/pts
4[ ! -e /dev/pts/0 ] && mount devpts /dev/pts -t devpts
5
Patrick Williamsddad1a12017-02-23 20:36:32 -06006# TODO enable the lines below once we have support for getprop
7# retrieve the product info from Android
8# manufacturer=$(getprop ro.product.manufacturer Android)
9# model=$(getprop ro.product.model Android)
10# serial=$(getprop ro.serialno 0123456789ABCDEF)
11
Brad Bishop15ae2502019-06-18 21:44:24 -040012#below are now needed in order to use FunctionFS for ADB, tested to work with 3.4+ kernels
13if grep -q functionfs /proc/filesystems; then
14 mkdir -p /dev/usb-ffs/adb
15 mount -t functionfs adb /dev/usb-ffs/adb
16 #android-gadget-setup doesn't provide below 2 and without them it won't work, so we provide them here.
17 echo adb > /sys/class/android_usb/android0/f_ffs/aliases
18 echo ffs > /sys/class/android_usb/android0/functions
19fi
20
Patrick Williamsddad1a12017-02-23 20:36:32 -060021manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)"
22model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)"
23# get the device serial number from /proc/cmdline directly(since we have no getprop on
24# GNU/Linux)
25serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')"
26
27echo $serial > /sys/class/android_usb/android0/iSerial
28echo $manufacturer > /sys/class/android_usb/android0/iManufacturer
29echo $model > /sys/class/android_usb/android0/iProduct
30
31echo "0" > /sys/class/android_usb/android0/enable
Brad Bishop34ae6002019-04-08 15:21:03 -040032echo "18d1" > /sys/class/android_usb/android0/idVendor
Patrick Williamsddad1a12017-02-23 20:36:32 -060033echo "D002" > /sys/class/android_usb/android0/idProduct
34echo "adb" > /sys/class/android_usb/android0/functions
35echo "1" > /sys/class/android_usb/android0/enable
36
37sleep 4