Skip to contentSkip to conversation

libv4l2subdev: Allow extra spaces between format strings

PATCH In review Sakari Ailus 2 participants 2 messages Mar 11, 2016 – Mar 17, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libv4l2subdev: Allow extra spaces between format strings

It's possible to pass more than one format string (and entity) to v4l2_subdev_parse_setup_formats(), yet v4l2_subdev_parse_pad_format() does not parse the string until the next non-space character. v4l2_subdev_parse_setup_formats() expects to find a comma right after that leading spaces before the comma to produce an error.

Seek until no spaces are seen.

---
 utils/media-ctl/libv4l2subdev.c | 1 +
 1 file changed, 1 insertion(+)
utils/media-ctl/libv4l2subdev.c +1 -0
index 1f5fca4..3dcf943 100644
@@ -723,6 +723,7 @@ int v4l2_subdev_parse_setup_formats(struct media_device *media, const char *p)
 		if (ret < 0)
 			return ret;
 
+		for (; isspace(*end); end++);
 		p = end + 1;
 	} while (*end == ',');
 
Signature · 1 line
2.1.0.231.g7484e3b
Acked-by on v1 1/1
#1 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 9 lines · On Friday 11 March 2016 22:43:18 Sakari Ailus wrote:

It's possible to pass more than one format string (and entity) to v4l2_subdev_parse_setup_formats(), yet v4l2_subdev_parse_pad_format() does not parse the string until the next non-space character. v4l2_subdev_parse_setup_formats() expects to find a comma right after that leading spaces before the comma to produce an error.

Seek until no spaces are seen.

Quoted 15 lines
---
 utils/media-ctl/libv4l2subdev.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/utils/media-ctl/libv4l2subdev.c index 1f5fca4..3dcf943 100644

utils/media-ctl/libv4l2subdev.c +1 -0
@@ -723,6 +723,7 @@ int v4l2_subdev_parse_setup_formats(struct media_device
 *media, const char *p) if (ret < 0)
 			return ret;
 
+		for (; isspace(*end); end++);
 		p = end + 1;
 	} while (*end == ',');
Signature · 3 lines
Regards,

Laurent Pinchart