Skip to content

Commit de4c056

Browse files
committed
[raspberrypi] Hook up BT controller to high-speed UART if Thunder Bluetooth stack is used (otherwise it's occupied by console)
1 parent 6ef029e commit de4c056

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

board/raspberrypi/post-image.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
88
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
99
BLUETOOTH=$(eval grep ^BR2_PACKAGE_WPEFRAMEWORK_BLUETOOTH=y ${BR2_CONFIG} | wc -l)
1010

11+
if [ ! "x${BLUETOOTH}" = "x" ]; then
12+
if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
13+
echo "Adding serial console to /dev/ttyS0 to config.txt."
14+
sed -i 's/ttyAMA0/ttyS0/g' "${BINARIES_DIR}/rpi-firmware/cmdline.txt"
15+
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
16+
# Fixes rpi3 ttyS0 serial console
17+
enable_uart=1
18+
__EOF__
19+
fi
20+
fi
21+
1122
for arg in "$@"
1223
do
1324
case "${arg}" in
@@ -158,14 +169,6 @@ __EOF__
158169
dtoverlay=pi3-miniuart-bt
159170
__EOF__
160171
fi
161-
else
162-
echo "Adding serial console to /dev/ttyS0 to config.txt."
163-
sed -i 's/ttyAMA0/ttyS0/g' "${BINARIES_DIR}/rpi-firmware/cmdline.txt"
164-
cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
165-
# Fixes rpi3 ttyS0 serial console
166-
enable_uart=1
167-
__EOF__
168-
169172
fi
170173
;;
171174
--rpi-wifi*)

package/wpe/wpeframework-plugins/wpeframework-plugins.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ WPEFRAMEWORK_PLUGINS_CONF_OPTS += -DPLUGIN_NETWORKCONTROL_INTERFACES='$(call qst
197197
endif
198198

199199
ifeq ($(BR2_PACKAGE_WPEFRAMEWORK_BLUETOOTH),y)
200+
#Prevent switching bluetooth to ttyS0
201+
export BLUETOOTH=1
200202
WPEFRAMEWORK_PLUGINS_CONF_OPTS += -DPLUGIN_BLUETOOTH=ON
201203
ifeq ($(BR2_PACKAGE_WPEFRAMEWORK_BLUETOOTH_AUTOSTART),y)
202204
WPEFRAMEWORK_PLUGINS_CONF_OPTS += -DPLUGIN_BLUETOOTH_AUTOSTART=true

0 commit comments

Comments
 (0)