summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ampere/meta-jade')
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/gpio/id-button.bb29
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/id-button-pressed.service10
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/obmc/gpio/id_button5
-rwxr-xr-xmeta-ampere/meta-jade/recipes-phosphor/gpio/id-button/toggle_identify_led.sh45
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/leds/mtjade-led-manager-config/led.yaml12
-rw-r--r--meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend2
6 files changed, 102 insertions, 1 deletions
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button.bb b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button.bb
new file mode 100644
index 000000000..c19cdee18
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button.bb
@@ -0,0 +1,29 @@
+SUMMARY = "MTJade ID Button pressed application"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit obmc-phosphor-systemd
+
+DEPENDS += "virtual/obmc-gpio-monitor"
+RDEPENDS_${PN} += "virtual/obmc-gpio-monitor"
+
+SRC_URI += "file://toggle_identify_led.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/toggle_identify_led.sh \
+ ${D}${bindir}/toggle_identify_led.sh
+}
+
+SYSTEMD_ENVIRONMENT_FILE_${PN} +="obmc/gpio/id_button"
+
+ID_BUTTON_SERVICE = "id_button"
+
+TMPL = "phosphor-gpio-monitor@.service"
+INSTFMT = "phosphor-gpio-monitor@{0}.service"
+TGT = "multi-user.target"
+FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
+
+SYSTEMD_SERVICE_${PN} += "id-button-pressed.service"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'ID_BUTTON_SERVICE')}"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/id-button-pressed.service b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/id-button-pressed.service
new file mode 100644
index 000000000..0a97ed70c
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/id-button-pressed.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ID Button Pressed Service
+Wants=mapper-wait@-xyz-openbmc_project-led-groups.service
+After=mapper-wait@-xyz-openbmc_project-led-groups.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/toggle_identify_led.sh
+SyslogIdentifier=id-button
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/obmc/gpio/id_button b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/obmc/gpio/id_button
new file mode 100644
index 000000000..70e2b585b
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/obmc/gpio/id_button
@@ -0,0 +1,5 @@
+DEVPATH=/dev/input/by-path/platform-gpio-keys-event
+KEY=133
+POLARITY=1
+TARGET=id-button-pressed.service
+EXTRA_ARGS=--continue
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/toggle_identify_led.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
new file mode 100755
index 000000000..d62c84ae1
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Copyright (c) 2021 Ampere Computing LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Toggle the state of identify LED Group
+
+SERVICE="xyz.openbmc_project.LED.GroupManager"
+INTERFACE="xyz.openbmc_project.Led.Group"
+PROPERTY="Asserted"
+
+# Get enclosure_identify state
+identify_object=$(busctl tree $SERVICE --list | grep -m 1 identify)
+identify_state=$(busctl get-property $SERVICE $identify_object $INTERFACE $PROPERTY \
+ | awk '{print $NF;}')
+
+# Get enclosure_identify_blink state
+identify_blink_object=$(busctl tree $SERVICE --list | grep identify_blink)
+identify_blink_state=$(busctl get-property $SERVICE $identify_blink_object $INTERFACE $PROPERTY \
+ | awk '{print $NF;}')
+
+# Set state
+if [[ "$identify_state" == "false" && "$identify_blink_state" == "false" ]]; then
+ # Turn on the UID LED
+ busctl set-property $SERVICE $identify_object $INTERFACE $PROPERTY b true
+elif [[ "$identify_state" == "false" && "$identify_blink_state" == "true" ]]; then
+ # Turn off the UID LED when LED is blinking state
+ busctl set-property $SERVICE $identify_blink_object $INTERFACE $PROPERTY b false
+elif [[ "$identify_state" == "true" && "$identify_blink_state" == "false" ]]; then
+ # Turn off the UID LED
+ busctl set-property $SERVICE $identify_object $INTERFACE $PROPERTY b false
+else
+ echo "Invalid case! When identify_blink_state is true, the identify_state will set to false"
+fi
diff --git a/meta-ampere/meta-jade/recipes-phosphor/leds/mtjade-led-manager-config/led.yaml b/meta-ampere/meta-jade/recipes-phosphor/leds/mtjade-led-manager-config/led.yaml
index ba21c5860..3e321ed5c 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/leds/mtjade-led-manager-config/led.yaml
+++ b/meta-ampere/meta-jade/recipes-phosphor/leds/mtjade-led-manager-config/led.yaml
@@ -18,3 +18,15 @@ systemFault:
DutyOn: 50
Period: 0
Priority: 'Blink'
+
+enclosure_identify:
+ identify:
+ Action: 'On'
+ DutyOn: 50
+ Period: 1000
+
+enclosure_identify_blink:
+ identify:
+ Action: 'Blink'
+ DutyOn: 50
+ Period: 1000
diff --git a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
index c9538deb4..980d9261d 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -1,2 +1,2 @@
RDEPENDS_${PN}-extras_append_mtjade = " phosphor-webui phosphor-image-signing"
-RDEPENDS_${PN}-inventory_append_mtjade = " fault-monitor"
+RDEPENDS_${PN}-inventory_append_mtjade = " fault-monitor id-button"