mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
tools: add another "action" subcommand to set/get buttons
Like usage() already documented Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -1342,6 +1342,36 @@ static const struct ratbag_cmd cmd_button_set = {
|
||||
},
|
||||
};
|
||||
|
||||
static int
|
||||
ratbag_cmd_button_action(const struct ratbag_cmd *cmd,
|
||||
struct ratbag *ratbag,
|
||||
struct ratbag_cmd_options *options,
|
||||
int argc, char **argv)
|
||||
{
|
||||
const char *command;
|
||||
|
||||
if (argc < 1)
|
||||
return ERR_USAGE;
|
||||
|
||||
command = argv[0];
|
||||
|
||||
return run_subcommand(command,
|
||||
cmd,
|
||||
ratbag, options,
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
static const struct ratbag_cmd cmd_button_action = {
|
||||
.name = "action",
|
||||
.cmd = ratbag_cmd_button_action,
|
||||
.flags = FLAG_NEED_DEVICE | FLAG_NEED_PROFILE | FLAG_NEED_BUTTON,
|
||||
.subcommands = {
|
||||
&cmd_button_get,
|
||||
&cmd_button_set,
|
||||
NULL,
|
||||
},
|
||||
};
|
||||
|
||||
static int
|
||||
ratbag_cmd_button(const struct ratbag_cmd *cmd,
|
||||
struct ratbag *ratbag,
|
||||
@@ -1387,8 +1417,7 @@ static const struct ratbag_cmd cmd_button = {
|
||||
.flags = FLAG_NEED_DEVICE | FLAG_NEED_PROFILE,
|
||||
.subcommands = {
|
||||
&cmd_button_count,
|
||||
&cmd_button_get,
|
||||
&cmd_button_set,
|
||||
&cmd_button_action,
|
||||
NULL,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -49,14 +49,14 @@ cmds[18]="profile 0 resolution 0 rate get"
|
||||
cmds[19]="profile 0 resolution 0 rate set 500"
|
||||
cmds[20]="button count"
|
||||
cmds[21]="profile 0 button count"
|
||||
cmds[22]="button 0 get"
|
||||
cmds[23]="button 0 set button 1"
|
||||
cmds[24]="profile 0 button 0 get"
|
||||
cmds[25]="profile 0 button 0 set button 1"
|
||||
cmds[26]="button 0 set key KEY_ENTER"
|
||||
cmds[27]="profile 0 button 0 set key KEY_ENTER"
|
||||
cmds[28]="button 0 set special doubleclick"
|
||||
cmds[29]="profile 0 button 0 set special doubleclick"
|
||||
cmds[22]="button 0 action get"
|
||||
cmds[23]="button 0 action set button 1"
|
||||
cmds[24]="profile 0 button 0 action get"
|
||||
cmds[25]="profile 0 button 0 action set button 1"
|
||||
cmds[26]="button 0 action set key KEY_ENTER"
|
||||
cmds[27]="profile 0 button 0 action set key KEY_ENTER"
|
||||
cmds[28]="button 0 action set special doubleclick"
|
||||
cmds[29]="profile 0 button 0 action set special doubleclick"
|
||||
|
||||
for i in "${cmds[@]}"; do
|
||||
echo "Testing arguments '$i $device'"
|
||||
|
||||
Reference in New Issue
Block a user