Opened 5 years ago

Closed 5 years ago

#13443 closed Patch - Bug Fix (fixed)

V4L2 error message for each CaptureCard

Reported by: Klaas de Waal Owned by: Klaas de Waal
Priority: minor Milestone: 31.0
Component: MythTV - Mythtv-setup Version: Master Head
Severity: low Keywords: V4L2 DVB capturecard setup
Cc: Stuart Auchterlonie, gigem Ticket locked: no

Description

After selecting mythtv-setup page "Capture cards" the following error message is given in the log for each defined capture card:

2019-04-06 22:26:13.504850 E  V4L2(): Could not open '': 
			eno: No such file or directory (2)

This message is also given when a new capture card is created by selecting "(New capture card)".

What happens is that, when mythtv is configured to support V4L2, each instantiation of a CaptureCard? object causes a call to V4L2encGroup::probeCard. However, at this moment there is no device name so this fails.

The easy fix is to not call probeCard if the device name is empty.
A patch for this is attached.

However, it maybe possible that there is a more elegant solution.

The following is a description of what happens in videosource.cpp and v4l2util.cpp.

Creation of the CaptureCard?:

CaptureCard::CaptureCard(bool use_card_group)
    : m_id(new ID)
{
    addChild(m_id);
    if (use_card_group)
        CaptureCardGroup(*this);
    addChild(new Hostname(*this));
}

In CaptureCardGroup::CaptureCardGroup? a new V4L2encGroup is created:

#ifdef USING_V4L2
    cardtype->addTargetedChild("V4L2ENC", new V4L2encGroup(parent, *cardtype));

In V4L2encGroup::V4L2encGroup then the card probe is called:

probeCard(m_device->getValue());

N.B. The attached patch modifies the above so that probeCard is only called when the device name is not empty.

In V4L2encGroup::probeCard an instance of V4L2util is created:

void V4L2encGroup::probeCard(const QString &device_name)
{
#ifdef USING_V4L2
    QString    card_name = tr("Failed to open");
    QString    card_info = card_name;
    V4L2util   v4l2(device_name);

The actual error message this ticket is about is then finally given in V4l2util::Open

    m_fd = open(dev_name.toLatin1().constData(), O_RDWR);
    if (m_fd < 0)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC +
            QString("Could not open '%1': ").arg(dev_name) + ENO);
        return false;
    }

Attachments (1)

20190406-v4l2-not-probe-if-no-device.patch (653 bytes) - added by Klaas de Waal 5 years ago.
Do not probe possible V4L2 device if there is no device name given.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by Klaas de Waal

Do not probe possible V4L2 device if there is no device name given.

comment:1 Changed 5 years ago by Klaas de Waal

Milestone: needs_triage31.0

If the system does have a V4L2 encoder device, such as an Hauppauge PVR-150, then the probeCard function is called with the name of that device, e.g. "/dev/video0". In a system with only digital tuners there is no device found and hence the string is empty.

It would be possible to not create the V4L2 encoder device menu structure if no device can be found. However, there is the possibility that a V4L2 encoder device does not have a standard filename and therefore the menu has the possibility to enter a user-defined filename for a V4L2 encoder device even if there was no V4L2 encoder device found using the default filenames.

Therefore the solution in the patch, unconditionally create the V4L2 encoder device menu structure but do not do the probeCard if there is no device found, is correct.

comment:2 Changed 5 years ago by Klaas de Waal <kdewaal@…>

Resolution: fixed
Status: assignedclosed

In 038e171c4/mythtv:

Do not probe V4L2 encoder if no such device found.

Fixes #13443

Note: See TracTickets for help on using tickets.