File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 3636namespace cuttlefish {
3737namespace {
3838
39+ static const char kUsage [] =
40+ R"(
41+
42+ Interact with a Cuttlefish virtual device's displays.
43+
44+ usage: cvd display <subcommand> <args>
45+
46+ Commands:(cvd display help <subcommand> for more information):
47+
48+ add: Adds and connects displays.
49+
50+ list: Lists all of the displays currently connected.
51+
52+ remove: Disconnects and removes displays.
53+
54+ screenshot: Screenshots the contents of a given display.
55+ )" ;
56+
3957static const char kAddUsage [] =
4058 R"(
4159
@@ -81,6 +99,11 @@ Result<int> GetInstanceNum(std::vector<std::string>& args) {
8199}
82100
83101Result<int > DoHelp (std::vector<std::string>& args) {
102+ if (args.empty ()) {
103+ std::cerr << kUsage << std::endl;
104+ return 0 ;
105+ }
106+
84107 static const android::base::NoDestructor<
85108 std::unordered_map<std::string, std::string>>
86109 kSubCommandUsages ({
Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ Result<int> CrosvmDisplayController::RunCrosvmDisplayCommand(
107107
108108 Result<std::string> res = RunAndCaptureStdout (std::move (command));
109109 if (res.ok ()) {
110- *stdout_str = CF_EXPECT (std::move (res));
110+ if (stdout_str != nullptr ) {
111+ *stdout_str = std::move (*res);
112+ }
111113 return 0 ;
112114 } else {
113115 LOG (ERROR) << " Failed to run crosvm display command:\n "
Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ cvd_command_boot_test(
6565 target = "aosp_cf_x86_64_only_phone-userdebug" ,
6666)
6767
68+ cvd_command_boot_test (
69+ name = "add_displays" ,
70+ branch = "aosp-android-latest-release" ,
71+ cvd_command = [
72+ "display" ,
73+ "add" ,
74+ "--display=width=500,height=500" ,
75+ ],
76+ target = "aosp_cf_x86_64_only_phone-userdebug" ,
77+ )
78+
6879cvd_command_boot_test (
6980 name = "list_displays" ,
7081 branch = "aosp-android-latest-release" ,
You can’t perform that action at this time.
0 commit comments