Project

General

Profile

Feature #164 » tvheadend_multiadapter.patch

Adds support for adapters with multiple frontends - Simon Liddicott -, 2010-05-05 18:04

View differences:

src/dvb/dvb.h (working copy)
173 173
  struct dvb_frontend_info *tda_fe_info;
174 174

  
175 175
  int tda_adapter_num;
176
  int tda_device_num;
176 177

  
177 178
  char *tda_demux_path;
178 179

  
src/dvb/dvb_adapter.c (working copy)
241 241
{
242 242
  char dev[64];
243 243

  
244
  snprintf(dev, sizeof(dev), "dvb/dvb%d.dvr0", tda->tda_adapter_num);
244
  snprintf(dev, sizeof(dev), "dvb/dvb%d.dvr%d", tda->tda_adapter_num, tda->tda_device_num);
245 245
  tda->tda_hostconnection = get_device_connection(dev);
246 246
 }
247 247

  
......
250 250
 *
251 251
 */
252 252
static void
253
tda_add(int adapter_num)
253
tda_add(int adapter_num, int device_num)
254 254
{
255 255
  char path[200];
256 256
  char fname[256];
......
260 260
  pthread_t ptid;
261 261

  
262 262
  snprintf(path, sizeof(path), "/dev/dvb/adapter%d", adapter_num);
263
  snprintf(fname, sizeof(fname), "%s/frontend0", path);
263
  snprintf(fname, sizeof(fname), "%s/frontend%d", path, device_num);
264 264
  
265 265
  fe = tvh_open(fname, O_RDWR | O_NONBLOCK, 0);
266 266
  if(fe == -1) {
......
273 273
  tda = tda_alloc();
274 274

  
275 275
  tda->tda_adapter_num = adapter_num;
276
  tda->tda_device_num = device_num;
276 277
  tda->tda_rootpath = strdup(path);
277 278
  tda->tda_demux_path = malloc(256);
278
  snprintf(tda->tda_demux_path, 256, "%s/demux0", path);
279
  snprintf(tda->tda_demux_path, 256, "%s/demux%d", path, device_num);
279 280
  tda->tda_dvr_path = malloc(256);
280
  snprintf(tda->tda_dvr_path, 256, "%s/dvr0", path);
281
  snprintf(tda->tda_dvr_path, 256, "%s/dvr%d", path, device_num);
281 282

  
282 283

  
283 284
  tda->tda_fe_fd = fe;
......
293 294

  
294 295
  tda->tda_type = tda->tda_fe_info->type;
295 296

  
296
  snprintf(buf, sizeof(buf), "%s_%s", tda->tda_rootpath,
297
  snprintf(buf, sizeof(buf), "%s_%d_%s", tda->tda_rootpath, tda->tda_device_num,
297 298
	   tda->tda_fe_info->name);
298 299

  
299 300
  r = strlen(buf);
......
316 317
  dvb_adapter_checkspeed(tda);
317 318

  
318 319
  tvhlog(LOG_INFO, "dvb",
319
	 "Found adapter %s (%s) via %s", path, tda->tda_fe_info->name,
320
	 "Found adapter %s (%s) via %s", fname, tda->tda_fe_info->name,
320 321
	 hostconnection2str(tda->tda_hostconnection));
321 322

  
322 323
  TAILQ_INSERT_TAIL(&dvb_adapters, tda, tda_global_link);
......
341 342
  htsmsg_t *l, *c;
342 343
  htsmsg_field_t *f;
343 344
  const char *name, *s;
344
  int i, type;
345
  int i, j, type;
345 346
  th_dvb_adapter_t *tda;
346 347

  
347 348
  TAILQ_INIT(&dvb_adapters);
348 349

  
349 350
  for(i = 0; i < 32; i++) 
350 351
    if ((1 << i) & adapter_mask) 
351
      tda_add(i);
352
      for(j = 0; j < 32; j++) 
353
        tda_add(i, j);
352 354

  
353 355
  l = hts_settings_load("dvbadapters");
354 356
  if(l != NULL) {
(1-1/2)