Bug 1276927: Add V4L ioctl 'VIDIOC_S_HW_FREQ_SEEK' if undefined by Linux, r=gsvelto draft
authorThomas Zimmermann <tdz@users.sourceforge.net>
Wed, 15 Jun 2016 16:10:45 +0100
changeset 378345 03fcafd3ab5b9001e6269703952a1894025457a2
parent 378344 8d5281910374661d0aae147822f56e4bab5250ac
child 378346 898628364ba7143aed07bfc455fab5571c61c193
push id20985
push usertdz@users.sourceforge.net
push dateThu, 16 Jun 2016 07:41:33 +0000
reviewersgsvelto
bugs1276927
milestone50.0a1
Bug 1276927: Add V4L ioctl 'VIDIOC_S_HW_FREQ_SEEK' if undefined by Linux, r=gsvelto MozReview-Commit-ID: 5ZvrhwOyfYy
hal/gonk/GonkFMRadio.cpp
--- a/hal/gonk/GonkFMRadio.cpp
+++ b/hal/gonk/GonkFMRadio.cpp
@@ -24,20 +24,20 @@
 #include <fcntl.h>
 #include <linux/videodev2.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/epoll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-
 /* Bionic might not have the newer version of the v4l2 headers that
  * define these controls, so we define them here if they're not found.
  */
+
 #ifndef V4L2_CTRL_CLASS_FM_RX
 #define V4L2_CTRL_CLASS_FM_RX 0x00a10000
 #define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
 #define V4L2_CID_TUNE_DEEMPHASIS  (V4L2_CID_FM_RX_CLASS_BASE + 1)
 #define V4L2_DEEMPHASIS_DISABLED  0
 #define V4L2_DEEMPHASIS_50_uS     1
 #define V4L2_DEEMPHASIS_75_uS     2
 #define V4L2_CID_RDS_RECEPTION    (V4L2_CID_FM_RX_CLASS_BASE + 2)
@@ -55,16 +55,30 @@ struct v4l2_rds_data {
 #define V4L2_RDS_BLOCK_C 2
 #define V4L2_RDS_BLOCK_D 3
 #define V4L2_RDS_BLOCK_C_ALT 4
 #define V4L2_RDS_BLOCK_INVALID 7
 #define V4L2_RDS_BLOCK_CORRECTED 0x40
 #define V4L2_RDS_BLOCK_ERROR 0x80
 #endif
 
+#ifndef VIDIOC_S_HW_FREQ_SEEK
+struct v4l2_hw_freq_seek {
+ __u32 tuner;
+ __u32 type;
+ __u32 seek_upward;
+ __u32 wrap_around;
+ __u32 spacing;
+ __u32 rangelow;
+ __u32 rangehigh;
+ __u32 reserved[5];
+};
+#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
+#endif
+
 namespace mozilla {
 namespace hal_impl {
 
 uint32_t GetFMRadioFrequency();
 
 static int sRadioFD;
 static bool sRadioEnabled;
 static bool sRDSEnabled;
@@ -258,17 +272,17 @@ runMsmFMRadio(void *)
       break;
     }
 
     /* The tavarua driver reports a number of things asynchronously.
      * In those cases, the status update comes from this thread. */
     for (unsigned int i = 0; i < buffer.bytesused; i++) {
       switch (buf[i]) {
       case TAVARUA_EVT_RADIO_READY:
-        // The driver sends RADIO_READY both when we turn the radio on and when we turn 
+        // The driver sends RADIO_READY both when we turn the radio on and when we turn
         // the radio off.
         if (sRadioEnabled) {
           NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE,
                                                   hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
         }
         break;
 
       case TAVARUA_EVT_SEEK_COMPLETE: