• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching full:role

19 # Base delay time in seconds for Servo role change and PD negotiation.
21 # Total delay time in minutes for Servo role change and PD negotiation.
23 # Exponential backoff for Servo role change and PD negotiation.
27 # Seconds to wait after resetting the role on a recovery attempt
28 # before trying to set it to the intended role again.
30 # Delay to wait before polling whether the role as been changed successfully.
33 # Ethernet connection through the v4 flickers on role change. The usb
40 def _invert_role(role): argument
41 """Helper to invert the role.
43 @param role: role to invert
46 'src' if |role| is 'snk'
47 'snk' if |role| is 'src'
49 return 'src' if role == 'snk' else 'snk'
58 responds to Servo charging commands. Restore Servo v4 power role after
81 raise error.TestNAError('Unrecognized Servo v4 power role: %s.' %
90 def _retry_wrapper(self, role, verify): argument
91 """Try up to |_RETRYS| times to set the v4 to |role|.
93 @param role: string 'src' or 'snk'. If 'src' connect DUT to AC power; if
101 self._change_role(role, verify)
109 'recover.', role, retry + 1, str(e),
110 _invert_role(role))
114 self._change_role(_invert_role(role), verify=False)
116 logging.error('Giving up on %s.', role)
140 @param verify: whether to verify that original role was restored.
144 def _change_role(self, role, verify=True): argument
145 """Change Servo PD role and check if DUT responded accordingly.
147 @param role: string 'src' or 'snk'. If 'src' connect DUT to AC power; if
151 @raises error.TestError: if the role did not change successfully.
153 self._servo.set_nocheck('servo_v4_role', role)
154 # Sometimes the role reverts quickly. Add a short delay to let the new
155 # role stabilize.
163 def check_servo_role(role): argument
164 """Check if servo role is as expected, if not, retry."""
165 if self._servo.get('servo_v4_role') != role:
166 raise error.TestError('Servo v4 failed to set its PD role to '
167 '%s.' % role)
168 check_servo_role(role)
170 connected = True if role == 'src' else False