Skip to content

Commit

Permalink
added hardware-observer to plugs for Raspberry Pi
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed Aug 29, 2024
1 parent 2585e87 commit de4fa2c
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 10 deletions.
24 changes: 21 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ clean:
export SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1
snapcraft clean

iterate target="humble":
iterate target="jazzy":
#!/bin/bash
start_time=$(date +%s)

Expand Down Expand Up @@ -83,7 +83,7 @@ iterate target="humble":

swap-enable:
#!/bin/bash
sudo fallocate -l 3G /swapfile
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Expand Down Expand Up @@ -114,4 +114,22 @@ publish:
#!/bin/bash
export SNAPCRAFT_STORE_CREDENTIALS=$(cat exported.txt)
snapcraft login
snapcraft upload --release edge husarion-astra*.snap
snapcraft upload --release edge husarion-depthai*.snap

list-lxd-cache:
#!/bin/bash
sudo du -h --max-depth=1 /var/snap/lxd/common/lxd/storage-pools/default/containers/ | sort -h

remove-lxd-cache:
#!/bin/bash
lxc project switch snapcraft

for container in $(lxc list --format csv -c n); do
lxc delete $container --force
done

echo "verify:"
sudo du -h --max-depth=1 /var/snap/lxd/common/lxd/storage-pools/default/containers/
df -h

lxc project switch default
41 changes: 37 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,23 @@ slots:
interface: shared-memory
write: ['*'] # paths are relative to /dev/shm

c189-slot:
interface: custom-device
custom-device: c189
files:
write:
- /run/udev/data/c189:*

plugs:
shm-plug:
interface: shared-memory
shared-memory: shm-slot
private: false

c189-plug:
interface: custom-device
custom-device: c189

apps:

daemon:
Expand All @@ -71,8 +82,8 @@ apps:
husarion-depthai:
command: usr/bin/launcher.sh
command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh]
plugs: [network, network-bind, shm-plug, raw-usb]
# plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support]

plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support]
# block-devices,
slots: [shm-slot]
extensions: [ros2-jazzy-ros-base]
Expand Down Expand Up @@ -115,7 +126,7 @@ parts:
version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')"
[ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
craftctl set version="$version"
craftctl set grade="$grade"
craftctl set grade="stable"

Expand Down Expand Up @@ -149,4 +160,26 @@ parts:
craftctl default
cp $CRAFT_PART_BUILD/yq $CRAFT_PRIME/usr/bin/yq
chmod +x $CRAFT_PRIME/usr/bin/yq
rm -rf $CRAFT_PRIME/local-ros
rm -rf $CRAFT_PRIME/local-ros
fix-execstack:
plugin: nil
after:
- husarion-depthai
- local-files
- husarion-snap-common
build-packages:
- execstack
override-prime: |
set -eu
craftctl default
choosen_files=(
usr/lib/x86_64-linux-gnu/libamdhip64.so*
)
for f in "${choosen_files[@]}"; do
if [ -f "$f" ]; then
execstack -c "$f"
fi
done
4 changes: 1 addition & 3 deletions snapcraft_template.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ apps:
husarion-depthai:
command: usr/bin/launcher.sh
command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh]
plugs: [network, network-bind, shm-plug, raw-usb]
# plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support]
# block-devices,
plugs: [network, network-bind, shm-plug, raw-usb, hardware-observe]
slots: [shm-slot]
extensions: [ros2-{{ ros_distro }}-ros-base]

Expand Down

0 comments on commit de4fa2c

Please sign in to comment.