diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-06-10 21:27:40 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-06-10 21:27:53 +0300 |
commit | 905fa4622aa6e51ff7359053ec55a7373a1a316e (patch) | |
tree | 73ef0908ce94b15fc3951abc912ebb3e570c445f | |
parent | e405f7c4e76489d96d020cbf3440b71a9aa94e49 (diff) |
Add support for printing FFOS device system description fields (deviceActor getDescription verb) with 'ffdb.py desc'
-rwxr-xr-x | tools/ffdb.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/ffdb.py b/tools/ffdb.py index f7f4807a..a8c0938f 100755 --- a/tools/ffdb.py +++ b/tools/ffdb.py @@ -397,6 +397,17 @@ def b2g_screenshot(filename): else: print "Wrote " + sizeof_fmt(len(binary_data)) + " to file '" + filename + "' (" + str(width) + 'x' + str(height) + ' pixels).' +def b2g_get_description(desc): + global deviceActorName + data_reply = send_b2g_cmd(deviceActorName, 'getDescription') + # First try an exact match to requested desc + if desc and desc in data_reply['value']: + print desc + ': ' + str(data_reply['value'][desc]) + else: # Print all with case-insensitive substring search + for k,v in data_reply['value'].items(): + if not desc or desc.lower() in k.lower(): + print k + ': ' + str(v) + def main(): global b2g_socket, webappsActorName, deviceActorName, HOST, PORT, VERBOSE, ADB if len(sys.argv) < 2 or '--help' in sys.argv or 'help' in sys.argv or '-v' in sys.argv: @@ -421,7 +432,10 @@ def main(): screenshot [filename.png]: Takes a screenshot of the current contents displayed on the device. If an optional filename is specified, the screenshot is saved to that file. Otherwise the filename will be autogenerated. - get <pref>: Fetches the value of the given developer pref option from the FFOS device and prints it to console. + get [pref]: Fetches the value of the given developer pref option from the FFOS device and prints it to console. The parameter pref + is optional and may either be the full name of a pref, or a substring to search for. All matching prefs will be printed. + If no pref parameter is given, all prefs are printed. + NOTE: This function (currently at least) only reports prefs that have been explicitly set and don't have their default value. set <pref> <value>: Writes the given pref option to the FFOS device and restarts the B2G process on it for the change to take effect. unset <pref>: Removes the given pref option from the FFOS device and restarts the B2G process on it for the change to take effect. @@ -429,6 +443,10 @@ def main(): provided for conveniency, and is the same as calling './ffdb.py set devtools.debugger.prompt-connection false' restore-prompt: Restores the remote debugging connection dialog prompt to its default state. + desc [desc]: Fetches the value of the given device description field. These fields are read-only and describe the current system. + If the optional desc parameter is omitted, all device descriptions are printed. Otherwise the given description is + printed if it is an exact match, or all descriptions containing desc as the substring are printed. + Options: Additionally, the following options may be passed to control FFDB execution: --host <hostname>: Specifies the target network address to connect to. Default: 'localhost'. @@ -612,6 +630,8 @@ def main(): b2g_set_pref('devtools.debugger.prompt-connection', 'false') elif sys.argv[1] == 'restore-prompt': b2g_set_pref('devtools.debugger.prompt-connection', None) + elif sys.argv[1] == 'desc': + b2g_get_description(sys.argv[2] if len(sys.argv) >= 3 else None) else: print "Unknown command '" + sys.argv[1] + "'! Pass --help for instructions." |