[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.3.2 Remote Communication Procedures
‘lib/remote.exp’ defines these functions, for establishing and managing communications:
Procedures to establish a connection: Each of these procedures
tries to establish the connection up to three times before returning.
Warnings (if retries will continue) or errors (if the attempt is
abandoned) report on communication failures. The result for any of
these procedures is either -1
, when the connection cannot be
established, or the spawn ID returned by the expect
command
spawn
.
It use the value of the connect
field in the target_info
array (was connectmode
as the type of connection to make. Current
supported connection types are tip, kermit, telnet, rsh, rlogin, and
netdata. If the --reboot
option was used on the runtest command
line, then the target is rebooted before the connection is made.
-
remote_open type
-
Remote Connection Procedure. This is passed host or target. Host or target refers to whether it is a connection to a remote target, or a remote host. This opens the connection to the desired target or host using the default values in the configuration system. It returns that
spawn_id
of the process that manages the connection. This value can be used inexpect
orexp_send
statements, or passed to other procedures that need the connection process’s id. This also sets thefileid
field in thetarget_info
array. -
remote_close shellid
-
shellid is value returned by a call to
remote_open
. This closes the connection to the target so resources can be used by others. This parameter can be left off if thefileid
field in thetarget_info
array is set. -
telnet hostname port
-
rlogin hostname
-
rsh hostname
-
IP network procedures. hostname refers to the IP address or name (for example, an entry in ‘/etc/hosts’) for this target. The procedure names reflect the Unix utility used to establish a connection. The optional port is used to specify the IP port number. The value of the
netport
field in thetarget_info
array is used. (was$netport
) This value has two parts, the hostname and the port number, seperated by a :. Ifhost
ortarget
is used in thehostname
field, than the config array is used for all information. -
tip port
-
Serial line procedure. Connect using the Unix utility
tip
. port must be a name from thetip
configuration file ‘/etc/remote’. Often, this is called ‘hardwire’, or something like ‘ttya’. This file holds all the configuration data for the serial port. The value of theserial
field in thetarget_info
array is used. (was$serialport
) Ifhost
ortarget
is used in theport
field, than the config array is used for all information. -
kermit port bps
-
Serial line procedure. Connect using the program
kermit
. port is the device name, e.g. ‘/dev/ttyb’. bps is the line speed to use (in bits per second) for the connection. The value of theserial
field in thetarget_info
array is used. (was$serialport
) Ifhost
ortarget
is used in theport
field, than the config array is used for all information.
Procedures to manage a connection:
-
tip_download spawnid file
-
Download ‘file’ to the process spawnid (the value returned when the connection was established), using the
~put
command undertip
. Most often used for single board computers that require downloading programs in ASCII S-records. Returns1
if an error occurs,0
otherwise. -
exit_remote_shell spawnid
-
Exits a remote process started by any of the connection procedures. spawnid is the result of the connection procedure that started the remote process.
-
download file [ spawnid ]
-
After you establish a connection to a target, you can download programs using this command.
download
reads in file (object code in S-record format) and writes it to the device controlling this spawnid. (From the point of view of the target, the S-record file comes in via standard input.)If you have more than one target active, you can use the optional argument spawnid to specify an alternative target (the default is the most recently established spawnid.)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |