Skip to content

Commit 2e23847

Browse files
committed
Rename to rot_firmware_version/get_rot_fw_version
1 parent 2bce4fe commit 2e23847

File tree

8 files changed

+35
-37
lines changed

8 files changed

+35
-37
lines changed

examples/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ cc_binary(
8383
":srtm",
8484
"//:git_version",
8585
"//protocol:host_cmd",
86-
"//protocol:firmware_version",
86+
"//protocol:rot_firmware_version",
8787
"//transports:libhoth_device",
8888
"//transports:libhoth_mtd",
8989
"//transports:libhoth_spi",

examples/htool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "htool_target_control.h"
4747
#include "htool_target_usb.h"
4848
#include "htool_usb.h"
49-
#include "protocol/firmware_version.h"
49+
#include "protocol/rot_firmware_version.h"
5050
#include "transports/libhoth_device.h"
5151

5252
static int command_usb_list(const struct htool_invocation* inv) {
@@ -72,7 +72,7 @@ static int command_get_version(const struct htool_invocation* inv) {
7272
}
7373

7474
struct ec_response_get_version response;
75-
int status = get_fw_version(dev, &response);
75+
int status = libhoth_get_rot_fw_version(dev, &response);
7676

7777
if (status) {
7878
return -1;

protocol/BUILD

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@ cc_library(
1010
)
1111

1212
cc_library(
13-
name = "firmware_version",
14-
hdrs = ["firmware_version.h"],
15-
srcs = ["firmware_version.c"],
13+
name = "rot_firmware_version",
14+
hdrs = ["rot_firmware_version.h"],
15+
srcs = ["rot_firmware_version.c"],
1616
deps = [
1717
"//transports:libhoth_device",
1818
":host_cmd",
1919
],
2020
)
21+
22+
cc_test(
23+
name = "rot_firmware_version_test",
24+
srcs = ["rot_firmware_version_test.cc"],
25+
deps = [
26+
"@googletest//:gtest",
27+
"@googletest//:gtest_main",
28+
"//transports:libhoth_device",
29+
"//protocol/test:libhoth_device_mock",
30+
":rot_firmware_version",
31+
],
32+
)

protocol/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
protocol_srcs = [
22
'host_cmd.c',
3-
'firmware_version.c',
3+
'rot_firmware_version.c',
44
]
55

66
incdir = include_directories('..')
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "firmware_version.h"
15+
#include "rot_firmware_version.h"
1616

17-
int get_fw_version(struct libhoth_device* dev,
18-
struct ec_response_get_version* ver) {
19-
return hostcmd_exec(dev, EC_CMD_GET_VERSION, /*version=*/0, NULL, 0, ver,
20-
sizeof(*ver), NULL);
17+
int libhoth_get_rot_fw_version(struct libhoth_device* dev,
18+
struct ec_response_get_version* ver) {
19+
return hostcmd_exec(dev, EC_CMD_GET_VERSION, /*version=*/0,
20+
/*req_payload=*/NULL, /*req_payload_size=*/0, ver,
21+
sizeof(*ver), /*out_resp_size=*/NULL);
2122
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef _LIBHOTH_PROTOCOL_FIRWARE_VERSION_H_
16-
#define _LIBHOTH_PROTOCOL_FIRWARE_VERSION_H_
15+
#ifndef _LIBHOTH_PROTOCOL_ROT_FIRMWARE_VERSION_H_
16+
#define _LIBHOTH_PROTOCOL_ROT_FIRMWARE_VERSION_H_
1717

1818
#include "host_cmd.h"
1919
#include "transports/libhoth_device.h"
@@ -37,11 +37,11 @@ struct ec_response_get_version {
3737
uint32_t current_image;
3838
} __ec_align4;
3939

40-
int get_fw_version(struct libhoth_device* dev,
41-
struct ec_response_get_version* ver);
40+
int libhoth_get_rot_fw_version(struct libhoth_device* dev,
41+
struct ec_response_get_version* ver);
4242

4343
#ifdef __cplusplus
4444
}
4545
#endif
4646

47-
#endif // _LIBHOTH_TRANSPORTS_FIRWARE_VERSION_H_
47+
#endif // _LIBHOTH_PROTOCOL_ROT_FIRWARE_VERSION_H_
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef _LIBHOTH_PROTOCOL_TEST_FIRMWARE_VERSION_TEST_H_
16-
#define _LIBHOTH_PROTOCOL_TEST_FIRMWARE_VERSION_TEST_H_
17-
18-
#include "protocol/firmware_version.h"
15+
#include "protocol/rot_firmware_version.h"
1916

2017
#include <gmock/gmock.h>
2118
#include <gtest/gtest.h>
2219

23-
#include "libhoth_device_mock.h"
20+
#include "test/libhoth_device_mock.h"
2421

2522
using ::testing::_;
2623
using ::testing::ContainerEq;
@@ -41,11 +38,9 @@ TEST_F(LibHothTest, firmware_version_test) {
4138
.WillOnce(DoAll(CopyResp(&exp_ver, sizeof(exp_ver)), Return(LIBHOTH_OK)));
4239

4340
struct ec_response_get_version ver;
44-
EXPECT_EQ(get_fw_version(&hoth_dev_, &ver), LIBHOTH_OK);
41+
EXPECT_EQ(libhoth_get_rot_fw_version(&hoth_dev_, &ver), LIBHOTH_OK);
4542

4643
ASSERT_THAT(exp_ver.version_string_ro, ContainerEq(ver.version_string_ro));
4744
ASSERT_THAT(exp_ver.version_string_rw, ContainerEq(ver.version_string_rw));
4845
EXPECT_EQ(exp_ver.current_image, ver.current_image);
4946
}
50-
51-
#endif //_LIBHOTH_PROTOCOL_TEST_FIRMWARE_VERSION_TEST_H_

protocol/test/BUILD.bazel

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package(default_visibility = ["//visibility:public"])
2+
13
cc_library(
24
name = "libhoth_device_mock",
35
hdrs = ["libhoth_device_mock.h"],
@@ -8,15 +10,3 @@ cc_library(
810
"//protocol:host_cmd",
911
],
1012
)
11-
12-
cc_test(
13-
name = "firmware_version_test",
14-
srcs = ["firmware_version_test.cc"],
15-
deps = [
16-
"@googletest//:gtest",
17-
"@googletest//:gtest_main",
18-
"//transports:libhoth_device",
19-
":libhoth_device_mock",
20-
"//protocol:firmware_version",
21-
],
22-
)

0 commit comments

Comments
 (0)