Skip to content

Add cvd input_devices subcommand - #3131

Open
jemoreira wants to merge 3 commits into
google:mainfrom
jemoreira:input_capture_cmd
Open

Add cvd input_devices subcommand#3131
jemoreira wants to merge 3 commits into
google:mainfrom
jemoreira:input_capture_cmd

Conversation

@jemoreira

Copy link
Copy Markdown
Member

Bug: b/554190370

@jemoreira
jemoreira requested a review from Databean September 2, 2026 22:36
@jemoreira
jemoreira force-pushed the input_capture_cmd branch 2 times, most recently from 9a58325 to 1566eb7 Compare September 3, 2026 00:28

@Databean Databean left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed only the last commit.

Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
Comment on lines +191 to +197
if (cmd == kListCommand || cmd == kLsAlias) {
CF_EXPECT(ListDevices(request, std::move(args)));
} else if (cmd == kCaptureCommand) {
CF_EXPECT(CaptureEvents(request, std::move(args)));
} else if (cmd == kInjectCommand) {
CF_EXPECT(InjectEvents(request, std::move(args)));
} else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only CommandHandler had a CanHandle method, then these all could have been separate CommandHandlers.

Maybe they still can, the inner subcommands could still be separate CommandHandler classes that are only created inside the CvdInputDevicesHandler.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only CommandHandler had a CanHandle method, then these all could have been separate CommandHandlers.

But then the arguments parsing would have to be repeated 3 times (at worst)

Maybe they still can, the inner subcommands could still be separate CommandHandler classes that are only created inside the CvdInputDevicesHandler.

That would complicate the help output though. I'd rather have three different commands: list_input_devices, capture_input_events and inject_input_events. But I still prefer this implementation over that one. If you're worried about the file being too long I can make it a directory and split it like monitor does. WDYT?

Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/input_devices.cpp Outdated
@jemoreira
jemoreira force-pushed the input_capture_cmd branch 3 times, most recently from b079749 to 55bbbf9 Compare September 3, 2026 21:55
@jemoreira
jemoreira requested a review from Databean September 3, 2026 21:55
The vhost-user-input backend accepts connections on an extra unix
socket. Events received through the main server are sent to any client
connected to this server in addition to the frontend. At most one
connection is allowed through this server at a time.

Bug: b/554190370
The new subcommand allows listing input devices as well as capturing and
injecting input events.

Bug: b/554190370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants