This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: keytable: allow a period or delay of 0 to be set
Author:  Sean Young <s...@mess.org>
Date:    Mon Nov 27 21:58:44 2017 +0000

If period or delay is zero, then autorepeat is turned off.

Signed-off-by: Sean Young <s...@mess.org>

 utils/keytable/keytable.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=40f7bd3e5e0f6072acaa5633f0111c217456378a
diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 4c1e86414193..988e98570c30 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -250,8 +250,8 @@ static int readtable = 0;
 static int clear = 0;
 static int debug = 0;
 static int test = 0;
-static int delay = 0;
-static int period = 0;
+static int delay = -1;
+static int period = -1;
 static enum sysfs_protocols ch_proto = 0;
 
 struct cfgfile cfg = {
@@ -477,10 +477,14 @@ static error_t parse_opt(int k, char *arg, struct 
argp_state *state)
                clear++;
                break;
        case 'D':
-               delay = atoi(arg);
+               delay = strtol(arg, &p, 10);
+               if (!p || *p || delay < 0)
+                       argp_error(state, _("Invalid delay: %s"), arg);
                break;
        case 'P':
-               period = atoi(arg);
+               period = strtol(arg, &p, 10);
+               if (!p || *p || period < 0)
+                       argp_error(state, _("Invalid period: %s"), arg);
                break;
        case 'd':
                devicename = arg;
@@ -1513,7 +1517,7 @@ int main(int argc, char *argv[])
        argp_parse(&argp, argc, argv, ARGP_NO_HELP, 0, 0);
 
        /* Just list all devices */
-       if (!clear && !readtable && !keytable && !ch_proto && !cfg.next && 
!test && !delay && !period) {
+       if (!clear && !readtable && !keytable && !ch_proto && !cfg.next && 
!test && delay < 0 && period < 0) {
                if (devicename) {
                        fd = open(devicename, O_RDONLY);
                        if (fd < 0) {
@@ -1659,12 +1663,12 @@ int main(int argc, char *argv[])
        /*
         * Fiveth step: change repeat rate/delay
         */
-       if (delay || period) {
+       if (delay >= 0 || period >= 0) {
                unsigned int new_delay, new_period;
                get_rate(fd, &new_delay, &new_period);
-               if (delay)
+               if (delay >= 0)
                        new_delay = delay;
-               if (period)
+               if (period >= 0)
                        new_period = period;
                set_rate(fd, new_delay, new_period);
        }

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to