Merge pull request #193 from bjackman/is-network-connected

target: Add is_network_connected method
diff --git a/devlib/target.py b/devlib/target.py
index 1d2754f..29cd411 100644
--- a/devlib/target.py
+++ b/devlib/target.py
@@ -1315,7 +1315,7 @@
 
     def get_rotation(self):
         cmd = 'settings get system user_rotation'
-        return self.execute(cmd).strip()
+        return int(self.execute(cmd).strip())
 
     def set_rotation(self, rotation):
         if not 0 <= rotation <= 3:
diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index 318b4d0..14cb253 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -575,7 +575,7 @@
         :type outfile: str
         """
         if outfile:
-            self._logfile = open(outfile)
+            self._logfile = open(outfile, 'w')
         else:
             self._logfile = tempfile.NamedTemporaryFile()