-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
@@ -153,14 +153,15 @@ fi | |||
# Check whether a device is connected at all and, if configured, the serial matches | |||
# No device connected: | |||
ADBOPTS="" | |||
if [ -z "$(adb devices|egrep "^[0-9A-Za-z.:]+\s+device$"|awk '{print $1}')" ]; then | |||
|
|||
if [ -z "$(adb devices|grep -E "^[0-9A-Za-z]+[^ ]+device"|awk '{print $1}')" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a completely different logic: 1) you removed the "end of string" marker, and 2) most likely broke the spacing. An expected string would look like:
0123456789ABCDEF device
012.34:56789ABCD device
which matches the regex ^[0-9A-Za-z.:]+\s+device$
: {string containing only alpha-numerics, dots and colons} {followed by at least one white space} {followed by the literal term "device"} {end-of-string}. Your [^ ]
, instead of "white spaces" would match "everything but a blank". It probably works for you right now as there's a "tab" in that place, but it might break for others. You also removed .:
from the device name, which is definitely needed there (some devices have it; your replacement currently still works, but only if the two are separated by a tab).
What broke there with the original regex? We need to fix that in some other way. The output of adb devices
you get would enable me to help out :)
echo "No device found. Make sure you have connected your device with" | ||
echo "USB debugging enabled, and try again." | ||
echo | ||
exit 2 | ||
fi | ||
|
||
serials=($(adb devices|egrep "^[0-9A-Za-z.:]+\s+device$"|awk '{print $1}')) | ||
serials=($(adb devices|grep -E "^[0-9A-Za-z]+[^ ]+device"|awk '{print $1}')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for line 157 here.
@@ -221,7 +222,7 @@ fi | |||
# What Android version shall we assume (for specific features)? Do not evaluate if user has configured an override. | |||
[[ -z "${DEVICE_SDKVER}" ]] && DEVICE_SDKVER=$(adb shell "getprop ro.build.version.sdk") | |||
DEVICE_SDKVER=${DEVICE_SDKVER//[$'\t\r\n']} | |||
|
|||
#DEVICE_SDKVER=23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for testing I guess, and can be removed?
You're damn right, I broke the logic on the spacing part... weird it was working! |
Thanks Jim. I've checked my regex against your Thanks for the update, too. As it still lacks the And while TL;DR: Could you please check if the |
You got it right! |
Thanks a lot! Looks very good now, so I'm merging this. May I ask you to add your configuration to #7 then? |
Done, thanks again! |
PR corresponding to issue #23