From f35a7ddf30c27b796b969acc9f125b82e2de89bf Mon Sep 17 00:00:00 2001 From: Xo Wang Date: Mon, 9 Jan 2017 16:21:08 -0800 Subject: obmc-mgr-system: Support GPIOs in AA, AB, AC Add support for two letter GPIO names that start with A. Signed-off-by: Xo Wang Change-Id: Ie3a063f476f0ba84e2c8ad0415d7a6db59e8bda0 --- pysystemmgr/obmc/system/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pysystemmgr') diff --git a/pysystemmgr/obmc/system/__init__.py b/pysystemmgr/obmc/system/__init__.py index 8799b69..9a2a50a 100644 --- a/pysystemmgr/obmc/system/__init__.py +++ b/pysystemmgr/obmc/system/__init__.py @@ -1,9 +1,10 @@ GPIO_BASE = 320 def convertGpio(name): - name = name.upper() - c = name[0:1] - offset = int(name[1:]) - a = ord(c)-65 - base = a*8+GPIO_BASE - return base+offset + offset = int(filter(str.isdigit, name)) + port = filter(str.isalpha, name.upper()) + a = ord(port[-1]) - ord('A') + if len(port) > 1: + a += 26 + base = a * 8 + GPIO_BASE + return base + offset -- cgit v1.2.1