• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto3";
6
7package chromiumos.test.lab.api.passport;
8
9import "google/protobuf/duration.proto";
10
11option go_package = "go.chromium.org/chromiumos/config/go/test/lab/api/passport";
12
13service UsbTesterService {
14  // Probe all testers connected to the host device.
15  rpc GetTesters(GetTestersRequest) returns (GetTestersReply) {}
16
17  // Get the value of a certain capability, eg: data role, power role etc ...
18  rpc GetTesterCapability (GetUsbTesterCapabilityRequest) returns (GetUsbTesterCapabilityReply) {}
19
20  // Set the value of a certain capability, eg: data role, power role etc ...
21  rpc SetTesterCapability (SetUsbTesterCapabilityRequest) returns (SetUsbTesterCapabilityReply) {}
22
23  // Get the display port alternate mode information.
24  rpc GetDpInfo (GetDpInfoRequest) returns (GetDpInfoReply) {}
25
26  // Simulate the physical disconnect and reconnect of the cable between the
27  // tester and the DUT.
28  rpc ReplugCable(DoCableReplugRequest) returns (DoCableReplugReply) {}
29
30  // This method is used to do a hard reset.
31  rpc HardResetTester(HardResetTesterRequest) returns (HardResetTesterReply) {}
32
33  // This method is used to open the serial of the USB tester being used.
34  rpc OpenTester(OpenTesterRequest) returns (OpenTesterReply) {}
35
36  // This method is used to close the serial of the USB tester being used.
37  rpc CloseTester(CloseTesterRequest) returns (CloseTesterReply) {}
38
39  // This method is used to get the active test port on the testing device.
40  rpc GetActivePort(GetActivePortRequest) returns (GetActivePortReply) {}
41
42  // This method is used to set the active test port on the testing device.
43  rpc SetActivePort(SetActivePortRequest) returns (SetActivePortReply) {}
44}
45
46// Request to do hard reset.
47message HardResetTesterRequest {
48  // Id (or serial) of the usb tester for which the request is intended.
49  string id = 1;
50}
51
52// Reply message for the HardResetTesterReply message
53message HardResetTesterReply {
54  // Error code indicating the success or failure of the open operation.
55  // 0 indicates success, while other values represent specific errors.
56  int64 err_code = 1;
57  // Human-readable error message providing more details about any errors encountered.
58  string error_msg = 2;
59}
60
61// Request to do a simulated cable replug.
62message DoCableReplugRequest {
63  // Id (or serial) of the usb tester for which the request is intended.
64  string id = 1;
65}
66
67// Reply message for the DoCableReplugRequest message
68message DoCableReplugReply {
69    // Error code indicating the success or failure of the open operation.
70    // 0 indicates success, while other values represent specific errors.
71    int64 err_code = 1;
72    // Human-readable error message providing more details about any errors encountered.
73    string error_msg = 2;
74}
75
76// Request to open the serial of the usb tester.
77message OpenTesterRequest {
78  // Id (or serial) of the usb tester for which the request is intended.
79  string id = 1;
80}
81
82// Reply to OpenTesterRequest.
83message OpenTesterReply {
84  // Error code indicating the success or failure of the open operation.
85  // 0 indicates success, while other values represent specific errors.
86  int64 err_code = 1;
87  // Human-readable error message providing more details about any errors encountered.
88  string error_msg = 2;
89}
90
91// Request to close the serial of the usb tester.
92message CloseTesterRequest {
93  // Id (or serial) of the usb tester for which the request is intended.
94  string id = 1;
95}
96
97// Reply to CloseTesterRequest.
98message CloseTesterReply {
99  // Error code indicating the success or failure of the close operation.
100  // 0 indicates success, while other values represent specific errors.
101  int64 err_code = 1;
102  // Human-readable error message providing more details about any errors encountered.
103  string error_msg = 2;
104}
105
106// Struct for representing a usb tester.
107message UsbTester{
108  // Id (or serial) of the usb tester for which the request is intended.
109  string id = 1;
110
111  // This field indicates the manufacturer of the usb tester.
112  string name = 2;
113}
114
115// Request to retrieve a list of USB testers.
116message GetTestersRequest{}
117
118// Reply for GetTestersRequest.
119message GetTestersReply{
120  repeated UsbTester testers = 1;
121}
122
123// A USB tester capability is used to describe the attributes of a
124// USB tester.Examples: power role, data rola, vbus voltage, etc ...
125enum Capability {
126  CAPABILITY_NOT_SET = 0;
127  PIN_ASSIGMENT      = 1;
128  USB_CHANNEL        = 2;
129  POWER_ROLE         = 3;
130  DATA_ROLE          = 4;
131  ACTIVE_CC          = 5;
132  CABLE_MODE         = 6;
133  INIT_PD_STATE      = 7;
134  CURRENT_LOAD       = 9;
135  SRC_PULL_UP        = 10;
136  SNK_PDO_COUNT      = 11;
137  SRC_PDO_COUNT      = 12;
138  VBUS_VOLTAGE       = 13;
139  VBUS_CURRENT       = 14;
140  VBUS_CURRENT_LANE  = 15;
141  GND_CURRENT_LANE   = 16;
142  VBUS_EPU_VOLTAGE   = 17;
143  VBUS_CC1           = 18;
144  VBUS_CC2           = 19;
145  VBUS_SBU1          = 20;
146  VBUS_SBU2          = 21;
147}
148
149enum ActiveCc {
150  ACTIVE_CC_NOT_SET = 0;
151  CC1               = 1;
152  CC2               = 2;
153}
154
155enum PinAassignment {
156  PIN_AASSIGNMENT_NOT_SET = 0;
157  C                       = 1;
158  D                       = 2;
159}
160
161enum PowerRole {
162  POWER_ROLE_NOT_SET = 0;
163  SNK                = 1;
164  SRC                = 2;
165}
166
167enum DataRole {
168  DATA_ROLE_NOT_SET = 0;
169  DATA_UFP          = 1;
170  DATA_DFP          = 2;
171}
172
173enum UsbChannel {
174  USB_CHANNEL_NOT_SET = 0;
175  USB_2_HS            = 1;
176  USB_3_AND_2_HS      = 2;
177}
178
179enum CableMode {
180  CABLE_MODE_NOT_SET = 0;
181  NORMAL             = 1;
182  ELEC_TEST          = 2;
183}
184
185enum InitPdState {
186  INIT_PD_STATE_NOT_SET = 0;
187  PD_UFP                = 1;
188  PD_DFP                = 2;
189  PD_DRP                = 3;
190}
191
192// Request to get the value of a capability.
193message GetUsbTesterCapabilityRequest {
194  // Id (or serial) of the usb tester for which the request is intended.
195  string id = 1;
196
197  // Indicates what capability the operation is targeting.
198  Capability capability = 2;
199}
200
201// Reply of GetUsbTesterCapabilityRequest.
202message GetUsbTesterCapabilityReply {
203  // Error code indicating the success or failure of the open operation.
204  // 0 indicates success, while other values represent specific errors.
205  int64 err_code = 1;
206
207  // Human-readable error message providing more details about any errors
208  // encountered.
209  optional string error_msg = 2;
210
211  // The value to be set. This can be either be a discrete value for well defined
212  // capabilities (power role, data role etc .. ) or a just a plain number for
213  // capabilities that can take on a big and not well defined range of values.
214  oneof value {
215    ActiveCc active_cc        = 3;
216    PinAassignment pin_mode   = 4;
217    PowerRole power_role      = 5;
218    DataRole data_role        = 6;
219    UsbChannel usb_channel    = 7;
220    CableMode cable_mode      = 8;
221    InitPdState init_pd_state = 9;
222    int64 non_descrete        = 10;
223  }
224}
225
226message SetUsbTesterCapabilityRequest {
227  // Id (or serial) of the usb tester for which the request is intended.
228  string id = 1;
229
230  // Specifies the delay before doing the operation. This is optional. If left
231  // empty it will default to 0.
232  optional google.protobuf.Duration delay = 2;
233  // Specifies the max duration of the operation. This is optional. If left
234  // empty it will default to 0.
235  optional google.protobuf.Duration timeout = 3;
236
237  // Indicate what capability the operation is targeting.
238  Capability capability = 4;
239
240  // The value to be set. This can be either be a discrete value for well defined
241  // capabilities (power role, data role etc .. ) or a just a plain number for
242  // capabilities that can take on a big and not well defined range of values.
243  oneof value {
244    ActiveCc active_cc        = 5;
245    PinAassignment pin_mode   = 6;
246    PowerRole power_role      = 7;
247    DataRole data_role        = 8;
248    UsbChannel usb_channel    = 9;
249    CableMode cable_mode      = 10;
250    InitPdState init_pd_state = 11;
251    int64 non_descrete        = 12;
252  }
253}
254
255message SetUsbTesterCapabilityReply {
256    // Error code indicating the success or failure of the open operation.
257    // 0 indicates success, while other values represent specific errors.
258    int64 err_code = 2;
259
260    // Human-readable error message providing more details about any errors
261    // encountered.
262    optional string error_msg = 3;
263}
264
265enum DpLinkRate {
266  DP_LINK_RATE_NOT_SET = 0;
267  RBR   = 1;
268  HBR   = 2;
269  HBR2  = 3;
270  HBR3  = 4;
271}
272
273enum DpColorDepth {
274  DP_COLOR_DEPTH = 0;
275  BIT6   = 1;
276  BIT8   = 2;
277  BIT10  = 3;
278  BIT12  = 4;
279  BIT16  = 5;
280}
281
282enum DpColorMode {
283  DP_COLOR_MODE_NOT_SET = 0;
284  RGB       = 1;
285  YCBCR444  = 2;
286  YCBCR422  = 3;
287  YCBCR420  = 4;
288}
289
290message GetDpInfoRequest {
291  // Id (or serial) of the usb tester for which the request is intended.
292  string id = 1;
293
294  // Specifies the delay before doing the operation. This is optional. If left
295  // empty it will default to 0.
296  optional google.protobuf.Duration delay = 2;
297
298  // Specifies the max duration of the operation. This is optional. If left
299  // empty it will default to 0.
300  optional google.protobuf.Duration timeout = 3;
301}
302
303message GetDpInfoReply {
304  // Error code indicating the success or failure of the operation.
305  // 0 indicates success, while other values represent specific errors.
306  int64 err_code = 1;
307
308  // Human-readable error message providing more details about any errors
309  // encountered.
310  optional string error_msg = 2;
311
312  // Link rate of the DP link, rbr, hbr, etc ...
313  optional DpLinkRate link_rate = 3;
314
315  // Value corresponding to number of lanes.
316  optional int32 lane_count = 4;
317
318  // Value in HZ.
319  optional int32 pixel_clock = 5;
320
321  // Value in pixels.
322  optional int32 h_active = 6;
323
324  // Value in pixels.
325  optional int32 v_active = 7;
326
327  // Value in pixels.
328  optional int32 h_total = 8;
329
330  // Value in pixels.
331  optional int32 v_total = 9;
332
333  // Value in HZ.
334  optional double framerate = 10;
335
336  // DP link color mode.
337  optional DpColorMode color_mode = 11;
338
339  // DP link color depth.
340  optional DpColorDepth color_depth = 12;
341
342  // Value in kHZ.
343  optional int32 audio_sample_rate = 13;
344}
345
346// Data used in a GetActivePort call.
347message GetActivePortRequest {
348  // Id (or serial) of the usb tester for which the request is intended.
349  string id = 1;
350}
351
352// Data returned as part of a GetActivePort call.
353message GetActivePortReply {
354  // Error code indicating the success or failure of the operation.
355  // 0 indicates success, while other values represent specific errors.
356  int64 err_code = 1;
357
358  // Human-readable error message providing more details about any errors
359  // encountered.
360  optional string error_msg = 2;
361
362  // The id of the port that is active.
363  uint32 port_id = 3;
364
365  // The maximum number of ports on the device.
366  uint32 max_num_ports = 4;
367}
368
369// Data used in a SetActivePort call.
370message SetActivePortRequest {
371  // Id (or serial) of the usb tester for which the request is intended.
372  string id = 1;
373
374  // The id of the port that we want to mark as active. If port_id is already
375  // active then this method will do nothing.
376  uint32 port_id = 2;
377}
378
379// Data returned as part of a SetActivePort call.
380message SetActivePortReply {
381  // Error code indicating the success or failure of the operation.
382  // 0 indicates success, while other values represent specific errors.
383  int64 err_code = 1;
384
385  // Human-readable error message providing more details about any errors
386  // encountered.
387  optional string error_msg = 2;
388}
389