ceton / infinitv_pcie

Linux driver for the Ceton InfiniTV PCIe
15 stars 16 forks source link

Tuner "Count" Incorrect, PCIe Device #16

Open arrmo opened 2 years ago

arrmo commented 2 years ago

Hi,

I have an InfiniTV 4, but the driver sets up 6 devices still. Thinking it's hard coded, but really ... it should set up the number of devices based on the tuner count, right?

Thanks!

JamesRHarris commented 2 years ago

Yes this is the case. The code of interest is ctn91xx.h:#define NUM_MPEG_DEVICES 12 and

int ctn91xx_init_mpeg( ctn91xx_dev_t* dev )
{
    int i;
    cdev_init( &dev->mpeg_cdev, &ctn91xx_mpeg_fops );
    dev->mpeg_cdev.owner = THIS_MODULE;
    cdev_add( &dev->mpeg_cdev, MKDEV( CETON_MAJOR, CETON_MINOR( dev->board_number, MPEG_DEVICE_NUMBER ) ), NUM_MPEG_DEVICES );

    for( i=0; i<NUM_MPEG_DEVICES/2; i++ ) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        device_create( dev->class, NULL, MKDEV( CETON_MAJOR, CETON_MINOR( dev->board_number, 1 + i ) ), "ctn91xx_mpeg%d_%d", dev->board_number, i );
        device_create( dev->class, NULL, MKDEV( CETON_MAJOR, CETON_MINOR( dev->board_number, 7 + i ) ), "ctn91xx_filter%d_%d", dev->board_number, i );
#else
        device_create( dev->class, NULL, MKDEV( CETON_MAJOR, CETON_MINOR( dev->board_number, 1 + i ) ), dev, "ctn91xx_mpeg%d_%d", dev->board_number, i );
        device_create( dev->class, NULL, MKDEV( CETON_MAJOR, CETON_MINOR( dev->board_number, 7 + i ) ), dev, "ctn91xx_filter%d_%d", dev->board_number, i );
#endif
    }
    return 0;
}

This seems to be orphaned code. You can see there are pending merges to support rather old kernels they have yet to do anything with.

arrmo commented 2 years ago

Thanks! And agreed - I believe the company is defunct, so no support any more 😞.

I'm just a bit surprised that they hard coded the number of devices - vs. detecting it, and adjusting accordingly ... agreed? Based on the UI (web interface), they clearly can detect if it's a 4 or 6 tuner card, not sure why it's not used here also. You don't happen to know that detection mechanism, do you?

Thanks!!

JamesRHarris commented 2 years ago

The web interfaced is served directly from the card itself. It may be possible to pull the number of tuners from the card via the PCI. That said I don't know we would see such a change unless someone really wanted to take over support of the code base.

arrmo commented 2 years ago

Yep, agreed. I was thinking there should / must be a register that has the info - would make that a relatively easy correction at that point.

Thanks!