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

Added PINE64 support for system binding and gpio closes #310 #322

Merged
merged 2 commits into from
Feb 9, 2018
Merged
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
16 changes: 16 additions & 0 deletions functions/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ permissions_corrections() {
echo "FAILED (please execute after openHAB was installed)"
exit 1
fi

if is_pine64; then
cond_redirect groupadd gpio
cond_redirect cp $BASEDIR/includes/PINE64-80-gpio-noroot.rules /etc/udev/rules.d/80-gpio-noroot.rules
cond_redirect sed -i -e '$i \chown -R root:gpio /sys/class/gpio \n' /etc/rc.local
cond_redirect sed -i -e '$i \chmod -R ug+rw /sys/class/gpio \n' /etc/rc.local
fi

cond_redirect adduser openhab dialout
cond_redirect adduser openhab tty
cond_redirect adduser openhab gpio
Expand Down Expand Up @@ -217,6 +225,14 @@ pine64_platform_scripts() {
fi
}

pine64_fix_systeminfo_binding() { # This will maybe be fixed upstreams some day. Keep an eye open.
echo -n "$(timestamp) [openHABian] Enable PINE64 support for systeminfo binding... "
cond_redirect apt install -y udev:armhf
cond_redirect ln -s /lib/arm-linux-gnueabihf/ /lib/linux-arm
cond_redirect ln -s /lib/linux-arm/libudev.so.1 /lib/linux-arm/libudev.so
if [ $? -eq 0 ]; then echo "OK"; else echo "FAILED"; fi
}

pine64_fixed_mac() {
echo -n "$(timestamp) [openHABian] Assigning fixed MAC address to eth0 (longsleep)... "
if ! grep -q "mac_addr=" /boot/uEnv.txt; then
Expand Down
7 changes: 7 additions & 0 deletions includes/PINE64-80-gpio-noroot.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# /etc/udev/rules.d/80-gpio-noroot.rules
# Corrects sys GPIO permissions on the Pine64 so non-root users in the gpio group can manipulate bits
#
# Change group to gpio
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chown -R root:gpio /sys/devices/soc.0/*pinctrl/gpio'"
# Change user permissions to ensure user and group have read/write permissions
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chmod -R ug+rw /sys/devices/soc.0/*pinctrl/gpio'"
1 change: 1 addition & 0 deletions openhabian-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if [[ -n "$UNATTENDED" ]]; then
if is_pi; then memory_split; enable_rpi_audio; fi
if is_pine64; then pine64_platform_scripts; fi
if is_pine64; then pine64_fixed_mac; fi
if is_pine64; then pine64_fix_systeminfo_binding; fi
basic_packages
needed_packages
bashrc_copy
Expand Down