Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 3 | [ ! -e /dev/pts ] && mkdir -p /dev/pts |
| 4 | [ ! -e /dev/pts/0 ] && mount devpts /dev/pts -t devpts |
| 5 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 6 | # 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 Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 12 | #below are now needed in order to use FunctionFS for ADB, tested to work with 3.4+ kernels |
| 13 | if 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 |
| 19 | fi |
| 20 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 21 | manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)" |
| 22 | model="$(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) |
| 25 | serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')" |
| 26 | |
| 27 | echo $serial > /sys/class/android_usb/android0/iSerial |
| 28 | echo $manufacturer > /sys/class/android_usb/android0/iManufacturer |
| 29 | echo $model > /sys/class/android_usb/android0/iProduct |
| 30 | |
| 31 | echo "0" > /sys/class/android_usb/android0/enable |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 32 | echo "18d1" > /sys/class/android_usb/android0/idVendor |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 33 | echo "D002" > /sys/class/android_usb/android0/idProduct |
| 34 | echo "adb" > /sys/class/android_usb/android0/functions |
| 35 | echo "1" > /sys/class/android_usb/android0/enable |
| 36 | |
| 37 | sleep 4 |