1SUMMARY = "Bletchley Motor control"
2PR = "r1"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
5
6inherit obmc-phosphor-systemd
7
8RDEPENDS:${PN} += "bash"
9RDEPENDS:${PN} += "i2c-tools"
10RDEPENDS:${PN} += "libgpiod-tools"
11
12S = "${WORKDIR}"
13SRC_URI += " \
14    file://motor-ctrl \
15    file://motor-init \
16    file://power-ctrl \
17    "
18
19do_install() {
20        install -d ${D}${sbindir}
21        install -m 0755 ${WORKDIR}/power-ctrl ${D}${sbindir}
22
23        install -d ${D}${libexecdir}
24        install -m 0755 ${WORKDIR}/motor-ctrl ${D}${libexecdir}
25        install -m 0755 ${WORKDIR}/motor-init ${D}${libexecdir}
26}
27
28TGT = "${SYSTEMD_DEFAULT_TARGET}"
29MOTOR_INIT_INSTFMT="../motor-init-calibration@.service:${TGT}.wants/motor-init-calibration@{0}.service"
30PWR_ON_INSTFMT="host-poweron@.service:host-poweron@{0}.service"
31PWR_OFF_INSTFMT="host-poweroff@.service:host-poweroff@{0}.service"
32AC_ON_INSTFMT="../host-ac-on@.service:${TGT}.wants/host-ac-on@{0}.service"
33AC_OFF_INSTFMT="host-ac-off@.service:host-ac-off@{0}.service"
34
35SYSTEMD_SERVICE:${PN} += "motor-init-calibration@.service"
36SYSTEMD_LINK:${PN} += "${@compose_list(d, 'MOTOR_INIT_INSTFMT', 'OBMC_HOST_INSTANCES')}"
37
38SYSTEMD_SERVICE:${PN} += "host-poweron@.service"
39SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
40
41SYSTEMD_SERVICE:${PN} += "host-poweroff@.service"
42SYSTEMD_LINK:${PN} += "${@compose_list(d, 'PWR_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
43
44SYSTEMD_SERVICE:${PN} += "host-ac-on@.service"
45SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_ON_INSTFMT', 'OBMC_HOST_INSTANCES')}"
46
47SYSTEMD_SERVICE:${PN} += "host-ac-off@.service"
48SYSTEMD_LINK:${PN} += "${@compose_list(d, 'AC_OFF_INSTFMT', 'OBMC_HOST_INSTANCES')}"
49