Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile.agnos
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ COPY ./userspace/files/avahi-override.conf /etc/systemd/system/avahi-daemon.serv
# Prevent polkitd memory leak from getting out of hand by restarting it every ~day
COPY ./userspace/files/polkit-override.conf /etc/systemd/system/polkit.service.d/override.conf

# Ensure bluetoothd starts after BT HCI is initialized
COPY ./userspace/files/bluetooth-override.conf /etc/systemd/system/bluetooth.service.d/override.conf

# Remove qt network bearer plugins
RUN rm -rf /usr/lib/aarch64-linux-gnu/qt5/plugins/bearer

Expand Down
3 changes: 3 additions & 0 deletions userspace/files/bluetooth-override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Unit]
After=bt-hci.service
Requires=bt-hci.service
14 changes: 14 additions & 0 deletions userspace/files/bt-hci.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Bluetooth HCI
After=init-qcom.service
Before=bluetooth.service

[Service]
Type=forking
ExecStart=/usr/comma/bt_init.sh
ExecStop=/usr/bin/killall hciattach
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions userspace/install_extras.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

apt-fast update && apt-fast install -y --no-install-recommends \
bash-completion \
bluez \
btop \
hyperfine \
iperf \
iperf3 \
dnsmasq \
irqtop \
rfkill \
ripgrep \
ncdu \
nfs-common \
Expand Down
1 change: 1 addition & 0 deletions userspace/services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ systemctl enable agnos-debug.service
systemctl enable gpio.service
systemctl enable lte.service
systemctl enable sound.service
systemctl enable bt-hci.service
systemctl enable magic.service
systemctl enable init-qcom.service
systemctl enable varwatch.service
Expand Down
27 changes: 27 additions & 0 deletions userspace/usr/comma/bt_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Initialize WCN3990 Bluetooth adapter on comma four

set -e

# Kill any stale hciattach
killall hciattach 2>/dev/null || true
sleep 1

# Power cycle BT chip via btpower ioctl (off then on)
python3 -c "import fcntl,os; fd=os.open('/dev/btpower',os.O_RDWR); fcntl.ioctl(fd,0xbfad,0); os.close(fd)" 2>/dev/null || true
sleep 2
python3 -c "import fcntl,os; fd=os.open('/dev/btpower',os.O_RDWR); fcntl.ioctl(fd,0xbfad,1); os.close(fd)"
sleep 3

# Unblock bluetooth
rfkill unblock bluetooth
sleep 1

# Attach UART — forks a daemon child that maintains hci0
hciattach -s 115200 /dev/ttyHS1 qualcomm 115200 flow

# Wait for hci0 to appear (hciattach daemon initializes async)
for i in $(seq 1 10); do
hciconfig hci0 up 2>/dev/null && break
sleep 1
done
2 changes: 2 additions & 0 deletions userspace/uv/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ dependencies = [

# hardware.py
"dbus-python",
# glowd BLE
"bleak",
# amplifier.py
"smbus2",

Expand Down
211 changes: 211 additions & 0 deletions userspace/uv/uv.lock

Large diffs are not rendered by default.