Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ev3-toolbox-matlab
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mindstorms
ev3-toolbox-matlab
Merge requests
!11
Dev ubuntu20.04
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Dev ubuntu20.04
dev_ubuntu20.04
into
master
Overview
13
Commits
13
Pipelines
0
Changes
5
All threads resolved!
Show all comments
Merged
Dev ubuntu20.04
Dominik Mehlem
requested to merge
dev_ubuntu20.04
into
master
Nov 3, 2021
Overview
13
Commits
13
Pipelines
0
Changes
5
All threads resolved!
Show all comments
Integrate changes needed for the Ubuntu20.04-based ISO.
0
0
Merge request reports
Compare
master
version 2
34dae9f5
Nov 4, 2021
version 1
505f74d3
Nov 3, 2021
master (base)
and
latest version
latest version
1ad526bc
13 commits,
Nov 4, 2021
version 2
34dae9f5
12 commits,
Nov 4, 2021
version 1
505f74d3
11 commits,
Nov 3, 2021
5 files
+
607
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
tools/btbind
0 → 100755
+
110
−
0
View file @ 1ad526bc
Edit in single-file editor
Open in Web IDE
Show comments on this file
#!/bin/bash
# script to ease connecting to an EV3 brick
# (c) 2018 Johannes Sauer
# (c) 2007-2009 Johannes Ballé
# test if syntax is correct; if not, print help and exit
if
[
$#
=
0
-o
$#
-gt
2
]
||
[
"
$1
"
=
"--help"
-o
"
$1
"
=
"-h"
]
||
!
{
[
$#
=
1
]
||
[
"
$2
"
-ge
0
]
2>/dev/null
;
}
;
then
cat
<<-
END_HELP
>&2
${
0
##*/
}
<device name> [rfcomm device number]
${
0
##*/
}
establishes a persistent connection to the device name given
in the first argument. The second, optional argument
specifies which rfcomm device should be used. If omitted, the first
available device will be used.
The device needs to be paired already. Use the Bluetooth setting GUI to do this.
The device will be bound to the device number. Connection is established, once
it is used.
Examples:
${
0
##*/
}
EV3-20-B 2
This connects the EV3 brick named "EV3-20-B" to rfcomm2.
${
0
##*/
}
00:16:53:06:D8:67
This connects the EV3 brick with the hardware address 00:16:53:06:D8:67
to the first available rfcomm device (if no others are used, this will
be rfcomm0).
Depending on your Linux distribution, you will find the rfcomm device file
either at /dev/rfcommX or /dev/bluetooth/rfcommX.
END_HELP
exit
128
fi
# if device name is given, check if it's already used
if
[
$#
=
2
]
;
then
((
DEVICE
=
$2
))
if
[
-e
/dev/rfcomm
$DEVICE
-o
-e
/dev/bluetooth/rfcomm
$DEVICE
]
;
then
echo
"rfcomm
$DEVICE
is already in use!"
exit
3
fi
fi
# get mac from device name
NAME
=
"
$1
"
MAC
=
$(
echo
-e
'devices \n'
| bluetoothctl |
awk
-F
' '
'$2 ~ /^([0-9a-fA-F]+:)+[0-9a-fA-F]+$/ && $3 == "'
"
$NAME
"
'" { print $2 }'
)
#MAC=$( hcitool scan | awk -F '\t' '$2 ~ /^([0-9a-fA-F]+:)+[0-9a-fA-F]+$/ && $3 == "'"$NAME"'" { print $2 }' )
if
[
-z
$MAC
]
;
then
echo
"not found. You have to pair the device first! Use the bluetooth setting GUI."
>
&2
exit
1
fi
if
[[
$MAC
==
*
\
*
]]
;
then
echo
"found multiple devices:"
>
&2
echo
>
&2
for
i
in
$MAC
;
do
echo
' '
$i
>
&2
done
echo
>
&2
echo
"Not supported by
${
0
##*/
}
. Make sure the devices have different names."
>
&2
exit
2
fi
echo
"found paired device
$MAC
."
>
&2
# if hardware address is given, we're all set. otherwise, perform a scan
# if [[ $1 =~ ^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$ ]]; then
# MAC=$1
# else
# NAME="$1"
# echo -n "Scanning for '$NAME' ... " >&2
# MAC=$( hcitool scan | awk -F '\t' '$2 ~ /^([0-9a-fA-F]+:)+[0-9a-fA-F]+$/ && $3 == "'"$NAME"'" { print $2 }' )
# if [ -z $MAC ]; then
# echo "not found." >&2
# exit 1
# fi
# if [[ $MAC == *\ * ]]; then
# echo "found multiple devices:" >&2
# echo >&2
# for i in $MAC; do
# echo ' '$i >&2
# done
# echo >&2
# echo "Use ${0##*/} with one of the addresses above." >&2
# exit 2
# fi
# echo "found $MAC." >&2
# fi
# if device is not given, find first unused device
if
[
-z
$DEVICE
]
;
then
((
DEVICE
=
0
))
while
[
-e
/dev/rfcomm
$DEVICE
-o
-e
/dev/bluetooth/rfcomm
$DEVICE
]
;
do
((
DEVICE++
))
done
fi
echo
"Binding rfcomm
${
DEVICE
}
to bluetooth device with address '
${
MAC
}
' ..."
rfcomm
bind
rfcomm
$DEVICE
$MAC
&
Loading