All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Subject: [PATCH skeleton] skeleton: add a new dbus method System::getFRUArea(fru_id)
Date: Fri, 15 Apr 2016 03:00:59 -0500	[thread overview]
Message-ID: <1460707259-26459-2-git-send-email-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <1460707259-26459-1-git-send-email-openbmc-patches@stwcx.xyz>

From: Yi Li <adamliyi@msn.com>

This method will be used by ipmi-fru-parser to get fru area names defined
in ID_LOOKUP table. The ID_LOOKUP table defines FRUs that should be
present in the system.

Signed-off-by: Yi Li <adamliyi@msn.com>
---
 bin/system_manager.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/bin/system_manager.py b/bin/system_manager.py
index 004d978..05671e7 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -139,7 +139,23 @@ class SystemManager(Openbmc.DbusProperties,Openbmc.DbusObjectManager):
 	def getObjectFromByteId(self,category,key):
 		byte = int(key)
 		return self.doObjectLookup(category,byte)
-	
+
+	# Get the FRU area names defined in ID_LOOKUP table given a fru_id.
+	# If serval areas are defined for a fru_id, the areas are returned
+	# together as a string with each area name seperated with ','.
+	# If no fru area defined in ID_LOOKUP, an empty string will be returned.
+	@dbus.service.method(DBUS_NAME,
+		in_signature='y', out_signature='s')
+	def getFRUArea(self,fru_id):
+		ret_str = ''
+		fru_id = '_' + str(fru_id)
+		area_list = [area for area in System.ID_LOOKUP['FRU_STR'].keys() \
+				if area.endswith(fru_id)]
+		for area in area_list:
+			ret_str = area + ',' + ret_str
+		# remove the last ','
+		return ret_str[:-1]
+
 	def start_process(self,name):
 		if (System.APPS[name]['start_process'] == True):
 			app = System.APPS[name]
-- 
2.7.1

      reply	other threads:[~2016-04-15  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  8:00 [PATCH skeleton] skeleton: add a new dbus method System::getFRUArea(fru_id) OpenBMC Patches
2016-04-15  8:00 ` OpenBMC Patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460707259-26459-2-git-send-email-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.