lab config: temporarily include cr50 configs to state configs.

BUG=chromium:1057145
TEST=generate.sh

Change-Id: I988b5dc58fd715ab7afb3ae95f7d7cbb94a8d619
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2083344
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
Commit-Queue: Xixuan Wu <xixuan@chromium.org>
diff --git a/go/lab/dut_state.pb.go b/go/lab/dut_state.pb.go
index 37aaab2..f96786d 100644
--- a/go/lab/dut_state.pb.go
+++ b/go/lab/dut_state.pb.go
@@ -56,17 +56,87 @@
 	return fileDescriptor_bfe5ddd3f74c848d, []int{0}
 }
 
-// Next Tag: 6
+// CR50-related configs by definition shouldn't be a state config, but a build config.
+// However, we don't have a way to source it from any external configuration system,
+// and it's changed frequently enough to handle cr50 tests, which makes
+// it basically imposible for manual updatings: See crbug.com/1057145 for the
+// troubles it causes.
+//
+// So we temporarily set it in state config so that repair job can update it.
+// For further changes of it, please see tracking bug crbug.com/1057719.
+//
+// phases for cr50 module. Next Tag: 3
+type DutState_CR50Phase int32
+
+const (
+	DutState_CR50_PHASE_INVALID DutState_CR50Phase = 0
+	DutState_CR50_PHASE_PREPVT  DutState_CR50Phase = 1
+	DutState_CR50_PHASE_PVT     DutState_CR50Phase = 2
+)
+
+var DutState_CR50Phase_name = map[int32]string{
+	0: "CR50_PHASE_INVALID",
+	1: "CR50_PHASE_PREPVT",
+	2: "CR50_PHASE_PVT",
+}
+
+var DutState_CR50Phase_value = map[string]int32{
+	"CR50_PHASE_INVALID": 0,
+	"CR50_PHASE_PREPVT":  1,
+	"CR50_PHASE_PVT":     2,
+}
+
+func (x DutState_CR50Phase) String() string {
+	return proto.EnumName(DutState_CR50Phase_name, int32(x))
+}
+
+func (DutState_CR50Phase) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_bfe5ddd3f74c848d, []int{0, 0}
+}
+
+// key env for cr50 RW version. Next Tag: 3
+type DutState_CR50KeyEnv int32
+
+const (
+	DutState_CR50_KEYENV_INVALID DutState_CR50KeyEnv = 0
+	DutState_CR50_KEYENV_PROD    DutState_CR50KeyEnv = 1
+	DutState_CR50_KEYENV_DEV     DutState_CR50KeyEnv = 2
+)
+
+var DutState_CR50KeyEnv_name = map[int32]string{
+	0: "CR50_KEYENV_INVALID",
+	1: "CR50_KEYENV_PROD",
+	2: "CR50_KEYENV_DEV",
+}
+
+var DutState_CR50KeyEnv_value = map[string]int32{
+	"CR50_KEYENV_INVALID": 0,
+	"CR50_KEYENV_PROD":    1,
+	"CR50_KEYENV_DEV":     2,
+}
+
+func (x DutState_CR50KeyEnv) String() string {
+	return proto.EnumName(DutState_CR50KeyEnv_name, int32(x))
+}
+
+func (DutState_CR50KeyEnv) EnumDescriptor() ([]byte, []int) {
+	return fileDescriptor_bfe5ddd3f74c848d, []int{0, 1}
+}
+
+// Next Tag: 8
 type DutState struct {
 	Id                  *ChromeOSDeviceID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
 	Servo               PeripheralState   `protobuf:"varint,2,opt,name=servo,proto3,enum=lab.PeripheralState" json:"servo,omitempty"`
 	Chameleon           PeripheralState   `protobuf:"varint,3,opt,name=chameleon,proto3,enum=lab.PeripheralState" json:"chameleon,omitempty"`
 	AudioLoopbackDongle PeripheralState   `protobuf:"varint,4,opt,name=audio_loopback_dongle,json=audioLoopbackDongle,proto3,enum=lab.PeripheralState" json:"audio_loopback_dongle,omitempty"`
 	// Indicate how many working bluetooth btpeer for a device.
-	WorkingBluetoothBtpeer int32    `protobuf:"varint,5,opt,name=working_bluetooth_btpeer,json=workingBluetoothBtpeer,proto3" json:"working_bluetooth_btpeer,omitempty"`
-	XXX_NoUnkeyedLiteral   struct{} `json:"-"`
-	XXX_unrecognized       []byte   `json:"-"`
-	XXX_sizecache          int32    `json:"-"`
+	WorkingBluetoothBtpeer int32              `protobuf:"varint,5,opt,name=working_bluetooth_btpeer,json=workingBluetoothBtpeer,proto3" json:"working_bluetooth_btpeer,omitempty"`
+	Cr50Phase              DutState_CR50Phase `protobuf:"varint,6,opt,name=cr50_phase,json=cr50Phase,proto3,enum=lab.DutState_CR50Phase" json:"cr50_phase,omitempty"`
+	// Detected based on the cr50 RW version that the DUT is running on.
+	Cr50KeyEnv           DutState_CR50KeyEnv `protobuf:"varint,7,opt,name=cr50_key_env,json=cr50KeyEnv,proto3,enum=lab.DutState_CR50KeyEnv" json:"cr50_key_env,omitempty"`
+	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
+	XXX_unrecognized     []byte              `json:"-"`
+	XXX_sizecache        int32               `json:"-"`
 }
 
 func (m *DutState) Reset()         { *m = DutState{} }
@@ -129,35 +199,60 @@
 	return 0
 }
 
+func (m *DutState) GetCr50Phase() DutState_CR50Phase {
+	if m != nil {
+		return m.Cr50Phase
+	}
+	return DutState_CR50_PHASE_INVALID
+}
+
+func (m *DutState) GetCr50KeyEnv() DutState_CR50KeyEnv {
+	if m != nil {
+		return m.Cr50KeyEnv
+	}
+	return DutState_CR50_KEYENV_INVALID
+}
+
 func init() {
 	proto.RegisterEnum("lab.PeripheralState", PeripheralState_name, PeripheralState_value)
+	proto.RegisterEnum("lab.DutState_CR50Phase", DutState_CR50Phase_name, DutState_CR50Phase_value)
+	proto.RegisterEnum("lab.DutState_CR50KeyEnv", DutState_CR50KeyEnv_name, DutState_CR50KeyEnv_value)
 	proto.RegisterType((*DutState)(nil), "lab.DutState")
 }
 
 func init() { proto.RegisterFile("lab/dut_state.proto", fileDescriptor_bfe5ddd3f74c848d) }
 
 var fileDescriptor_bfe5ddd3f74c848d = []byte{
-	// 347 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x5d, 0xeb, 0xd3, 0x30,
-	0x18, 0x47, 0x6d, 0xf7, 0xa2, 0x66, 0xbe, 0xd4, 0xcc, 0x49, 0x11, 0x2f, 0x86, 0x20, 0x8c, 0x81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 0xfa, 0x28, 0xab, 0x82, 0x72, 0xd5, 0x0a, 0x03, 0x60, 0x4a, 0xca, 0x4d,
-	0x2d, 0x84, 0xf6, 0x07, 0x53, 0x67, 0x36, 0x48, 0xdf, 0x5c, 0x79, 0x74, 0xc3, 0x91, 0xa5, 0xf3,
-	0x5f, 0xe8, 0xe5, 0x83, 0x1f, 0xf0, 0x08, 0x3d, 0xfe, 0x41, 0xb6, 0x24, 0x39, 0x10, 0xef, 0x51,
-	0x37, 0x0e, 0x49, 0xba, 0xdd, 0x90, 0xb5, 0xe7, 0xe0, 0x57, 0xe8, 0x39, 0x49, 0xf6, 0x74, 0x99,
-	0x10, 0xb2, 0x5a, 0xee, 0x57, 0xb1, 0xe7, 0x62, 0x84, 0x86, 0x51, 0x9a, 0x6c, 0x57, 0xc4, 0xeb,
-	0x61, 0x0f, 0x3d, 0x3b, 0xa4, 0x09, 0x59, 0x77, 0xc2, 0x97, 0xcd, 0xda, 0xeb, 0x47, 0xe1, 0xcf,
-	0x8f, 0x05, 0x04, 0xf6, 0x28, 0xb2, 0x3d, 0x05, 0xa0, 0x8b, 0xf0, 0x36, 0xa0, 0x09, 0x65, 0xf5,
-	0x5b, 0xb3, 0xd0, 0xde, 0x27, 0x2c, 0x20, 0x54, 0x8c, 0xf3, 0xa1, 0x5d, 0x9f, 0xfe, 0x05, 0x00,
-	0x00, 0xff, 0xff, 0x4f, 0x8f, 0x9e, 0x22, 0xe7, 0x01, 0x00, 0x00,
+	// 489 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xf1, 0x6b, 0xda, 0x40,
+	0x14, 0xc7, 0x9b, 0x54, 0xed, 0x7c, 0xed, 0xda, 0xeb, 0x59, 0xdb, 0x30, 0xf6, 0x83, 0x08, 0x03,
+	0x29, 0x2c, 0x29, 0x8e, 0x8e, 0xb1, 0xdf, 0xaa, 0xc9, 0xac, 0x58, 0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 0x81, 0xcf, 0xe1, 0x35, 0xf1, 0x47, 0xac, 0xeb, 0x13, 0xe2, 0x75,
+	0x47, 0x9e, 0x8b, 0x4c, 0x0c, 0x50, 0xe9, 0x50, 0x7f, 0xe0, 0x11, 0x74, 0x88, 0x11, 0x9c, 0x4c,
+	0xa8, 0x4f, 0x7a, 0x39, 0xf0, 0xa5, 0xdf, 0x43, 0xa5, 0x8e, 0xf3, 0xfd, 0xfd, 0x4c, 0xda, 0xfa,
+	0x54, 0xe3, 0xcd, 0xd2, 0x96, 0x6a, 0xe6, 0xec, 0x0b, 0xb9, 0x76, 0xe2, 0xf4, 0xa7, 0xe2, 0x8e,
+	0xbe, 0x5a, 0x67, 0x26, 0x9d, 0x84, 0x87, 0x61, 0x45, 0x57, 0x1f, 0xfe, 0x04, 0x00, 0x00, 0xff,
+	0xff, 0xe1, 0x9a, 0x41, 0x54, 0xfd, 0x02, 0x00, 0x00,
 }
diff --git a/src/lab/dut_state.proto b/src/lab/dut_state.proto
index 27e94e1..38f37d2 100644
--- a/src/lab/dut_state.proto
+++ b/src/lab/dut_state.proto
@@ -12,14 +12,41 @@
 
 // This proto defines status labels in lab config of a DUT.
 
-// Next Tag: 6
+// Next Tag: 8
 message DutState {
-    ChromeOSDeviceID id = 1;
-    PeripheralState servo = 2;
-    PeripheralState chameleon = 3;
-    PeripheralState audio_loopback_dongle = 4;
-    // Indicate how many working bluetooth btpeer for a device.
-    int32 working_bluetooth_btpeer = 5;
+  ChromeOSDeviceID id = 1;
+  PeripheralState servo = 2;
+  PeripheralState chameleon = 3;
+  PeripheralState audio_loopback_dongle = 4;
+  // Indicate how many working bluetooth btpeer for a device.
+  int32 working_bluetooth_btpeer = 5;
+
+  // CR50-related configs by definition shouldn't be a state config, but a build config.
+  // However, we don't have a way to source it from any external configuration system,
+  // and it's changed frequently enough to handle cr50 tests, which makes
+  // it basically imposible for manual updatings: See crbug.com/1057145 for the
+  // troubles it causes.
+  // 
+  // So we temporarily set it in state config so that repair job can update it.
+  // For further changes of it, please see tracking bug crbug.com/1057719.
+  //
+  // phases for cr50 module. Next Tag: 3
+  enum CR50Phase {
+    CR50_PHASE_INVALID = 0;
+    CR50_PHASE_PREPVT = 1;
+    CR50_PHASE_PVT = 2;
+  }
+
+  CR50Phase cr50_phase = 6;
+
+  // key env for cr50 RW version. Next Tag: 3
+  enum CR50KeyEnv {
+    CR50_KEYENV_INVALID = 0;
+    CR50_KEYENV_PROD = 1;
+    CR50_KEYENV_DEV = 2;
+  }
+  // Detected based on the cr50 RW version that the DUT is running on.
+  CR50KeyEnv cr50_key_env = 7;
 }
 
 // Next Tag: 5