Skip to content

Commit 4515589

Browse files
author
Helio
committed
Fix #6
1 parent 249ee83 commit 4515589

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

load

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ function load() {
1616
progress_bar 0
1717
while read line; do
1818
line=$(printf '%s\r' "$line" | xxd -p | tr -d '\n')
19-
result=$(gatttool -i hci0 \
20-
-n $line \
19+
for ((index=0; index<${#string}; index+=180)); do
20+
result=$(gatttool -i hci0 \
21+
-n ${string:index:180} \
2122
-a 0x0031 \
2223
-b "$mac_address" \
2324
--char-write-req 2>&1)
24-
if [[ "$result" != "Characteristic value was written successfully" ]]; then
25-
printf "\n%s\n" "$result"
26-
exit 1
27-
fi
25+
if [[ "$result" != "Characteristic value was written successfully" ]]; then
26+
printf "\n%s\n" "$result"
27+
exit 1
28+
fi
29+
done
2830
((counter++))
2931
percentage="$(bc <<< "scale=2; (${counter}/${lines})*100")"
3032
progress_bar "${percentage%.*}"

0 commit comments

Comments
 (0)