Skip to content

Commit beb358f

Browse files
author
Helio
committed
Fixed error handling
Untested
1 parent 20d56dc commit beb358f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

load

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ function load() {
1616
progress_bar 0
1717
while read line; do
1818
line=$(printf '%s\r' "$line" | xxd -p | tr -d '\n')
19-
gatttool -i hci0 \
19+
result=$(gatttool -i hci0 \
2020
-n $line \
2121
-a 0x0031 \
2222
-b "$mac_address" \
23-
--char-write-req 1>/dev/null
24-
if [[ $? != 0 ]]; then
25-
echo "Error uploading."
23+
--char-write-req 1>/dev/null)
24+
if [[ "$result" != "Characteristic value was written successfully" ]]; then
25+
echo "$result"
2626
exit 1
2727
fi
2828
((counter++))

0 commit comments

Comments
 (0)