diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-04-30 14:43:16 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-04-30 14:43:16 +0200 |
commit | 5cd3115fdae5989c5765d7fa53454488a17287c2 (patch) | |
tree | c8e32ee0be3d1149ab50f4a8e8c2de31796c416f | |
parent | 72fcf5182aec18498017f5d9fd6bc675ad0a4200 (diff) |
Support holes in menu indices
When querying menu entries, don't stop at the first error returned by
the driver but loop over the [min,max] range and print supported menu
entries only.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | yavta.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -439,20 +439,19 @@ static int video_enable(struct device *dev, int enable) return 0; } -static void video_query_menu(struct device *dev, unsigned int id) +static void video_query_menu(struct device *dev, unsigned int id, + unsigned int min, unsigned int max) { struct v4l2_querymenu menu; int ret; - menu.index = 0; - while (1) { + for (menu.index = min; menu.index <= max; menu.index++) { menu.id = id; ret = ioctl(dev->fd, VIDIOC_QUERYMENU, &menu); if (ret < 0) - break; + continue; printf(" %u: %.32s\n", menu.index, menu.name); - menu.index++; }; } @@ -493,7 +492,7 @@ static void video_list_controls(struct device *dev) query.step, query.default_value, value); if (query.type == V4L2_CTRL_TYPE_MENU) - video_query_menu(dev, query.id); + video_query_menu(dev, query.id, query.minimum, query.maximum); nctrls++; } |