cederom commented on code in PR #4098:
URL: https://github.com/apache/nuttx-apps/pull/4098#discussion_r4642733111
##########
graphics/input/generator/input.c:
##########
@@ -259,6 +268,96 @@ static int input_button(input_gen_ctx_t ctx, int argc,
char **argv)
return result;
}
+/****************************************************************************
+ * Name: parse_scroll_value
+ ****************************************************************************/
+
+static int parse_scroll_value(int argc, char **argv, int16_t *value)
+{
+ int i;
+
+ *value = 0;
+
+ /* Simple form: scroll <value> */
+
+ if (argc >= 2 && strncmp(argv[1], "--", 2) != 0)
+ {
+ return parse_arg_to_int16(argv[1], value);
+ }
+
+ /* Android-style form: scroll --axis SCROLL,<value> */
+
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp(argv[i], "--axis") == 0 && i + 1 < argc)
+ {
+ FAR char *arg = argv[i + 1];
+ FAR char *comma = strchr(arg, ',');
+
+ if (comma == NULL)
+ {
+ return 1;
+ }
+
+ return parse_arg_to_int16(comma + 1, value);
+ }
+ }
+
+ return 1;
Review Comment:
Can we stick to negative and standard error return codes on error please? :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]