Skip to content

Commit

Permalink
Enable headphones on boot
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Apr 30, 2017
1 parent b59cfb3 commit 82426fa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
21 changes: 20 additions & 1 deletion simpleimage/make_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ EOF
do_chroot systemctl enable eth0-mackeeper
}

add_enable_headphones_service() {
cat > "$DEST/etc/systemd/system/pinebook-headphones.service" <<EOF
[Unit]
Description=Enable headpohones
After=systemd-modules-load.service local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/pinebook_enable_headphones.sh
[Install]
WantedBy=multi-user.target
EOF
do_chroot systemctl enable pinebook-headphones
}

add_corekeeper_service() {
cat > "$DEST/etc/systemd/system/cpu-corekeeper.service" <<EOF
[Unit]
Expand Down Expand Up @@ -398,10 +414,13 @@ EOF
add_mackeeper_service
add_corekeeper_service
add_ssh_keygen_service
if [ "$MODEL" == "pinebook" ]; then
add_enable_headphones_service
add_hall_module_autoload
fi
add_disp_udev_rules
add_wifi_module_autoload
add_disp_module_autoload
add_hall_module_autoload
add_asound_state
sed -i 's|After=rc.local.service|#\0|;' "$DEST/lib/systemd/system/[email protected]"
rm -f "$DEST/second-phase"
Expand Down
13 changes: 13 additions & 0 deletions simpleimage/platform-scripts/pinebook_enable_headphones.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -xe

cd /sys/class/gpio

if [ ! -d gpio362 ]; then
echo 362 > export
fi

cd gpio362
echo out > direction
echo 1 > value
13 changes: 13 additions & 0 deletions simpleimage/platform-scripts/pinebook_enable_uart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -xe

cd /sys/class/gpio

if [ ! -d gpio362 ]; then
echo 362 > export
fi

cd gpio362
echo out > direction
echo 0 > value

0 comments on commit 82426fa

Please sign in to comment.