Skip to content

Commit

Permalink
Fixed #12 and #13.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikan committed Jan 27, 2016
1 parent 57fbec5 commit 222048b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def _run(args):
ret = p.wait()
output = Adb._out2str(p.stdout.readlines())
error = Adb._out2str(p.stderr.readlines())
print("return: " + str(ret))
print("output: " + output)
print("error: " + error)
print("[ADB] return: " + str(ret))
if output:
print("[ADB] output: " + output)
if error:
print("[ADB] error: " + error)
return output if ret is 0 else error

@staticmethod
Expand All @@ -44,7 +46,12 @@ def install_apk(self, host, file_path):
_state = self.get_state(host)
if _state is "offline":
return "device offline"
return self.shell(host, "install " + file_path)
# -r: replace existing application
# -t: allow test packages
# -d: allow version code downgrade
args = [self._path, "-s", host, "install", "-rt", file_path]
print (args)
return self._run(args)

def get_state(self, host):
_state = self.shell(host, "get-state")
Expand Down
2 changes: 1 addition & 1 deletion src/racm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

__author__ = 'mikan'

_VERSION = "0.3"
_VERSION = "0.4"


def _open_window(cfg, title):
Expand Down
8 changes: 6 additions & 2 deletions src/racm_ui_main_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,13 @@ def _get_connect_status(status):

@staticmethod
def _get_disconnect_status(status):
if not str.strip(status):
if "disconnected" in status: # Newer SDK
return "DISCONNECTED"
elif "No such device" in status:
elif not str.strip(status): # Older SDK
return "DISCONNECTED"
elif "no such device" in status: # Newer SDK
return "No such device"
elif "No such device" in status: # Older SDK
return "No such device"
return status

Expand Down

0 comments on commit 222048b

Please sign in to comment.