Skip to content

Commit 82426fa

Browse files
committed
Enable headphones on boot
1 parent b59cfb3 commit 82426fa

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

simpleimage/make_rootfs.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,22 @@ EOF
181181
do_chroot systemctl enable eth0-mackeeper
182182
}
183183

184+
add_enable_headphones_service() {
185+
cat > "$DEST/etc/systemd/system/pinebook-headphones.service" <<EOF
186+
[Unit]
187+
Description=Enable headpohones
188+
After=systemd-modules-load.service local-fs.target
189+
190+
[Service]
191+
Type=oneshot
192+
ExecStart=/usr/local/sbin/pinebook_enable_headphones.sh
193+
194+
[Install]
195+
WantedBy=multi-user.target
196+
EOF
197+
do_chroot systemctl enable pinebook-headphones
198+
}
199+
184200
add_corekeeper_service() {
185201
cat > "$DEST/etc/systemd/system/cpu-corekeeper.service" <<EOF
186202
[Unit]
@@ -398,10 +414,13 @@ EOF
398414
add_mackeeper_service
399415
add_corekeeper_service
400416
add_ssh_keygen_service
417+
if [ "$MODEL" == "pinebook" ]; then
418+
add_enable_headphones_service
419+
add_hall_module_autoload
420+
fi
401421
add_disp_udev_rules
402422
add_wifi_module_autoload
403423
add_disp_module_autoload
404-
add_hall_module_autoload
405424
add_asound_state
406425
sed -i 's|After=rc.local.service|#\0|;' "$DEST/lib/systemd/system/[email protected]"
407426
rm -f "$DEST/second-phase"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
cd /sys/class/gpio
6+
7+
if [ ! -d gpio362 ]; then
8+
echo 362 > export
9+
fi
10+
11+
cd gpio362
12+
echo out > direction
13+
echo 1 > value
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
cd /sys/class/gpio
6+
7+
if [ ! -d gpio362 ]; then
8+
echo 362 > export
9+
fi
10+
11+
cd gpio362
12+
echo out > direction
13+
echo 0 > value

0 commit comments

Comments
 (0)