Skip to content

Instantly share code, notes, and snippets.

@the6th
Last active February 28, 2020 08:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the6th/a6d49949b883820a8c209826920e797d to your computer and use it in GitHub Desktop.
Save the6th/a6d49949b883820a8c209826920e797d to your computer and use it in GitHub Desktop.
man of mldb
$ mldb
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-s <specific device> - directs command to the device with the given serial number
or qualifier. Overrides ML_SERIAL environment variable.
-H - Name of mldb server host (default: localhost). Can also
be specified with MLDB_SERVER_HOST environment variable.
-P - Port of mldb server (default: 5038)
mldb devices [-l] - list all connected devices
('-l' will also list device qualifiers)
mldb connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
mldb disconnect [<host>[:<port>]]
- disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devices.
device commands:
mldb push <-p <package> | -D> [-v] <local> <remote>
- copy file/dir to device
(-p <package>: name of package to push to)
(-v: display the name of every file copied)
(-D: push file to users document directory)
mldb pull <-p <package> | -D> [-v] [-a] <remote> [<local>]
- copy file/dir from device
(-p <package>: name of package to pull from)
(-a: copy timestamp and mode)
(-v: display the name of every file copied)
(-D: pull file from users document directory)
mldb log [-d] [-v <format>] [-t <count>] [-T <count>] [filterspecs]
- view device log
(-c: clear the log and exit.)
(-d: dump the log and exit, do not wait for additional content)
(-v <format>: configure the log format. Possible formats are
brief, color, epoch, long, printable, process, raw, tag,
thread, threadtime, time, uid, usec, year and zone.
A comma separated list of formats can be specified with
environment variable MLDB_LOG_FORMAT)
(-t <count> view the last count log entries)
(-T <count> view the last count log entries and wait for new content, blocks)
filterspecs are a series of
<tag>[:priority]
where <tag> is a log component tag (or * for all tags), and priority is:
V Verbose (default for <tag>)
D Debug (default for '*')
I Info
W Warn
E Error
F Fatal
S Silent (suppress all output)
For example, 'myapp:W' will exclude informational, debug and verbose
log entries that have tag myapp. 'myapp:S' will exclude all entries
that have tag myapp.
There is an implicit '*:V'. I.e., by default all entries (all tags and
priorities) are shown. When you specify a filterspec, you are altering
only the tag you specify in that filterspec. E.g., 'log myapp:F' does not
reduce the output to only the fatal myapp entries. You will see all
entries for all other tags but only the fatal entries for myapp. To see
only the fatal entries for myapp and nothing else, 'log *:S myapp:F'. The
first filterspec says 'suppress all entries from all tags' and the second
says 'suppress all myapp entries except fatal ones'. A filterspec with a
tag name overrides the default filtering for that tag set by '*'.
'*' by itself means '*:D' and <tag> by itself means <tag>:V.
mldb forward [--no-rebind] tcp:<host-port> tcp:<device-port>
- make a listening port on the device accessible as a listening
port on the host.
mldb forward --list - list the forward socket connections.
mldb forward --remove tcp:<host-port>
- remove a specific forward socket connection
mldb forward --remove-all - remove all forward socket connections
mldb reverse [--no-rebind] tcp:<device-port> tcp:<host-port>
- make a listening port on the host accessible as a listening
port on the device. Port reversing will work only for debuggable apps
and only if they connect to ports 57000 thru 57100 (inclusive, inclusive)
mldb reverse --list - list all reverse socket connections from device
mldb reverse --remove tcp:<device-port>
- remove a specific reverse socket connection
mldb reverse --remove-all - remove all reverse socket connections from the device
mldb bugreport [-p <PIN>] <zip_file>
- return all information from the device that should be included
in a bug report. Produce a zip file.
(-p: If the device is locked, the PIN must be specified)
mldb install [-u] <mpk-file> - install a package file
(-u: update installation)
mldb uninstall <pkg-name> - uninstall and remove a package from the device
mldb launch [-f] [[-d] -p <host-port>] [-i <value> ] [-w] [-x] [-v <name>=<value>]... <pkg-name> [<comp-name>]
- launch an application. First component in manifest is used
if not specified.
(-f: don't fail if app is already running; force a restart.)
(-d: launch app suspended. Debuggable apps only.)
(-p <host-port>: host port for gdbserver connection.)
(-i: initialization string. Debuggable apps only.)
(-w: wait for app to terminate. CTRL-C will kill app.)
(-x: wait for app to terminate. CTRL-C will NOT kill app.)
(-v: environment variable. Debuggable apps only.)
(--auto-net-privs: give app networking privileges without
prompting. Required by some tools such as Unity(R) Profiler.
Debuggable apps only.)
mldb terminate [-f] <pkg-name> [<comp-name>]
- terminate an application. If <comp-name> is omitted,
it terminates the first running component found.
(-f: forcefully end debugged applications)
mldb getprop [<name>] - retrieve a system property.
mldb ps [-j] - list running applications.
(-j: return the list in JSON format)
mldb packages [-j] - list installed packages.
(-j: return the list in JSON format)
mldb ls <-p <package> | -D> [-l] [-d] [-t] [-S] [-a] [-A] [-s] [-m] [-R] [-C] <device-path>
- list device files
(-p <package> the package whose content to list)
(-D: list files in users document directory)
(-l: long format, list file details)
(-d: list directories and not their content)
(-t: sort by modification time)
(-S: sort by file size)
(-a: list all files including . and ..)
(-A: list all files except . and ..)
(-m: mark directories with a / suffix)
(-R: recursive)
(-C: enable color)
mldb rm <-p <package> | -D> [-r] [-f] <device-path>
- Remove device files or directories
(-f: ignore non existing files)
(-r: recursive)
(-D: remove files or directories from user document directory)
mldb cp <-p <package> | -D> [-r] [-n] [-f] <device-src> <device-dest>
- Copy files on the device
(-r: recursive)
(-n: fail instead of overwriting)
(-f: force, overwrite read-only destination)
(-D: copy files or directories in user document directory)
mldb mv <-p <package> | -D> [-n] [-f] <device-src> <device-dest>
- Move files on the device
(-n: fail instead of overwriting)
(-f: force, overwrite read-only destination)
(-D: move files or directories in user document directory)
mldb mkdir <-p <package> | -D> <device-path>
- Create device directory
(-D: create directory in users document directory)
mldb df [--iec] - show filesystem usage
(--iec: use multiples of 1024 instead of 1000)
mldb attach -p <host-port> <pkg-name> [<comp-name>]
- attach debugger to already running application.
(-p <host-port>: host port for gdbserver connection.)
Only allowed for debuggable applications.
mldb crashdump list - list all available application crash dumps
mldb crashdump get (all | <exe-name> | <pid>) [<outfile>]
- retrieves all crash dumps or the latest
crash dump with a specific executable name or pid
mldb keygen <file> - generate mldb public/private key. The private key is stored in <file>,
and the public key is stored in <file>.pub. Any existing files
are overwritten.
mldb help - show this help message
mldb version - show version num
scripting:
mldb wait-for-device - block until device is online
mldb start-server - ensure that there is a server running
mldb kill-server - kill the server if it is running
mldb get-state - prints: offline | bootloader | device
mldb get-serialno - prints: <serial-number>
mldb get-devpath - prints: <device-path>
mldb reboot [bootloader] - reboots the device, optionally into the bootloader (aka,
fastboot) mode.
mldb shutdown - shut down the device.
mldb usb - restarts the daemon listening on USB
mldb tcpip [-p] <port> - restarts the daemon listening on TCP on the specified port
(-p: persist; continue using TCP even after a reboot)
mldb ifconfig [-a] [<interface>]
- displays network interfaces
(-a: show all interfaces, not just active ones)
mldb access-status - show state of various mechanisms that control access to the device
mldb changepin <oldpin> <newpin>
- change the unlock PIN
mldb lock - lock the device. Must have set a PIN first
mldb unlock <pin> - unlock with the specific PIN
mldb wifi <operation> [options/args]
- configure and view Wi-Fi. Use --help for details
mldb perf <operation> [options/args]
- configure profiling. Use --help for details
mldb capture image [-r] [-q (1080p|720p)] [-b (alpha|additive|hybrid)] <dest-file.jpg>
mldb capture video [-r] [-q (1080p|720p)] [-b (alpha|additive|hybrid)] [-a (virtual|mixed)] (-f <cnt> | -t <sec> | -w) <dest-file.mp4>
(-r: capture only rendered content, not using the camera)
(-q (1080p|720p): quality, resolution to capture with. Defaults to 1080p)
(-b (alpha|additive|hybrid): blend type. Defaults to additive.
(-a (virtual|mixed) audio recording type: virtual only or mixed virtual+ambient (default)
(-f <cnt>: number of frames to record)
(-t <sec>: time in seconds to record)
(-w: record until a key is pressed)
mldb audiocapture [options/args]
- make an audio recording. Use --help for details
mldb audioplayer [options/args]
- play an audio file. Use --help for details
mldb ping [-c <count>] host - send an ICMP echo request to a host
(-c: number of sequential requests to send)
mldb mlma <operation> [options/args]
- configure and view Magic Leap Mobile Application (MLMA). Use --help for details
mldb controller <operation> [options/args]
- configure and view controller. Use --help for details
mldb battery
- prints Lightpack battery status
mldb reset-headpose - reset headpose
mldb top [-n <num>] [-d <sec>] [-s <col>] [-m <max # of threads>]
- Display user process usage statistics
(-n: Updates to show before exiting)
(-d: Seconds to wait between updates)
(-s: Column to sort by [cpu, vss, rss, thr])
(-m: Maximum # of threads to display)
launching server:
You can explicitly launch the server with finer control as follows:
mldb server [-a] [-P] [nodaemon | fork-server --reply-fd <fd>]
-a: Accept a connection from any address, not just loopback (127.0.0.1)
Can only be specified with nodaemon or fork-server
-P: The port to listen on (default is 5038)
nodaemon: Don't spawn a process. Use this if you're launching the server in a
terminal and want the terminal to block and the server to log messages
to stdout. The default behavior is for the server to be spawned in
another process, and for 'mldb server' to return as soon as the server
is ready to service requests.
fork-server: Same as nodaemon but with the server writing an acknowledgment message
to the file descriptor specified with --reply-fd. Use this if you need
to spawn the server from a program. The ack is sent when the server is
ready to start servicing requests.
Note that both 'mldb server' and 'mldb start-server' spawn a server, but they differ
in two ways. The former will spawn a server unconditionally. The latter will spawn a
server only if one isn't running (on the specified or default port). Also, the former
completes as soon as the server is ready to service requests; the latter waits three
additional seconds to give the server time to discover USB devices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment