diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-05-26 20:50:50 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-06-01 09:44:09 +0300 |
commit | efca6310d6edca477d6430dbcb72f8ecc00f7b94 (patch) | |
tree | 7f6fd346fa8dcf5d73ce6e87f4e0ec992f8f2dd9 /configfs.c | |
parent | 7f04878e79b173dbaca546a283850f44188d8840 (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>
Diffstat (limited to 'configfs.c')
-rw-r--r-- | configfs.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -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); |