qv4l2: bug fix in re-subscribing source change events
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 21 Jul 2014 18:16:39 +0000 (20:16 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Mon, 21 Jul 2014 18:16:39 +0000 (20:16 +0200)
The source change event was only subscribed for the first event, not
for any of the others. Apparently an 'if-while' construct is legal (?!),
but I meant to write 'if () { do {} while() }'.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/general-tab.cpp

index 978eb46..76de783 100644 (file)
@@ -280,12 +280,14 @@ void GeneralTab::sourceChangeSubscribe()
        v4l2_input vin;
 
        if (!enum_input(vin, true)) {
-               struct v4l2_event_subscription sub = {
-                       V4L2_EVENT_SOURCE_CHANGE, vin.index
-               };
+               do {
+                       struct v4l2_event_subscription sub = {
+                               V4L2_EVENT_SOURCE_CHANGE, vin.index
+                       };
 
-               subscribe_event(sub);
-       } while (!enum_input(vin));
+                       subscribe_event(sub);
+               } while (!enum_input(vin));
+       }
 }
 
 void GeneralTab::inputSection(bool needsStd, bool needsTimings, v4l2_input vin)