This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See also https://techblog.badoo.com/blog/2016/07/21/segregating-android-devices-for-docker-containers/ | |
Two patches in one: | |
1. Filter devices by USB VID:PID and USB bus device on Linux, in case you need to segregate devices onto different | |
ADB dameons running on different server ports (like we needed several groups of Samsung phones, and they re-use | |
their VID:PID for ALL devives): | |
ADB_DEV_BUS_USB=/dev/bus/usb/bus01 \ | |
ADB_VID_PID_FILTER=1234:8794,1344:2334 \ | |
ANDROID_ADB_SERVER_PORT=9123 adb devices |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[14:31:30]~/git/bma-calabash (CAL-2855_Try_JRuby)$ cd .. | |
[14:32:00]~/git$ cd bma-calabash | |
ruby-2.3.3,:engine=>jruby,:engine_version=>9.1.11.0-SNAPSHOT is not installed. | |
To install do: 'rvm install ruby-2.3.3,:engine=>jruby,:engine_version=>9.1.11.0-SNAPSHOT' | |
[14:32:03]~/git/bma-calabash (CAL-2855_Try_JRuby)$ rvm install 'ruby-2.3.3,:engine=>jruby,:engine_version=>9.1.11.0-SNAPSHOT' | |
Unknown ruby interpreter version (do not know how to handle): :engine=>jruby. | |
Unknown ruby interpreter version (do not know how to handle): :engine_version=>9.1.11.0-SNAPSHOT. | |
Already installed ruby-2.3.3. | |
To reinstall use: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp | |
index f9ba7cbc2..f805ab9b4 100644 | |
--- a/adb/client/usb_linux.cpp | |
+++ b/adb/client/usb_linux.cpp | |
@@ -120,6 +120,71 @@ static inline bool contains_non_digit(const char* name) { | |
return false; | |
} | |
+static int iterate_numbers(const char* list, int* rejects) { | |
+ const char* p = list; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usbreset_serials() { | |
echo Resetting.. May cause devices to move - files to ioctl/vanish. | |
xargs -t | | |
sed 's/\/serial/\/uevent/g' | | |
xargs -tr grep -h DEVNAME= | | |
sed 's/DEVNAME=/\/dev\//' | | |
xargs -trn1 sudo $(dirname $0)/usbreset | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Implementation of https://en.wikipedia.org/wiki/Longest_common_subsequence_problem in old-ish BASH | |
# because my Android emulator doesn't have diff on it. | |
# Seriously bogs down on files >100 lines | |
# Could implement the common head and tail trimming efficiency. | |
XL=() | |
XC=() | |
while IFS= read -r line || [[ "$line" ]] ; do XL+=("$line") ; XC+=($(echo "$line" | cksum | tr ' ' -)) ; done < ${1?First filename required} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
[09:18:58]node 6635 root cwd DIR 254,1 12288 14943924 /local/buildAgent/work/dcce385aab59e3da/bma-calabash | |
[09:18:58]node 6635 root rtd DIR 0,188 4096 75761720 / | |
[09:18:58]node 6635 root txt REG 0,188 29055080 36438248 /usr/bin/node | |
[09:18:58]node 6635 root mem REG 254,1 36438248 /usr/bin/node (path dev=0,188) | |
[09:18:58]node 6635 root mem REG 254,1 36176220 /lib/x86_64-linux-gnu/libc-2.24.so (path dev=0,188) | |
[09:18:58]node 6635 root mem REG 254,1 36176248 /lib/x86_64-linux-gnu/libpthread-2.24.so (path dev=0,188) | |
[09:18:58]node 6635 root mem REG 254,1 3409779 /lib/x86_64-linux-gnu/libgcc_s.so.1 (path dev=0,188) | |
[09:18:58]node 6635 root mem REG 254,1 36176228 /lib/x86_64-linux-gnu/libm-2.24.so (path dev=0,188) | |
[09:18:58]node 6635 root mem REG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/adb/adb.cpp b/adb/adb.cpp | |
index 6b30be884..e05b707ed 100644 | |
--- a/adb/adb.cpp | |
+++ b/adb/adb.cpp | |
@@ -664,7 +664,13 @@ static void ReportServerStartupFailure(pid_t pid) { | |
while (static_cast<size_t>(i) < lines.size()) fprintf(stderr, "%s\n", lines[i++].c_str()); | |
} | |
+const char* env_adb_server_autostart = "ADB_SERVER_AUTOSTART"; | |
int launch_server(const std::string& socket_spec) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
uidump=/tmp/${0##*/}.$$ | |
unsyncd_uidump_matching_lines() { | |
adb shell 'rm -f /sdcard/dump.* && uiautomator dump /sdcard/dump.xml 2>/sdcard/dump.err && cat /sdcard/dump.xml' | | |
tr '<' "\n" | | |
tee $uidump.full | | |
grep -Ei "$1" | | |
xargs -rn1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -ple 'while (/>(<.*?>)/) { | |
s{>(<.*?>)([^<]*)}{ | |
$i++; | |
$i-=1 if substr($1,0,2) eq "</"; | |
$s=">\n".(" "x$i).$1.$2; | |
$i-=1 if substr($1,0,2) eq "</" or $2 ne ""; | |
$i-=2 if substr($1,0,2) eq "</" and $2 ne ""; | |
$i-=1 if substr($1,-2) eq "/>"; | |
$s | |
}e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ! [[ -f "$1" ]] ; then echo "Usage: $0 file-to-edit" ; exit 42 ; fi | |
FILE=$1 | |
if [[ -f "$FILE~" ]] && ! diff -u $FILE $FILE~ ; then | |
echo Resolve or ignore above diffs. Quitting. ; echo rm $FILE~ ; exit 42 | |
fi | |
cp $FILE $FILE~ | |
help() { echo "Try" ; grep -E ') *#' $0 ; echo "And ^d to abort" ; } | |
help | |
while echo -n ": " ; read ; do |