Project

General

Profile

Feature #2711 ยป a.patch

First patch - Jaroslav Kysela, 2015-03-19 13:14

View differences:

src/input/mpegts/linuxdvb/linuxdvb_adapter.c
162 162
 *
163 163
 */
164 164
static dvb_fe_type_t
165
linux_dvb_get_type(int linux_type)
165
linuxdvb_get_type(int linux_type)
166 166
{
167 167
  switch (linux_type) {
168 168
  case FE_QPSK:
......
179 179
}
180 180

  
181 181
/*
182
 *
183
 */
184
static void
185
linuxdvb_get_systems(int fd, struct dtv_property *_cmd)
186
{
187
  struct dtv_property cmd = {
188
    .cmd = DTV_ENUM_DELSYS
189
  };
190
  struct dtv_properties cmdseq = {
191
    .num   = 1,
192
    .props = &cmd
193
  };
194
  int r;
195

  
196
  r = ioctl(fd, FE_GET_PROPERTY, &cmdseq);
197
  if (!r && cmd.u.buffer.len) {
198
    struct dtv_property fecmd[2] = {
199
      {
200
        .cmd    = DTV_DELIVERY_SYSTEM,
201
        .u.data = cmd.u.buffer.data[0]
202
      },
203
      {
204
        .cmd    = DTV_TUNE
205
      }
206
    };
207
    cmdseq.props = fecmd;
208
    cmdseq.num   = 2;
209
    r = ioctl(fd, FE_SET_PROPERTY, &cmdseq);
210
  } else {
211
    cmd.u.buffer.len = 0;
212
  }
213
  *_cmd = cmd;
214
}
215

  
216
/*
182 217
 * Add adapter by path
183 218
 */
184 219
static void
......
199 234
#if DVB_VER_ATLEAST(5,5)
200 235
  int delsys;
201 236
  dvb_fe_type_t fetypes[DVB_TYPE_LAST+1] = { 0 };
202
  struct dtv_property   cmd = {
203
    .cmd = DTV_ENUM_DELSYS
204
  };
205
  struct dtv_properties cmdseq = {
206
    .num   = 1,
207
    .props = &cmd
208
  };
237
  struct dtv_property cmd;
209 238
#endif
210 239

  
211 240
  /* Validate the path */
......
243 272
      continue;
244 273
    }
245 274
#if DVB_VER_ATLEAST(5,5)
246
    r = ioctl(fd, FE_GET_PROPERTY, &cmdseq);
247
    if (!r && cmd.u.buffer.len) {
248
      struct dtv_property fecmd[2] = {
249
        {
250
          .cmd    = DTV_DELIVERY_SYSTEM,
251
          .u.data = cmd.u.buffer.data[0]
252
        },
253
        {
254
          .cmd    = DTV_TUNE
255
        }
256
      };
257
      cmdseq.props = fecmd;
258
      cmdseq.num   = 2;
259
      r = ioctl(fd, FE_SET_PROPERTY, &cmdseq);
260
    } else {
261
      cmd.u.buffer.len = 0;
262
    }
275
    linuxdvb_get_systems(fd, &cmd);
263 276
#endif
264 277
    r = ioctl(fd, FE_GET_INFO, &dfi);
265 278
    close(fd);
......
267 280
      tvhlog(LOG_ERR, "linuxdvb", "unable to query %s", fe_path);
268 281
      continue;
269 282
    }
270
    type = linux_dvb_get_type(dfi.type);
283
    type = linuxdvb_get_type(dfi.type);
271 284
    if (type == DVB_TYPE_NONE) {
272 285
      tvhlog(LOG_ERR, "linuxdvb", "unable to determine FE type %s - %i", fe_path, dfi.type);
273 286
      continue;
    (1-1/1)