Skip to content

Commit

Permalink
Add rsetup-config-aic8800-ttys1
Browse files Browse the repository at this point in the history
  • Loading branch information
RadxaYuntian committed Jan 2, 2024
1 parent 74527b9 commit 676381f
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions config/01-hciattach-ttys1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Allow config to continue when /dev/ttyS1 is not available
no_fail
# Attach UART Bluetooth on /dev/ttyS1
enable_service rsetup-hciattach@ttyS1
12 changes: 11 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Depends: device-tree-compiler,
yq,
u-boot-menu,
${misc:Depends},
Suggests: x-terminal-emulator
Suggests: aicrf-test,
x-terminal-emulator,
Description: Radxa system setup utility
Radxa system setup utility (rsetup) provides an user friendly menu to
perform many essential system configuration tasks. It also provides
Expand Down Expand Up @@ -55,3 +56,12 @@ Depends: rsetup (= ${binary:Version}),
${misc:Depends},
Description: Radxa system config - Attach UART Bluetooth on /dev/ttyS1
This package attaches UART Bluetooth on /dev/ttyS1 on boot.

Package: rsetup-config-aic8800-ttys1
Architecture: all
Section: admin
Priority: standard
Depends: rsetup (= ${binary:Version}),
${misc:Depends},
Description: Radxa system config - Attach AIC8800 Bluetooth on /dev/ttyS1
This package attaches AIC8800 Bluetooth on /dev/ttyS1 on boot.
2 changes: 2 additions & 0 deletions debian/rsetup-config-aic8800-ttys1.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config/00-aic8800-reset-ttys1.conf /usr/lib/rsetup/conf.d/on_boot
config/01-hciattach-ttys1.conf /usr/lib/rsetup/conf.d/on_boot
2 changes: 1 addition & 1 deletion debian/rsetup-config-hciattach-ttys1.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
config/00-hciattach-ttys1.conf /usr/lib/rsetup/conf.d/on_boot
config/01-hciattach-ttys1.conf /usr/lib/rsetup/conf.d/on_boot
12 changes: 12 additions & 0 deletions debian/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Reset AIC8800 Bluetooth on %I
Documentation=https://github.com/radxa-pkg/rsetup/
Requires=rsetup-hciattach@%i.device
Before=rsetup-hciattach@%i.device

[Service]
Type=forking
ExecStart=/usr/bin/rsetup __aic8800_reset %I

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ override_dh_builddeb:
dh_builddeb -- -Zxz

override_dh_installsystemd:
dh_installsystemd --name=aic8800-reset@
dh_installsystemd --name=rsetup-hciattach@
dh_installsystemd --name=rsetup
1 change: 1 addition & 0 deletions src/usr/lib/rsetup/cli/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# shellcheck source=src/usr/lib/rsetup/mod/utils.sh
source "/usr/lib/rsetup/mod/utils.sh"
source "/usr/lib/rsetup/mod/aic8800.sh"

source "/usr/lib/rsetup/cli/rconfig.sh"
source "/usr/lib/rsetup/cli/ssh.sh"
Expand Down
15 changes: 15 additions & 0 deletions src/usr/lib/rsetup/mod/aic8800.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# shellcheck shell=bash

__aic8800_reset() {
__parameter_count_check 1 "$@"

while read -r
do
if [[ "$REPLY" == "hci recv thread ready (nil)" ]]
then
return
fi
done < <(timeout 5 bt_test -s uart 1500000 "/dev/$1")

return 1
}

0 comments on commit 676381f

Please sign in to comment.