LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2013, 06:17 PM   #1
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Rep: Reputation: 22
Any C++ Wizards?


I run MythTV on my HTPC, and my recording device is an R5000. For years I've had to patch MythTV and compile to work with the R5000, but as time's passed the patch developer is gone, the maker of the R5000 is gone, and I am left to try and keep this thing going with new versions of Myth.

I have adapted the patch to Myth0.27 and it compiles cleanly. But when I start the Myth backend (server) I get this:
Code:
2013-02-27 16:06:31.572980 C [13987/13987] thread_unknown mythcommandlineparser.cpp:2572 (ConfigureLogging) - mythbackend version: master [v0.27-pre2-534-g47a2da4-dirty] www.mythtv.org
2013-02-27 16:06:31.573033 C [13987/13987] thread_unknown mythcommandlineparser.cpp:2574 (ConfigureLogging) - Qt version: compile: 4.8.2, runtime: 4.8.2
2013-02-27 16:06:31.573041 N [13987/13987] thread_unknown mythcommandlineparser.cpp:2576 (ConfigureLogging) - Enabled verbose msgs:  general
2013-02-27 16:06:31.573217 N [13987/13987] thread_unknown logging.cpp:852 (logStart) - Setting Log Level to LOG_INFO
2013-02-27 16:06:31.574229 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Interrupt handler
2013-02-27 16:06:31.574240 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Terminated handler
2013-02-27 16:06:31.574251 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Segmentation fault handler
2013-02-27 16:06:31.574260 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Aborted handler
2013-02-27 16:06:31.574268 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Bus error handler
2013-02-27 16:06:31.574278 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Floating point exception handler
2013-02-27 16:06:31.574286 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Illegal instruction handler
2013-02-27 16:06:31.574297 I [13987/13987] thread_unknown signalhandling.cpp:194 (SetHandlerPrivate) - Setup Real-time signal 0 handler
2013-02-27 16:06:31.574368 N [13987/13987] thread_unknown mythdirs.cpp:55 (InitializeMythDirs) - Using runtime prefix = /usr/local
2013-02-27 16:06:31.574384 N [13987/13987] thread_unknown mythdirs.cpp:68 (InitializeMythDirs) - Using configuration directory = /home/mythtv/.mythtv
2013-02-27 16:06:31.574525 I [13987/13987] CoreContext mythcorecontext.cpp:238 (Init) - Assumed character encoding: en_US.UTF-8
2013-02-27 16:06:31.574729 I [13987/13988] Logger logging.cpp:307 (run) - Added logging to the console
2013-02-27 16:06:31.575224 N [13987/13987] CoreContext mythcontext.cpp:486 (LoadDatabaseSettings) - Empty LocalHostName.
2013-02-27 16:06:31.575239 I [13987/13987] CoreContext mythcontext.cpp:494 (LoadDatabaseSettings) - Using localhost value of cygnus
2013-02-27 16:06:31.588405 N [13987/13987] CoreContext mythcorecontext.cpp:1291 (InitLocale) - Setting QT default locale to EN_US
2013-02-27 16:06:31.588517 I [13987/13987] CoreContext mythcorecontext.cpp:1324 (SaveLocaleDefaults) - Current locale EN_US
2013-02-27 16:06:31.588570 N [13987/13987] CoreContext mythlocale.cpp:121 (LoadDefaultsFromXML) - Reading locale defaults from /usr/local/share/mythtv//locales/en_us.xml
2013-02-27 16:06:31.592622 I [13987/13987] CoreContext schemawizard.cpp:118 (Compare) - Current MythTV Schema Version (DBSchemaVer): 1310
2013-02-27 16:06:31.592930 I [13987/13987] CoreContext mythtranslation.cpp:65 (load) - Loading en_us translation for module mythfrontend
2013-02-27 16:06:31.593241 N [13987/13987] CoreContext main_helpers.cpp:572 (run_backend) - MythBackend: Starting up as the master server.
2013-02-27 16:06:31.799122 I [13987/13988] Logger logging.cpp:488 (launchLogServer) - Starting mythlogserver
2013-02-27 16:06:31.799292 I [13987/13995] SystemManager system-unix.cpp:263 (run) - Starting process manager
2013-02-27 16:06:31.799550 I [13987/13999] SystemSignalManager system-unix.cpp:490 (run) - Starting process signal handler
2013-02-27 16:06:31.799587 I [13987/14001] SystemIOHandlerW system-unix.cpp:90 (run) - Starting IO manager (write)
2013-02-27 16:06:31.801659 I [13987/14000] SystemIOHandlerR system-unix.cpp:90 (run) - Starting IO manager (read)
2013-02-27 16:06:31.909140 I [13987/13987] CoreContext r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: R5000 initialization failed at stage 1:
	Expected 1 bytes, but got -16 bytes

2013-02-27 16:06:31.909379 I [13987/13987] CoreContext r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: R5000 failed to locate any R5000 devices.  Are you sure you have permissions set properly?

2013-02-27 16:06:31.953152 I [13987/13987] CoreContext r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: R5000 was not initialized before r5000_open().  Please call r5000_init() first

2013-02-27 16:06:31.953164 E [13987/13987] CoreContext recorders/channelbase.cpp:1235 (CreateChannel) - ChannelBase: CreateChannel() Error: Failed to open device 100563E
2013-02-27 16:06:31.954221 E [13987/13987] CoreContext main_helpers.cpp:198 (setupTVs) - Problem with capture cardsCard 5failed init
2013-02-27 16:06:31.999891 I [13987/13988] Logger logging.cpp:448 (initialTimeout) - Added logging to mythlogserver at TCP:35327
2013-02-27 16:06:32.025931 I [13987/13987] CoreContext programinfo.cpp:2114 (CheckProgramIDAuthorities) - Found 1 distinct programid authorities
2013-02-27 16:06:32.027977 I [13987/14025] Scheduler mythdbcon.cpp:436 (getStaticCon) - New static DB connectionSchedCon
2013-02-27 16:06:32.028785 I [13987/13987] CoreContext serverpool.cpp:395 (listen) - Listening on TCP 127.0.0.1:6544
2013-02-27 16:06:32.029821 N [13987/13987] CoreContext mediaserver.cpp:169 (Init) - MediaServer:: Loopback address specified - 127.0.0.1. Disabling UPnP
2013-02-27 16:06:32.029826 I [13987/13987] CoreContext main_helpers.cpp:642 (run_backend) - Main::Registering HttpStatus Extension
2013-02-27 16:06:32.030670 W [13987/13987] CoreContext mainserver.cpp:262 (MainServer) - Unable to find IPv6 address to bind
2013-02-27 16:06:32.030716 I [13987/13987] CoreContext serverpool.cpp:395 (listen) - Listening on TCP 127.0.0.1:6543
2013-02-27 16:06:32.032032 N [13987/13987] CoreContext autoexpire.cpp:264 (CalcParams) - AutoExpire: CalcParams(): Max required Free Space: 1.0 GB w/freq: 15 min
2013-02-27 16:06:35.033545 I [13987/14025] Scheduler scheduler.cpp:2088 (HandleReschedule) - Reschedule requested for MATCH 0 0 0 - SchedulerInit
I am not a coding genius, but it looks like the r5000 is not being init-ed before opened. I just don't know what to do about it. It's definitely not a permissions problem.

The error calles out the r5000device.cpp file, which is here.

Can anyone see what might be wrong here?

Last edited by Quantumstate; 02-27-2013 at 06:19 PM.
 
Old 03-01-2013, 03:21 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,804

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
based on the error message probably you missed a call: R5000 was not initialized before r5000_open(). Please call r5000_init() first
the source file does not help, r5000device.cpp:46 is a simple logger function
 
Old 03-01-2013, 10:17 AM   #3
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Thanks, but I don't know how to do that. How would I locate the right file, and what command would I add, and where?

Other r5000 files in that dir (libs/libmythtv) are:
Code:
-rw-r--r--  1 root staff 22120 Feb 18 17:28 r5000.c
-rw-r--r--  1 root staff  1856 Feb 18 17:28 r5000.h
-rw-r--r--  1 root staff  3840 Feb 18 17:28 r5000init.h
-rw-r--r--  1 root staff  3779 Feb 18 17:28 r5000_internal.h
-rw-r--r--  1 root staff  7031 Feb 18 17:28 r5k_directv_buttons.c
-rw-r--r--  1 root staff 12126 Feb 18 17:28 r5k_dish6000_buttons.c
-rw-r--r--  1 root staff  3825 Feb 18 17:28 r5k_dsr_buttons.c
-rw-r--r--  1 root staff  7560 Feb 18 17:28 r5k_misc.c
-rw-r--r--  1 root staff 10389 Feb 18 17:28 r5k_pes.c
-rw-r--r--  1 root staff 14340 Feb 18 17:28 r5k_sat.c
-rw-r--r--  1 root staff 14989 Feb 18 17:28 r5k_vip_buttons.c
-rw-r--r--  1 root staff  7509 Feb 18 17:28 r5k_vip.c
In libs/libmythtv/r5000:
Code:
-rw-r--r-- 1 root staff 10605 Feb 18 17:28 r5000/libusb_augment.c
-rw-r--r-- 1 root staff  1663 Feb 18 17:28 r5000/libusb_augment.h
-rw-r--r-- 1 root staff 22120 Feb 18 17:28 r5000/r5000.c
-rw-r--r-- 1 root staff  1856 Feb 18 17:28 r5000/r5000.h
-rw-r--r-- 1 root staff  3840 Feb 18 17:28 r5000/r5000init.h
-rw-r--r-- 1 root staff  3779 Feb 18 17:28 r5000/r5000_internal.h
-rw-r--r-- 1 root staff  7031 Feb 18 17:28 r5000/r5k_directv_buttons.c
-rw-r--r-- 1 root staff 12126 Feb 18 17:28 r5000/r5k_dish6000_buttons.c
-rw-r--r-- 1 root staff  3825 Feb 18 17:28 r5000/r5k_dsr_buttons.c
-rw-r--r-- 1 root staff  7560 Feb 18 17:28 r5000/r5k_misc.c
-rw-r--r-- 1 root staff 10389 Feb 18 17:28 r5000/r5k_pes.c
-rw-r--r-- 1 root staff 14340 Feb 18 17:28 r5000/r5k_sat.c
-rw-r--r-- 1 root staff 14989 Feb 18 17:28 r5000/r5k_vip_buttons.c
-rw-r--r-- 1 root staff  7509 Feb 18 17:28 r5000/r5k_vip.c

My patch for the configure file is:
Code:
diff -crBN ../../mythtv/mythtv/configure ./configure
*** ../../mythtv/mythtv/configure	2013-02-16 10:36:54.416158056 -0800
--- ./configure	2013-02-16 10:52:50.018567158 -0800
***************
*** 119,124 ****
--- 119,125 ----
    --disable-ivtv           disable ivtv support (PVR-x50) req. v4l2 support
    --disable-hdpvr          disable HD-PVR support
    --disable-dvb            disable DVB support
+   --disable-r5000          disable support for R5000 USB STBs
    --dvb-path=HDRLOC        location of directory containing
                             'linux/dvb/frontend.h', not the
                             directory with frontend.h [$dvb_path_default]
***************
*** 1676,1681 ****
--- 1677,1683 ----
      ceton
      hdpvr
      ivtv
+     r5000
      asi
      joystick_menu
      libcec
***************
*** 2284,2289 ****
--- 2286,2292 ----
  audio_oss_deps_any="soundcard_h sys_soundcard_h"
  dvb_deps="backend"
  firewire_deps="backend"
+ r5000_deps="backend"
  ivtv_deps="backend v4l2"
  hdpvr_deps="backend v4l2"
  hdhomerun_deps="backend"
***************
*** 2501,2506 ****
--- 2504,2510 ----
  enable ceton
  enable hdpvr
  enable ivtv
+ enable r5000
  enable asi
  enable lamemp3
  enable libass
***************
*** 5702,5707 ****
--- 5706,5712 ----
    echo "DVB-S2 support            ${fe_can_2g_modulation-no}"
    echo "HDHomeRun support         ${hdhomerun-no}"
    echo "Ceton support             ${ceton-no}"
+   echo "R5000 support             ${r5000-no}"
    echo "ASI support               ${asi-no}"
  fi
My patch for the files in libs/libmythtv/recorders:
Code:
diff -crBN ../../mythtv/mythtv/libs/libmythtv/recorders/channelbase.cpp ./libs/libmythtv/recorders/channelbase.cpp
*** ../../mythtv/mythtv/libs/libmythtv/recorders/channelbase.cpp	2013-02-16 10:36:55.184163115 -0800
--- ./libs/libmythtv/recorders/channelbase.cpp	2013-02-16 10:52:50.014567132 -0800
***************
*** 26,31 ****
--- 26,32 ----
  #include "firewirechannel.h"
  #include "mythcorecontext.h"
  #include "cetonchannel.h"
+ #include "r5000channel.h"
  #include "dummychannel.h"
  #include "tvremoteutil.h"
  #include "channelbase.h"
***************
*** 1195,1200 ****
--- 1196,1210 ----
          channel = new CetonChannel(tvrec, genOpt.videodev);
  #endif
      }
+     else if (genOpt.cardtype == "R5000")
+     {
+ #ifdef USING_R5000
+         channel = new R5000Channel(tvrec, genOpt.videodev, fwOpt.model, dvbOpt.dvb_on_demand);
+         dynamic_cast<R5000Channel*>(channel)->SetSlowTuning(
+             dvbOpt.dvb_tuning_delay);
+ #endif
+     }
+ 
      else if (CardUtil::IsV4L(genOpt.cardtype))
      {
  #ifdef USING_V4L2
diff -crBN ../../mythtv/mythtv/libs/libmythtv/recorders/recorderbase.cpp ./libs/libmythtv/recorders/recorderbase.cpp
*** ../../mythtv/mythtv/libs/libmythtv/recorders/recorderbase.cpp	2013-02-16 10:36:55.188163142 -0800
--- ./libs/libmythtv/recorders/recorderbase.cpp	2013-02-16 10:52:50.018567158 -0800
***************
*** 9,20 ****
--- 9,22 ----
  #include "firewirechannel.h"
  #include "importrecorder.h"
  #include "cetonrecorder.h"
+ #include "r5000recorder.h"
  #include "dummychannel.h"
  #include "hdhrrecorder.h"
  #include "iptvrecorder.h"
  #include "mpegrecorder.h"
  #include "recorderbase.h"
  #include "cetonchannel.h"
+ #include "r5000channel.h"
  #include "asirecorder.h"
  #include "dvbrecorder.h"
  #include "hdhrchannel.h"
***************
*** 649,654 ****
--- 651,663 ----
          recorder = new ImportRecorder(tvrec);
  #endif
      }
+     else if (genOpt.cardtype == "R5000")
+     {
+ #ifdef USING_R5000
+         recorder = new R5000Recorder(
+             tvrec, dynamic_cast<R5000Channel*>(channel));
+ #endif // USING_R5000
+     }
      else if (CardUtil::IsV4L(genOpt.cardtype))
      {
  #ifdef USING_V4L2
diff -crBN ../../mythtv/mythtv/libs/libmythtv/recorders/signalmonitor.cpp ./libs/libmythtv/recorders/signalmonitor.cpp
*** ../../mythtv/mythtv/libs/libmythtv/recorders/signalmonitor.cpp	2013-02-16 10:36:55.188163142 -0800
--- ./libs/libmythtv/recorders/signalmonitor.cpp	2013-02-16 10:52:50.018567158 -0800
***************
*** 54,59 ****
--- 54,64 ----
  #   include "cetonchannel.h"
  #endif
  
+ #ifdef USING_R5000
+ #   include "r5000signalmonitor.h"
+ #   include "r5000channel.h"
+ #endif
+ 
  #undef DBG_SM
  #define DBG_SM(FUNC, MSG) LOG(VB_CHANNEL, LOG_DEBUG, \
      QString("SM[%1](%2)::%3: %4").arg(capturecardnum) \

I find r5000_open() in libs/libmythtv/r5000/r5000.c, but it only has the error message:
"R5000 was not initialized before r5000_open(). Please call r5000_init() first\n"

I find r5000_open( in three places:
libs/libmythtv/r5000device.cpp starting line 289
Code:
bool R5000Device::OpenPort(void)
{
    LOG(VB_RECORD, LOG_DEBUG, LOC + "Starting Port Handler Thread");
    QMutexLocker mlocker(&m_lock);
    LOG(VB_RECORD, LOG_DEBUG, LOC + "Starting Port Handler Thread -- locked");
    if (usbdev)
    {
        m_open_port_cnt++;
        return true;
    }

    if (m_serial.length())
    {
      LOG(VB_RECORD, LOG_DEBUG, LOC + QString("Opening R5000 device type %1 with serial#: "+ m_serial).arg(m_type));
      usbdev = r5000_open((r5ktype_t)m_type, r5000_device_tspacket_handler, this, m_serial.toAscii().constData());
    }
    else
    {
      LOG(VB_RECORD, LOG_DEBUG, LOC + "Opening R5000 device with unknown serial#");
      usbdev = r5000_open((r5ktype_t)m_type, r5000_device_tspacket_handler, this, NULL);
    }
    if (! usbdev)
    {
        LOG(VB_GENERAL, LOG_DEBUG, LOC + "Failed to open R5000 device");
        return false;
    }

    LOG(VB_RECORD, LOG_DEBUG, LOC + "Starting port handler thread");
    m_priv->run_port_handler = true;
    pthread_create(&m_priv->port_handler_thread, NULL,
                   r5000_device_port_handler_thunk, this);

    LOG(VB_RECORD, LOG_DEBUG, LOC + "Waiting for port handler thread to start");
    while (!m_priv->is_port_handler_running)
    {
        m_lock.unlock();
        usleep(5000);
        m_lock.lock();
    }

    LOG(VB_RECORD, LOG_DEBUG, LOC + "Port handler thread started");

    m_open_port_cnt++;

    return true;
}
In libs/libmythtv/r5000/r5000.c starting line 341:
Code:
r5kdev_t *r5000_open(r5ktype_t type,
                     unsigned int (*cb)(unsigned char *buffer, int len, void *callback_data),
                     void *cb_data,
                     const char *serial)
{
  r5kdev_t *r5kdev, r5kd;
  int count = 0;

  r5000_log(0, "r5000_open(%d, NULL, %p, %s)", type, cb_data, serial);
  memset(&r5kd, 0, sizeof(r5kdev_t));
And in libs/libmythtv/r5000/r5000.h starting line 40:
Code:
extern int r5000_init(void (*_msgcb)(char *str));
extern r5kdev_t *r5000_open(r5ktype_t type, unsigned int (*cb)(unsigned char *buffer, int len, void *callback_data), void *cb_data, const char *serial);
extern int r5000_close(r5kdev_t *r5kdev);
I find r5000_init( in the same three files, starting with libs/libmyth/r5000device.cpp on line 81 then 408:
Code:
R5000Device::R5000Device(int type, QString serial) :
    m_type(type),
    m_serial(serial),
    m_last_channel(""),      m_last_crc(0),
    m_buffer_cleared(true), m_open_port_cnt(0),
    m_lock(),          m_priv(new R5kPriv())
{
    QMutexLocker locker(&s_static_lock);
    usbdev = NULL;
    if (! r5k_init)
      r5k_init = r5000_init(r5000_msg);
}

...

QStringList R5000Device::GetSTBList(void)
{
    QStringList STBList;
    int i;
    r5kenum_t r5k_stbs;
    if (! r5k_init)
    {
        r5k_init = r5000_init(r5000_msg);
        if (! r5k_init)
            return STBList;
    }
    if (! r5000_find_stbs(&r5k_stbs))
        LOG(VB_GENERAL, LOG_DEBUG, LOC + "Locating R5000 devices failed."
                                    "  This may be a permission problem");

    for (i = 0; i < r5k_stbs.count; i++)
        STBList.append((char *)r5k_stbs.serial[i]);
    return STBList;
}

Then libs/libmythth/r5000/r5000.c on line 301 (The error is here):
Code:
/* r5000_init must be called from a thread-safe context */
int r5000_init(void (*_msgcb)(char *str))
{
  int bus_count, dev_count;
  r5kdev_t r5kd;
  int count = 0;

  r5000_log(0, "r5000_init()");

  msgcb = _msgcb;

  if(r5000_usb_init)
    return 1;
  usb_init();
  bus_count = usb_find_busses();
  dev_count = usb_find_devices();
  if(bus_count == 0 || dev_count ==0) {
    r5000_print("R5000 failed to locate any USB devices.  Are you sure you have permissions set properly?\n");
    return 0;
  }

And then libs/mibmythtv/r5000/r5000.h line 40:
Code:
extern int r5000_init(void (*_msgcb)(char *str));
extern r5kdev_t *r5000_open(r5ktype_t type, unsigned int (*cb)(unsigned char *buffer, int len, void *callback_data), void *cb_data, const char *serial);
extern int r5000_close(r5kdev_t *r5kdev);
extern int r5000_start_stream(r5kdev_t *r5kdev);

The complete r5000.c is here: https://paste.debian.net/239152/
Alan Nisota quit the project a couple years ago.

I would be grateful for help, as I have no TV now.

Last edited by Quantumstate; 03-01-2013 at 02:38 PM.
 
1 members found this post helpful.
Old 03-01-2013, 03:06 PM   #4
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Well I've done a diff between r5000.c from an old Myth 0.24 that worked, and the one I have now for 0.27, and they are binary equal so that can't be where the problem is. Same with r5000.h

I did a diff between the old and new r5000device.cpp's, and the only differences were changes to logging.

I don't know what to do now.
 
Old 03-02-2013, 10:14 AM   #5
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
[QUOTE=Quantumstate;4901209]
Code:
2013-02-27 16:06:31.909140 I [13987/13987] CoreContext r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: R5000 initialization failed at stage 1:
	Expected 1 bytes, but got -16 bytes
The "-16 bytes" is probably 'usb_bulk_read' (I couldn't find the source to this function, so this is a bit of a guess) returning -EBUSY (Device or resource busy). Is it possible that the device is already in use by something else (another part of mythtv possibly?).

This error appears to come from here:

http://code.google.com/p/r5000-for-l...000.c?r=17#224

or here:

http://code.google.com/p/r5000-for-l...000.c?r=17#248

I would add something to these 'r5000_print' lines to figure out which of these lines the error message is coming from.

This reminds me of my thread here:

http://www.linuxquestions.org/questi...r-22-a-906111/

Sadly, I never was able to get it working.

Lyle.
 
Old 03-03-2013, 05:49 PM   #6
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Interesting, thanks Lyle.

No other device knows about the r5000, except the backend which is starting in this case. Maybe it's interfering with itself somehow?

On the 'r5000_print' lines I made the first one r5000-1 and the second -2. Recompiled and tried the backend, and sure enough it is -1 that's failing. Your:
http://code.google.com/p/r5000-for-l...000.c?r=17#224

On your Hauppauge, have you tried it recently with a newer kernel? (I assume the driver is in the kernel)
 
Old 03-03-2013, 06:41 PM   #7
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Ho-ly cow. After I finished the test you suggested, I cleared all the directories and moved the MySQL libs to wind everything back to Myth 0.24 (so I could at least watch TV), but to my horror I found that 0.24 was now giving the same error as 0.27!

Majorly clue.

You said the device might be busy. Apparently it's errored. So I put everything back to 0.27, powered down everything, restarted and now 0.27 works!

I have a feeling though, if -anything- goes wrong the r5000 interface card may error again. At least now I have a sense that I can fix it. See it's an addon card inside the Dish Network satellite box, which taps into the guts to suck out the unencrypted transport stream. The r5000 gets its power from USB, so powering down the Dish box is not enough; must unplug the r5000 USB as well or power down the computer. When I did a cold shutdown, everything came up, but when I restart the backend it fails. Apparently the backend is not initializing the card like it should.

No idea what to do about it though.
 
Old 03-04-2013, 01:08 AM   #8
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
I've been following this thread, but I'm a litle unclear as to what you're saying ultimately, at this point. In this:

Quote:
Originally Posted by Quantumstate View Post
...I put everything back to 0.27, powered down everything, restarted and now 0.27 works!...
you seem to say that everything worked. But then in the the below, to me, it's as if you're going on to say that it really didn't work:

Quote:
Originally Posted by Quantumstate View Post
...I have a feeling though, if -anything- goes wrong the r5000 interface card may error again. At least now I have a sense that I can fix it. See it's an addon card inside the Dish Network satellite box, which taps into the guts to suck out the unencrypted transport stream. The r5000 gets its power from USB, so powering down the Dish box is not enough; must unplug the r5000 USB as well or power down the computer. When I did a cold shutdown, everything came up, but when I restart the backend it fails. Apparently the backend is not initializing the card like it should...
OR, are you saying that a cold shutdown of everything works, but some type of "warm re-start" of the "backend" doesn't init the card? If so, how exactly do you do that "warm re-start" of the "backend"?

If things don't fully work on a cold start, then please provide more details.

Just some general observations:

1) It sounds as if the r5000 interface card could be considered a so called "embedded" application.
2) Often that's a specialized use of what is virtually a general purpose computer, in some sense.
3) If 1 & 2 above are true, it may be that:
a) the card should be getting a so called "init" pulse from a buss/backplane, if any, into which it may be plugged, but it is not actually getting that pulse, or...
b) the card might not be responding correctly to the "init pulse".
If you are actually saying that if you "cold start" everything, it really does work, then if you are not satisfied with that, you might be looking at delving into the structure of the buss/backplane, if any, to see if there is an "init" pulse the card should be re-acting to, and/or looking at the hardware or firmware on the card, if you are in a position to do either of those. Sometimes the hardware should react to an "init" pulse, sometimes the firmware is also involved.
 
Old 03-04-2013, 09:44 AM   #9
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
I'm saying that it seemed to work, as I am no longer getting the failure to recognize the r5000 when I start the backend. This happened because I've learned to do a cold start of the hardware. Before, when I simply restarted the Myth backend and the r5000 was errored, it would never recover. It appears that the backend is not sending a true init to the r5000.

I can live with that. But now I find that it is not actually recording. The backend is going through all the motions, and seems to think it's recording shows, but the mpg files end up with zero bytes. Normally they'd be 1 or 2GB files. The backend doesn't flag any errors in the log file. What I see is this:
Code:
]Scheduler autoexpire.cpp:264 (CalcParams) - AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 14 min
Scheduler scheduler.cpp:2658 (HandleRecordingStatusChange) - Started recording: "Tech Toys 360": channel 2364 on cardid 5, sourceid 2
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
PreviewGenerator previewgenerator.cpp:266 (Run) - Preview: Encountered problems running '/usr/local/bin/mythpreviewgen' (128)
Commflag_9273 jobqueue.cpp:2281 (DoFlagCommercialsThread) - JobQueue: Commercial Detection Starting for "Tech Toys 360" recorded from channel 2364 at 2013-03-04T12:30:00Z
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
Commflag_9273 previewgenerator.cpp:266 (Run) - Preview: Encountered problems running '/usr/local/bin/mythpreviewgen' (128)

TVRecEvent tv_rec.cpp:1044 (HandleStateChange) - TVRec[5]: Changing from RecordingOnly to None
thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (6) Reap failed at b3e98000: Success
TVRecEvent recordinginfo.cpp:1068 (FinishedRecording) - Finished recording Tech Toys 360 "Pagani Huayra; Looxcie Personal Video Camera": channel 2364
CoreContext scheduler.cpp:698 (UpdateRecStatus) - Updating status for "Tech Toys 360":"Pagani Huayra; Looxcie Personal Video Camera" on cardid 5 (Recording => Recorded)
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for CHECK -3 2275 0 UpdateRecStatus2 | Tech Toys 360 | Pagani Huayra; Looxcie Personal Video Camera | Pagani Huayra sports car; Looxcie personal video camera. | EP014731110010
Scheduler scheduler.cpp:2242 (HandleReschedule) - Reschedule interrupted, will retry
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for PLACE Interrupted
Scheduler scheduler.cpp:2251 (HandleReschedule) - Scheduled 697 items in 0.2 = 0.00 match + 0.00 check + 0.16 place
It's no surprise that preview generation and commercial flagging failed, as the file is empty, but the weird thing is that "thread_unknown r5000device.cpp:46" message. I don't really understand that.

It seems the backend is waiting dutifully while the r5000 is supposed to be sending video. I know that it's changing the channel of the Dish box, as I watched it do that last night, so permissions are good and it's able to control. Only thing is the video is not squirting out for some reason. It definitely worked yesterday running Myth version 0.24.

Could this again indicate that the backend is not doing a proper init of the r5000?

There is a way to make r5ktest get video samples. I'll try to figure that out.

Last edited by Quantumstate; 03-04-2013 at 09:49 AM.
 
Old 03-04-2013, 10:14 AM   #10
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Here are a couple more record attempts:
Code:
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for MATCH 2304 0 0 - SaveRule How It's Made
Scheduler scheduler.cpp:2251 (HandleReschedule) - Scheduled 703 items in 0.2 = 0.01 match + 0.00 check + 0.18 place
TVRecEvent tv_rec.cpp:1044 (HandleStateChange) - TVRec[5]: Changing from None to RecordingOnly
TVRecEvent tv_rec.cpp:3593 (TuningCheckForHWChange) - TVRec[5]: HW Tuner: 5->5
CoreContext scheduler.cpp:698 (UpdateRecStatus) - Updating status for "How It's Made" on cardid 5 (Will Record => Recording)
TVRecEvent tv_rec.cpp:4087 (TuningNewRecorder) - TVRec[5]: rec->GetPathname(): '/home/bill/TV/Recorded/2193_20130304055800.mpg'
Scheduler autoexpire.cpp:264 (CalcParams) - AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 14 min
thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0)Lost sync @ 00000000

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0) Found sync @ 000000ac

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Continuity (0x1222) 9 != 0 @00000458

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0)Lost sync @ 000005d0

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0) Found sync @ 00000600

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Continuity (0x1522) 4 != 0 @00000b24

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Adding 1522: 1b @ 0026e9ec

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Adding 1523: 81 @ 002ba13c

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Building PMT

Metadata_9268 jobqueue.cpp:2156 (DoMetadataLookupThread) - JobQueue: Metadata Lookup Starting for "How It's Made" recorded from channel 2193 at 2013-03-04T05:58:00Z
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for CHECK -2 2304 0 UpdateRecStatus2 | How It's Made |  | Clay pipes; drinking fountains; orange liqueur; compound bows. | EP004154020536
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for MATCH 2305 0 0 - SaveRule How It's Made
Scheduler scheduler.cpp:2251 (HandleReschedule) - Scheduled 703 items in 0.2 = 0.02 match + 0.00 check + 0.21 place
Commflag_9269 jobqueue.cpp:2281 (DoFlagCommercialsThread) - JobQueue: Commercial Detection Starting for "How It's Made" recorded from channel 2193 at 2013-03-04T05:58:00Z
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
Commflag_9269 previewgenerator.cpp:266 (Run) - Preview: Encountered problems running '/usr/local/bin/mythpreviewgen' (128)
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for PLACE PrepareToRecord
Scheduler scheduler.cpp:2251 (HandleReschedule) - Scheduled 703 items in 0.2 = 0.00 match + 0.00 check + 0.17 place
TVRecEvent tv_rec.cpp:1567 (HandlePendingRecordings) - TVRec[5]: ASK_RECORDING 5 26 0 0
TVRecEvent tv_rec.cpp:1044 (HandleStateChange) - TVRec[5]: Changing from RecordingOnly to None
thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (34) Reap failed at 21e88000: Success

TVRecEvent recordinginfo.cpp:1068 (FinishedRecording) - Finished recording How It's Made: channel 2193
CoreContext scheduler.cpp:698 (UpdateRecStatus) - Updating status for "How It's Made" on cardid 5 (Recording => Recorded)
Code:
TVRecEvent tv_rec.cpp:1044 (HandleStateChange) - TVRec[5]: Changing from None to RecordingOnly
TVRecEvent tv_rec.cpp:3593 (TuningCheckForHWChange) - TVRec[5]: HW Tuner: 5->5
CoreContext scheduler.cpp:698 (UpdateRecStatus) - Updating status for "Wild West Alaska":"Surf and Turf Wedding" on cardid 5 (Will Record => Recording)
TVRecEvent tv_rec.cpp:4087 (TuningNewRecorder) - TVRec[5]: rec->GetPathname(): '/home/bill/TV/Recorded/2184_20130304060000.mpg'
Scheduler autoexpire.cpp:264 (CalcParams) - AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 14 min
thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0)Lost sync @ 21e88000

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0) Found sync @ 21e88068

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Continuity (0x1522) 13 != 4 @21e881e0

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0)Lost sync @ 21e887c0

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: (0) Found sync @ 21e8888e

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Continuity (0x1422) 12 != 0 @21e88a06

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Continuity (0x1423) 6 != 0 @21e8aa56

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Adding 1422: 1b @ 21fedc32

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Adding 1423: 81 @ 22035226

thread_unknown r5000device.cpp:46 (r5000_msg) - R5kDev: R5kLib: Building PMT

Metadata_9270 jobqueue.cpp:2156 (DoMetadataLookupThread) - JobQueue: Metadata Lookup Starting for "Wild West Alaska":"Surf and Turf Wedding" recorded from channel 2184 at 2013-03-04T06:00:00Z
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
Commflag_9271 jobqueue.cpp:2281 (DoFlagCommercialsThread) - JobQueue: Commercial Detection Starting for "Wild West Alaska":"Surf and Turf Wedding" recorded from channel 2184 at 2013-03-04T06:00:00Z
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 0)
ProcessRequest mainserver.cpp:1429 (HandleAnnounce) - MainServer::ANN Monitor
ProcessRequest mainserver.cpp:1431 (HandleAnnounce) - adding: cygnus as a client (events: 1)
Commflag_9271 previewgenerator.cpp:266 (Run) - Preview: Encountered problems running '/usr/local/bin/mythpreviewgen' (128)
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for CHECK -3 2304 0 UpdateRecStatus2 | How It's Made |  | Clay pipes; drinking fountains; orange liqueur; compound bows. | EP004154020536
Scheduler scheduler.cpp:2138 (HandleReschedule) - Reschedule requested for CHECK -2 2297 735290 UpdateRecStatus2 | Wild West Alaska | Surf and Turf Wedding | A backwoodsman seeks the ultimate survival gun; Jim and the crew help two sisters throw a memorable double wedding. | EP016438100008
Scheduler scheduler.cpp:2251 (HandleReschedule) - Scheduled 702 items in 0.2 = 0.00 match + 0.00 check + 0.18 place

Last edited by Quantumstate; 03-04-2013 at 10:17 AM.
 
Old 03-04-2013, 01:15 PM   #11
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Well r5ktest got a zero-sized file as well when I tried to pull video.

I've found that rather than doing a cold shutdown, restarting udev makes the r5000 available again. I didn't try a udev restart then r5ktest, as I am quite sick of having spent days on this and having no TV for over a week. For now I'm back on Myth 0.24 and it seems to be recording.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'O Great Computer Wizards... BuckNekkid Linux - Software 4 07-16-2012 09:59 AM
Hello Wizards RomanSB LinuxQuestions.org Member Intro 2 02-13-2009 09:26 AM
Greetings to all the Linux fans and wizards! mrbill56 LinuxQuestions.org Member Intro 1 11-25-2008 09:28 PM
Wizards in GUI OtisLinux Linux - Software 3 02-27-2004 10:17 AM
where are the server wizards etc ? shaneblyth Linux - Networking 1 09-24-2003 12:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration