summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-05-26 20:50:50 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-06-01 09:44:09 +0300
commitefca6310d6edca477d6430dbcb72f8ecc00f7b94 (patch)
tree7f6fd346fa8dcf5d73ce6e87f4e0ec992f8f2dd9
parent7f04878e79b173dbaca546a283850f44188d8840 (diff)
configfs: Don't guess interface numbers if they can't be parsed
Interface numbers are crucial parameters required for proper UVC gadget operation. If we can't parse them from ConfigFS there's little point in falling back to defaults that have a high chance being wrong. Treating that case as a fatal error is better to get the root cause fixed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--configfs.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/configfs.c b/configfs.c
index 4668e59..3b98f55 100644
--- a/configfs.c
+++ b/configfs.c
@@ -280,13 +280,7 @@ static int configfs_parse_interfaces(const char *fpath,
ret = ret ? : attribute_read_uint(fpath, "streaming/bInterfaceNumber",
&fc->streaming_interface);
- if (ret) {
- printf("Failed to obtain interface numbers, using defaults\n");
- fc->control_interface = 0;
- fc->streaming_interface = 1;
- }
-
- return 0;
+ return ret;
}
/*
@@ -346,8 +340,8 @@ struct uvc_function_config *configfs_parse_uvc_function(const char *function)
if (!fc->video)
ret = -ENODEV;
- /* Identify interface numbers, or fall back to defaults. */
- configfs_parse_interfaces(fpath, fc);
+ /* Identify interface numbers. */
+ ret = ret ? : configfs_parse_interfaces(fpath, fc);
ret = ret ? : attribute_read_uint(fpath, "streaming_interval",
&fc->streaming_interval);