Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added 'adb get-serialno' to obtain serial number in case there's only

one device.

- Fixed error message
- Check existence of qemu property
  • Loading branch information...
commit 4267a3e42fd72f2af1731d732c8aa97a7920abc0 1 parent 45aa68e
Diego Torres Milano authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 AndroidViewClient/src/com/dtmilano/android/
11 AndroidViewClient/src/com/dtmilano/android/
@@ -874,7 +874,7 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse
if adb:
if not os.access(adb, os.X_OK):
- raise Exception('adb="%s" is not executable')
+ raise Exception('adb="%s" is not executable' % adb)
adb = ViewClient.__obtainAdbPath()
@@ -1018,11 +1018,18 @@ def __obtainDeviceSerialNumber(device):
if not serialno:
serialno ='getprop ro.serialno')[:-2]
if not serialno:
- if int('getprop ro.kernel.qemu')[:-2]) == 1:
+ qemu ='getprop ro.kernel.qemu')[:-2]
+ if qemu and int(qemu) == 1:
# FIXME !!!!!
# this must be calculated from somewhere, though using a fixed serialno for now
warnings.warn("Running on emulator but no serial number was specified then 'emulator-5554' is used")
serialno = 'emulator-5554'
+ if not serialno:
+ # If there's only one device connected get its serialno
+ adb = ViewClient.__obtainAdbPath()
+ s = subprocess.Popen([adb, 'get-serialno'], stdout=subprocess.PIPE).communicate()[0][:-1]
+ if s != 'unknown':
+ serialno = s
return serialno
Please sign in to comment.
Something went wrong with that request. Please try again.