DME: better logging, always propagate errors
diff --git a/src/com/projectara/araepm/DME.java b/src/com/projectara/araepm/DME.java
index 754f35c..b7011ea 100644
--- a/src/com/projectara/araepm/DME.java
+++ b/src/com/projectara/araepm/DME.java
@@ -146,6 +146,14 @@
         this.i2cBus = i2c.getI2cBuses()[0];
     }
 
+    private void logByteArray(String prefix, byte[] arr) {
+        StringBuilder builder = new StringBuilder(prefix);
+        for (byte b: arr) {
+            builder.append(String.format(" %02x", b));
+        }
+        Log.i(TAG, builder.toString());
+    }
+
     // api_write_switch_config
     public void writeDMEConfig(int port, boolean peer, AttributeId attrId,
                                int selectorIndex, int attrVal,
@@ -159,37 +167,30 @@
         setReq.selectorIndex = selectorIndex;
         setReq.attrVal = attrVal;
 
-        Log.d(TAG, "writeDMEConfig: setReq(): portID: " + setReq.portId);
-        Log.d(TAG, "writeDMEConfig: setReq(): functionId: " + setReq.functionId);
-        Log.d(TAG, "writeDMEConfig: setReq(): attrId: " + setReq.attrId);
-        Log.d(TAG, "writeDMEConfig: setReq(): selectorIndex: " + setReq.selectorIndex);
-        Log.d(TAG, "writeDMEConfig: setReq(): attrVal: " + setReq.attrVal);
+        Log.d(TAG, "writeDMEConfig: setReq: portID: " + setReq.portId);
+        Log.d(TAG, "writeDMEConfig: setReq: functionId: " + setReq.functionId);
+        Log.d(TAG, "writeDMEConfig: setReq: attrId: " + setReq.attrId);
+        Log.d(TAG, "writeDMEConfig: setReq: selectorIndex: " + setReq.selectorIndex);
+        Log.d(TAG, "writeDMEConfig: setReq: attrVal: " + setReq.attrVal);
 
-
-        txn = I2cTransaction.newWrite(setReq.getBytes());
+        byte[] raw = setReq.getBytes();
+        logByteArray("writeDMEConfig: setReq, raw: ", raw);
+        txn = I2cTransaction.newWrite(raw);
         I2cTransaction[] results;
-        try {
-            results = i2c.performTransactions(i2cBus, slaveAddress, txn);
-        } catch (IOException e) {
-            return;
-        }
+        results = i2c.performTransactions(i2cBus, slaveAddress, txn);
 
         txn = I2cTransaction.newRead(SetCnf.MSG_SIZE);
-        try {
-            results = i2c.performTransactions(i2cBus, slaveAddress, txn);
-        } catch (IOException e) {
-            Log.e(TAG, "SetCnf: " + e.toString());
-            throw e;
-        }
+        results = i2c.performTransactions(i2cBus, slaveAddress, txn);
+        logByteArray("writeDMEConfig: setCnf, raw: ", results[0].data);
         SetCnf setCnf = new SetCnf(results[0].data);
 
         if (setCnf.resultCode != 0) {
             Log.e(TAG, "Unexpected resultCode: " + setCnf.resultCode);
         }
 
-        Log.d(TAG, "setCnf portId: " + setCnf.portId);
-        Log.d(TAG, "setCnf functionId: " + setCnf.functionId);
-        Log.d(TAG, "setCnf resultCode: " + setCnf.resultCode);
+        Log.d(TAG, "writeDMEConfig: setCnf portId: " + setCnf.portId);
+        Log.d(TAG, "writeDMEConfig: setCnf functionId: " + setCnf.functionId);
+        Log.d(TAG, "writeDMEConfig: setCnf resultCode: " + setCnf.resultCode);
         return;
     }
 
@@ -206,38 +207,31 @@
         getReq.attrId = attrId;
         getReq.selectorIndex = selectorIndex;
 
-        Log.d(TAG, "readDMEConfig: getReq(): portID: " + getReq.portId);
-        Log.d(TAG, "readDMEConfig: getReq(): functionId: " + getReq.functionId);
-        Log.d(TAG, "readDMEConfig: getReq(): attrId: " + getReq.attrId);
-        Log.d(TAG, "readDMEConfig: getReq(): selectorIndex: " + getReq.selectorIndex);
+        Log.d(TAG, "readDMEConfig: getReq: portID: " + getReq.portId);
+        Log.d(TAG, "readDMEConfig: getReq: functionId: " + getReq.functionId);
+        Log.d(TAG, "readDMEConfig: getReq: attrId: " + getReq.attrId);
+        Log.d(TAG, "readDMEConfig: getReq: selectorIndex: " + getReq.selectorIndex);
 
-        txn = I2cTransaction.newWrite(getReq.getBytes());
+        byte[] raw = getReq.getBytes();
+        logByteArray("readDMEConfig: getReq, raw: ", raw);
+        txn = I2cTransaction.newWrite(raw);
 
         I2cTransaction[] results;
-        try {
-            results = i2c.performTransactions(i2cBus, slaveAddress, txn);
-        } catch (IOException e) {
-            Log.e(TAG, "GetReq: " + e.toString());
-            throw e;
-        }
+        results = i2c.performTransactions(i2cBus, slaveAddress, txn);
 
         txn = I2cTransaction.newRead(GetCnf.MSG_SIZE);
-        try {
-            results = i2c.performTransactions(i2cBus, slaveAddress, txn);
-        } catch (IOException e) {
-            Log.e(TAG, "GetCnf: " + e.toString());
-            throw e;
-        }
+        results = i2c.performTransactions(i2cBus, slaveAddress, txn);
+        logByteArray("readDMEConfig: getCnf, raw: ", results[0].data);
         GetCnf getCnf = new GetCnf(results[0].data);
 
         if (getCnf.resultCode != 0) {
             Log.e(TAG, "Unexpected resultCode: " + getCnf.resultCode);
         }
 
-        Log.d(TAG, "getCnf portId: " + getCnf.portId);
-        Log.d(TAG, "getCnf functionId: " + getCnf.functionId);
-        Log.d(TAG, "getCnf resultCode: " + getCnf.resultCode);
-        Log.d(TAG, "getCnf attrVal: " + getCnf.attrVal);
+        Log.d(TAG, "readDMEConfig: getCnf portId: " + getCnf.portId);
+        Log.d(TAG, "readDMEConfig: getCnf functionId: " + getCnf.functionId);
+        Log.d(TAG, "readDMEConfig: getCnf resultCode: " + getCnf.resultCode);
+        Log.d(TAG, "readDMEConfig: getCnf attrVal: " + getCnf.attrVal);
 
         return getCnf.attrVal;
     }