The "adb connect" command is not required for USB connected devices.
This patch is a small update to use "adb connect" only for android devices
accessed by IP address.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Using the wrapt module we can improve the memoize decorator. In fact, it allows
to preserve the attributes of the memoized function, such as signature,
docstring, path to the file where the function is implemented, and so on.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Connection objects set timeout to a default value in case a timeout is
not specified. However, Target defaults timeout to None and passes that
to connection, overridng the default.
This commit ensures that default timeout remains set if calling code
specified timemout as None.
Fix for issue
https://github.com/ARM-software/devlib/issues/34
The newline separator is a property of AdbConnection while the adb_shell is
just a method of the android module, thus we do not have a "self" pointer
to and AdbConnection from within the adb_shell function.
This patch fixes 8de24b5 by exposing the newline_separator used by adb_shell
as a parameter of that method and using the AdbConnection::newline_separator
to properly initialize it at executue() time.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Executing a command as root was not possible when running it in background.
This is done in a similar way as with a standard execute call.
This was also a bug in ssh.py because if you tried to run a background command
on the target, the background function in target.py was passing the as_root
parameter which was not present in ssh.py.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
When issuing a target.reboot(), the reset was immediately followed by a
boot() (for platforms that have it) and an attempt to connect. When
issuing a soft reset, it's possible the target is still shutting down
when the attempt to connect is made. This results in the connection
succeeding but being severed shortly thereafter.
This introduces a delay after the reset to the reboot sequence, giving
the target time to shutdown and improves the handling of EOF's that
result from failed reconnection attempts (while still being with the
allotted timeout period.
The ADB pull command allows only to pull a single file or a whole directory.
This patch adds the required support to pull only a selection of files, from
a target folder, which match a path specified using '*' and/or '?' wildcards.
In this case we first get the list of files on the target, using the
wildcard expansion support provided by the "ls" command, and than we pull
each and every file returned from the previous command.
This operation mode is available only if the 'dest' parameter is a valid
host-side folder.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
In workload automation, utils.android._initialize_without_android_home()
gets android_home from adb's path. When this code was copied to devlib,
we mistakenly dropped parsing the output of "which" and instead call
os.path.dirname() on "adb", which always returns "" and makes
_initialize_without_android_home() fail.
Make _initialize_without_android_home() parse the output of "which"
again.
In order to execute as root, the command string gets echo'd into so;
previusly, double quotes were used in echo, which caused any veriables
in the command string to be expanded _before_ it was echoed.
This fixes an issue introduced in
64261a65cb
The addtional echo means that $? will always have "0" (the exit code for
the echo). This removes the extra echo, prepending \n to $? instead
- adb protcol uses "\r\n" for line breaks. This is not handled by
Python's line break translation, as not a file. So spliting on '\n'
when extracting the exit code resulted in stray '\r' in the output.
- adb_shell expects exit code to be echoed on the same line. This may
not have been the case if latest output from executed command was not
a complete line. An extra echo will now ensure that the exit code will
be on its own line even in that case.
This should help on fixing issue related to echoed commands which make
it difficult to parse the commands results.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
By default the terminal emulated by pxssh is 24x80 in size, which force
the addition of unwanted "\r" in long commands. These \r are painful to
parse and remove from the echoed command.
This patch tries to alleviate this issue by setting a bigger TTY terminal
by default. A 200 columns display should be big enough to execute most
of the commands. In case longer commands are required it is better
have them on a script to push on the target for execution.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The pexpect module exposes a fdpexpect class starting from version 4.0.
This patch makes uses of the proper pxssh import statement depending on the
version of pexpect available in the host.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The pexpect module exposes a pxssh class starting from version 4.0.
This patch makes uses of the proper pxssh import statement depending on the
version of pexpect available in the host.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>