@Kreeblah
Thanks for your report and research+solution. Indeed we currently add the path with platform/ inside: https://github.com/Fourdee/DietPi/blob/dev/dietpi/func/dietpi-set_hardware#L850-L869
They mention this changed with Ubuntu 18.04 but I guess it's about the kernel version. We either need to verify, that on all our images the required kernel will be installed (at least with first run update), or somehow add a file check to the service to automatically choose the right files.
€:
If you're using Ubuntu 18.04 on C2, enter the following commands instead.
Ah wait, does this mean it changed on C2 only, not on C1? 🤔
@Kreeblah @Fourdee
Added PR for auto detection: https://github.com/Fourdee/DietPi/pull/2265
Theoretically it can still fail, when APT update to the new kernel version is done. Then user would need to re-enable the LCD without an LCD (e.g. after reboot). Not sure if we can assume that on Jessie the config files remain the same and on Stretch, with next dietpi-update, APT updates the kernel accordingly?
Then we could use config files based on G_DISTRO and simply update the service file for all C1/2 Stretch systems on patch_file.
C2
root@DietPi:~# find /sys -name pwm*
/sys/bus/platform/devices/pwm
/sys/bus/platform/devices/pwm-ctrl
/sys/devices/pwm
/sys/devices/pwm-ctrl
root@DietPi:~# ls -lha /sys/devices/pwm-ctrl/
driver/ enable0 modalias subsystem/
duty0 freq0 power/ uevent
🈯️
root@DietPi:~# [[ -e '/sys/devices/pwm-ctrl/enable0' ]] && fp_control='/sys/devices/pwm-ctrl'
root@DietPi:~# echo $fp_control
/sys/devices/pwm-ctrl
@Fourdee
Do you have a chance to check on Jessie?
@MichaIng
1 sec, fails on install due to not modprobe, dir not available.
Testing https://github.com/Fourdee/DietPi/commit/5c1e0f88e0c4183c5be4130cd8ce245304137da5:
@Fourdee
Ah makes sense. Is anyway food to use modprobe where possible, so we can start service directly skip reboot requirement as well?
@MichaIng
so we can start service directly skip reboot requirement as well?
In theory yep 👍
Jessie working fine 👍
root@DietPi:~# cat /etc/systemd/system/odroid-lcd35.service
[Unit]
Description=Odroid LCD 3.5
[Path]
PathExists=/dev/fb2
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'echo 500000 > /sys/devices/platform/pwm-ctrl/freq0'
ExecStart=/bin/bash -c 'echo 1 > /sys/devices/platform/pwm-ctrl/enable0'
ExecStart=/bin/bash -c 'echo 1023 > /sys/devices/platform/pwm-ctrl/duty0'
ExecStart=/usr/bin/setterm -blank 0 -powersave off
ExecStart=/bin/con2fbmap 1 2
StandardOutput=tty
[Install]
WantedBy=multi-user.target
root@DietPi:~# ls -lha /sys/devices/platform/pwm-ctrl/freq0
-rwxrwxrwx 1 root root 4.0K Nov 20 20:11 /sys/devices/platform/pwm-ctrl/freq0
Completed. Thanks @MichaIng