Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New component] HiFiBerry Sound Card & OnOff SHIM #2169

Merged
merged 59 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6475eeb
Add components folder to installation and docs. First component is hi…
pabera Dec 19, 2023
6639015
Allow for all hifiberry boards
pabera Dec 19, 2023
9d709b7
Disabling HDMI Audio
pabera Dec 20, 2023
9621133
Finalize HiFiBerry doc
pabera Dec 20, 2023
8b31685
Refer to Pi Pinout for convenience
pabera Dec 20, 2023
e1dfb53
Enable ALSA config as an option as well
pabera Dec 20, 2023
8174d34
Allow script to be run multiple times
pabera Dec 20, 2023
6ce855c
Add OnOff SHIM as component
pabera Dec 21, 2023
701f8e3
Merge branch 'future3/develop' into future3/hifiberry-doc
pabera Dec 21, 2023
a62c036
Make script more robust based on PR comments
pabera Dec 25, 2023
0427214
Update hifiberry soundcard options
pabera Jan 1, 2024
c6df305
Automate soundcard detection for asound.conf
pabera Jan 1, 2024
bfaad30
use /boot/config based on debian version
pabera Jan 1, 2024
2cac674
Merge branch 'future3/develop' into future3/hifiberry-doc
pabera Jan 2, 2024
0da4d73
Reorganize a few things
pabera Jan 2, 2024
2aa6f47
some bugfixes
pabera Jan 2, 2024
e18189b
Final fixes
pabera Jan 2, 2024
9cebeaa
Optimize case
pabera Jan 2, 2024
348413c
Update docs
pabera Jan 2, 2024
99df470
Merge branch 'future3/develop' into future3/hifiberry-doc
pabera Jan 4, 2024
56cddb7
Uninstall option
pabera Jan 11, 2024
2cf5516
fix: Remove option was not reachable
pabera Jan 11, 2024
1679be2
fix: enable sudo
pabera Jan 11, 2024
240a938
fix: make I/O fail silently
pabera Jan 11, 2024
f3e0bb8
feat: Introduce 1-line installation
pabera Jan 12, 2024
0aa34ad
feat: outsource onboard_sound as its own option
pabera Jan 12, 2024
251224a
refactor: remove alsa config
pabera Jan 12, 2024
3abef5f
fix: update case function
pabera Jan 12, 2024
61aa460
fix: adding some thens
pabera Jan 12, 2024
ee0c47c
fix: some iterations did not work
pabera Jan 12, 2024
165e07e
fix: adding another sudo
pabera Jan 12, 2024
dc89268
refactor: get_key_by_item_number for associated arrays
pabera Jan 12, 2024
7758da6
refactor: remove last bits of alsa
pabera Jan 12, 2024
cda18f9
fix: final touches
pabera Jan 12, 2024
8e584b7
fix: add missing removal only option
pabera Jan 12, 2024
3740abb
fix: outsource example_usage for 1-line install
pabera Jan 12, 2024
35189e0
fix: condition for 1-line installation
pabera Jan 12, 2024
fd67e1e
fix: another fix for if conditions
pabera Jan 12, 2024
00e03ed
refactor: move 1-line installation down
pabera Jan 12, 2024
4ff95a1
gs
pabera Jan 12, 2024
2434315
another fix
pabera Jan 12, 2024
38797d2
fix: write array check differently
pabera Jan 12, 2024
cd31cf5
refactor: final touches
pabera Jan 12, 2024
8e0707f
feat: enable silent mode for check_existing_hifiberry
pabera Jan 12, 2024
b66c430
fix: reintroduce sudo check
pabera Jan 12, 2024
3e217cc
fix: documentation
pabera Jan 12, 2024
4aa34bf
fix: final touches again
pabera Jan 13, 2024
d1e2f58
fix: remove is_sudo again
pabera Jan 13, 2024
a43bafd
fix: Remove last sudo occurrences
pabera Jan 13, 2024
8e16955
fix: bullet proof
pabera Jan 14, 2024
8c96690
Make bash files executable
pabera Jan 14, 2024
b9f1ed6
fix: Update documentation
pabera Jan 14, 2024
66acd47
fix: 1-line path does not worj
pabera Jan 14, 2024
709f576
Update documentation/builders/components/soundcards/hifiberry.md
pabera Jan 15, 2024
09b6e48
Update documentation/builders/components/soundcards/hifiberry.md
pabera Jan 15, 2024
83b5d99
Update documentation/builders/components/soundcards/hifiberry.md
pabera Jan 15, 2024
94e9bcf
fix: Update regex for commented code
pabera Jan 16, 2024
daf396e
Merge branch 'future3/develop' into future3/hifiberry-doc
pabera Jan 16, 2024
4cb9ffd
Adding OnOff Shim resource
pabera Jan 16, 2024
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 documentation/builders/components/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Phoniebox components directory
pabera marked this conversation as resolved.
Show resolved Hide resolved

* [Hifberry](./hifiberry.md)
pabera marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 41 additions & 0 deletions documentation/builders/components/hifiberry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# HiFiBerry

## Automatic setup

Use this install script to enable your HiFiBerry board.

```
$ cd; cd ~/RPi-Jukebox-RFID/installation/components && chmod +x setup-hifiberry.sh && sudo ./setup_hifiberry.sh
```

## Manual steps to enable sound through HiFiBerry board

1. Make sure your onboard sound of your Raspberry Pi is disabled. Check `/boot/config.txt`. The installation
pabera marked this conversation as resolved.
Show resolved Hide resolved

```
dtparam=audio=off
```

2. Run the following command to enable HiFiBerry boards.

```
echo "dtoverlay=hifiberry-dac" | sudo tee -a /boot/config.txt
```

3. Enable volume control. Create or edit the following file: `sudo vi /etc/asound.conf`
pabera marked this conversation as resolved.
Show resolved Hide resolved

```
pcm.hifiberry {
type softvol
slave.pcm "plughw:0"
control.name "HifiBerry"
control.card 0
}

pcm.!default {
type plug
slave.pcm "hifiberry"
}
```

4. Restart your device.
38 changes: 38 additions & 0 deletions installation/components/setup_hifiberry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Check if the script is run as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi

# Disable onboard sound of Raspberry Pi
echo "Disabling onboard sound..."
sed -i '/dtparam=audio=on/c\dtparam=audio=off' /boot/config.txt
pabera marked this conversation as resolved.
Show resolved Hide resolved

# Enable HiFiBerry board
echo "Enabling HiFiBerry board..."
grep -qxF 'dtoverlay=hifiberry-dac' /boot/config.txt || echo 'dtoverlay=hifiberry-dac' >> /boot/config.txt

# Backup asound.conf
if [ -f /etc/asound.conf ]; then
echo "Backing up existing asound.conf..."
cp /etc/asound.conf "/etc/asound.conf.backup.$(date +%Y%m%d%H%M%S)"
fi

echo "Configuring sound settings..."
cat > /etc/asound.conf << EOF
pcm.hifiberry {
type softvol
slave.pcm "plughw:0"
control.name "HifiBerry"
control.card 0
pabera marked this conversation as resolved.
Show resolved Hide resolved
}

pcm.!default {
type plug
slave.pcm "hifiberry"
}
EOF

echo "Configuration complete. Please restart your device."