Util: Add adjustI2CAddress

adjustI2CAddress converts input MRW-format I2C address to the standard
7-bit format.

Change-Id: I26328a7e8147b345b870be7798f7b5a6e66316d5
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/Util.pm b/Util.pm
index c6245a4..b9b2aef 100644
--- a/Util.pm
+++ b/Util.pm
@@ -83,6 +83,19 @@
     return @devices;
 }
 
+#Convert the MRW I2C address into the standard 7-bit format
+# $addr = the I2C Address
+sub adjustI2CAddress
+{
+    my $addr = shift;
+
+    #MRW holds the 8 bit value.  We need the 7 bit one.
+    $addr = $addr >> 1;
+    $addr = sprintf("0x%X", $addr);
+    $addr = lc $addr;
+
+    return $addr;
+}
 
 1;
 
@@ -116,6 +129,11 @@
 =item getDevicePath(C<InventoryItems>, C<TargetsObj>, C<TargetType>)
 #Returns the array of all the device path based on the C<TargetType>.
 
+=item adjustI2CAddress(C<I2CAddress>)
+
+Returns C<I2CAddress> converted from MRW format (8-bit) to the standard 7-bit
+format.
+
 =back
 
 =cut