qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle
@ 2018-01-07 11:13 byxk
  2018-01-07 11:13 ` [Qemu-devel] [PATCH 1/1] " byxk
  2018-01-07 11:31 ` [Qemu-devel] [PATCH 0/1] " no-reply
  0 siblings, 2 replies; 4+ messages in thread
From: byxk @ 2018-01-07 11:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel, byxk

Hi QEMU,

This patch allows one to pass either one or both of
--evdev-lhotkey {keycode} and --evdev-rhotkey {keycode}
to change the default key combo to toggle evdev grab.

I had trouble figuring out where to set defaults
(LCTRL +  RCTRL), so ended up setting it directly.

This is my first patch ever to anything so any help/feedback is
appreciated.

Thanks,
    byxk

byxk (1):
  input-linux: provide hotkeys for evdev toggle

 include/ui/input.h |  3 +++
 qemu-options.hx    | 13 +++++++++++++
 ui/input-linux.c   |  4 ++--
 vl.c               |  8 ++++++++
 4 files changed, 26 insertions(+), 2 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/1] input-linux: provide hotkeys for evdev toggle
  2018-01-07 11:13 [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle byxk
@ 2018-01-07 11:13 ` byxk
  2018-01-07 11:31 ` [Qemu-devel] [PATCH 0/1] " no-reply
  1 sibling, 0 replies; 4+ messages in thread
From: byxk @ 2018-01-07 11:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel, byxk

---
 include/ui/input.h |  3 +++
 qemu-options.hx    | 13 +++++++++++++
 ui/input-linux.c   |  4 ++--
 vl.c               |  8 ++++++++
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/include/ui/input.h b/include/ui/input.h
index 5cc76d6e41..94b1468159 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -80,4 +80,7 @@ extern const guint16 qemu_input_map_qnum_to_qcode[];
 extern const guint qemu_input_map_qcode_to_linux_len;
 extern const guint16 qemu_input_map_qcode_to_linux[];
 
+extern int qemu_evdev_rhotkey;
+extern int qemu_evdev_lhotkey;
+
 #endif /* INPUT_H */
diff --git a/qemu-options.hx b/qemu-options.hx
index 94647e21e3..56cafd7592 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4264,6 +4264,19 @@ contents of @code{iv.b64} to the second secret
 
 ETEXI
 
+DEF("evdev-lhotkey", HAS_ARG, QEMU_OPTION_evdev_lhotkey, "--evdev-lhotkey    left hotkey for evdev input toggle, default=LEFTCTRL(29)\n", QEMU_ARCH_ALL)
+STEXI
+@item --evdev-lhotkey @var{evdevLHotkey}
+@findex --evdev-lhotkey
+Left keycode to use in toggling evdev
+ETEXI
+
+DEF("evdev-rhotkey", HAS_ARG, QEMU_OPTION_evdev_rhotkey, "--evdev-rhotkey     right hotkey for evdev input toggle, default=RIGHTCTRL(97)\n", QEMU_ARCH_ALL)
+STEXI
+@item --evdev-rhotkey @var{evdevRHotkey}
+@findex --evdev-rhotkey
+Right keycode to use in toggling evdev
+ETEXI
 
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
diff --git a/ui/input-linux.c b/ui/input-linux.c
index 9720333b2c..8af1450dce 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -134,8 +134,8 @@ static void input_linux_handle_keyboard(InputLinux *il,
         }
 
         /* hotkey -> record switch request ... */
-        if (il->keydown[KEY_LEFTCTRL] &&
-            il->keydown[KEY_RIGHTCTRL]) {
+        if (il->keydown[qemu_evdev_lhotkey] &&
+            il->keydown[qemu_evdev_rhotkey]) {
             il->grab_request = true;
         }
 
diff --git a/vl.c b/vl.c
index d3a5c5d021..7bdf6030cf 100644
--- a/vl.c
+++ b/vl.c
@@ -184,6 +184,8 @@ bool boot_strict;
 uint8_t *boot_splash_filedata;
 size_t boot_splash_filedata_size;
 uint8_t qemu_extra_params_fw[2];
+int qemu_evdev_lhotkey = 29;  /* LEFTCONTROL */
+int qemu_evdev_rhotkey = 97;  /* RIGHTCONTROL */
 
 int icount_align_option;
 
@@ -3378,6 +3380,12 @@ int main(int argc, char **argv, char **envp)
                 qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg,
                               &error_abort);
                 break;
+            case QEMU_OPTION_evdev_rhotkey:
+                qemu_evdev_rhotkey = strtol(optarg, NULL, 0);
+                break;
+            case QEMU_OPTION_evdev_lhotkey:
+                qemu_evdev_lhotkey = strtol(optarg, NULL, 0);
+                break;
             case QEMU_OPTION_append:
                 qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg,
                               &error_abort);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle
  2018-01-07 11:13 [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle byxk
  2018-01-07 11:13 ` [Qemu-devel] [PATCH 1/1] " byxk
@ 2018-01-07 11:31 ` no-reply
  2018-01-07 11:45   ` Patrick Tseng
  1 sibling, 1 reply; 4+ messages in thread
From: no-reply @ 2018-01-07 11:31 UTC (permalink / raw)
  To: patricktsen; +Cc: famz, qemu-devel, kraxel

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180107111341.8879-1-patricktsen@gmail.com
Subject: [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
8d2dfcbd73 input-linux: provide hotkeys for evdev toggle

=== OUTPUT BEGIN ===
Checking PATCH 1/1: input-linux: provide hotkeys for evdev toggle...
ERROR: consider using qemu_strtol in preference to strtol
#77: FILE: vl.c:3384:
+                qemu_evdev_rhotkey = strtol(optarg, NULL, 0);

ERROR: consider using qemu_strtol in preference to strtol
#80: FILE: vl.c:3387:
+                qemu_evdev_lhotkey = strtol(optarg, NULL, 0);

ERROR: Missing Signed-off-by: line(s)

total: 3 errors, 0 warnings, 56 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle
  2018-01-07 11:31 ` [Qemu-devel] [PATCH 0/1] " no-reply
@ 2018-01-07 11:45   ` Patrick Tseng
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick Tseng @ 2018-01-07 11:45 UTC (permalink / raw)
  To: qemu-devel

Please disregard this patch, I'll have another one ready and actually
isolated to input-linux.

On Sun, Jan 7, 2018 at 3:31 AM, <no-reply@patchew.org> wrote:

> Hi,
>
> This series seems to have some coding style problems. See output below for
> more information:
>
> Type: series
> Message-id: 20180107111341.8879-1-patricktsen@gmail.com
> Subject: [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev
> toggle
>
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
>
> BASE=base
> n=1
> total=$(git log --oneline $BASE.. | wc -l)
> failed=0
>
> git config --local diff.renamelimit 0
> git config --local diff.renames True
>
> commits="$(git log --format=%H --reverse $BASE..)"
> for c in $commits; do
>     echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
>     if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback
> -; then
>         failed=1
>         echo
>     fi
>     n=$((n+1))
> done
>
> exit $failed
> === TEST SCRIPT END ===
>
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> Switched to a new branch 'test'
> 8d2dfcbd73 input-linux: provide hotkeys for evdev toggle
>
> === OUTPUT BEGIN ===
> Checking PATCH 1/1: input-linux: provide hotkeys for evdev toggle...
> ERROR: consider using qemu_strtol in preference to strtol
> #77: FILE: vl.c:3384:
> +                qemu_evdev_rhotkey = strtol(optarg, NULL, 0);
>
> ERROR: consider using qemu_strtol in preference to strtol
> #80: FILE: vl.c:3387:
> +                qemu_evdev_lhotkey = strtol(optarg, NULL, 0);
>
> ERROR: Missing Signed-off-by: line(s)
>
> total: 3 errors, 0 warnings, 56 lines checked
>
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
>
> === OUTPUT END ===
>
> Test command exited with code: 1
>
>
> ---
> Email generated automatically by Patchew [http://patchew.org/].
> Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-07 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-07 11:13 [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle byxk
2018-01-07 11:13 ` [Qemu-devel] [PATCH 1/1] " byxk
2018-01-07 11:31 ` [Qemu-devel] [PATCH 0/1] " no-reply
2018-01-07 11:45   ` Patrick Tseng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).