Project

General

Profile

Multiple HDHomeruns on a Synology DS213

Added by Chris N almost 12 years ago

Hi. Is there a way to set up multiple HDHomeruns on my Synology DS213? I have 2 HDHomeruns (4 tuners) and a couple of Hauppauge HVR-1950 tuner's attached to my Synology DS213. I am running Eric V's tree of TVHeadend on my NAS because this version supports timeshifting and I need a version that I can compile in order to get the analog tuners to work. I'd like to be able to compile the latest version of TVHeadend, but I read somewhere that I can't until Synology updates their toolchain. Currently, only 2 out of the 4 HDHomerun tuner's are working. The analog tuners are working fine. TVHeadend shows that 3 of the HDHomerun tuners are available but only adapter0 and adapter1 will find services. Adapter2 is unable to find any services and adapter3 is not showing up at all. I tried installing the HDHomerun SPK package, but got the same result. Any idea's?

DiskStation> ls -lR /dev/dvb
/dev/dvb:
total 16
drwxr-xr-x 2 root root 4096 Jan 11 12:09 adapter0
drwxr-xr-x 2 root root 4096 Jan 11 12:09 adapter1
drwxr-xr-x 2 root root 4096 Jan 11 12:09 adapter2
drwxr-xr-x 2 root root 4096 Jan 11 18:57 adapter3

/dev/dvb/adapter0:
total 0
crw-rw-rw- 1 root users 212, 4 Jan 11 12:09 demux0
crw-rw-rw- 1 root users 212, 5 Jan 11 12:09 dvr0
crw-rw-rw- 1 root users 212, 3 Jan 11 12:09 frontend0
crw-rw-rw- 1 root users 212, 7 Jan 11 12:09 net0

/dev/dvb/adapter1:
total 0
crw-rw-rw- 1 root users 212, 68 Jan 11 12:09 demux0
crw-rw-rw- 1 root users 212, 69 Jan 11 12:09 dvr0
crw-rw-rw- 1 root users 212, 67 Jan 11 12:09 frontend0
crw-rw-rw- 1 root users 212, 71 Jan 11 12:09 net0

/dev/dvb/adapter2:
total 0
crw-rw-rw- 1 root users 212, 132 Jan 11 12:09 demux0
crw-rw-rw- 1 root users 212, 133 Jan 11 12:09 dvr0
crw-rw-rw- 1 root users 212, 131 Jan 11 12:09 frontend0
crw-rw-rw- 1 root users 212, 135 Jan 11 12:09 net0

/dev/dvb/adapter3:
total 0
crw-rw-rw- 1 root users 212,  9 Jan 11 18:57 demux0
crw-rw-rw- 1 root users 212, 10 Jan 11 18:57 dvr0
crw-rw-rw- 1 root users 212, 11 Jan 11 18:57 frontend0   <--- Missing net0?

DiskStation> ls -l /dev/hdhome*
crw-rw-rw- 1 root root  10, 57 Jan 11 18:29 /dev/hdhomerun_control
crw-rw-rw- 1 root root 253,  0 Jan 11 18:29 /dev/hdhomerun_data0
crw-rw-rw- 1 root root 253,  1 Jan 11 18:29 /dev/hdhomerun_data1
-rw-rw-rw- 1 root root       0 Jan 12 02:52 /dev/hdhomerun_data2   <---Missing device# 253?
crw-rw-rw- 1 root root 253,  3 Jan 11 18:57 /dev/hdhomerun_data3

Startup Script:
# Load Core modules
#
insmod /opt/dvb_native/dvb-core.ko
insmod /opt/dvb_native/dvb_hdhomerun_core.ko
#
# Load BE & FE modules
#
insmod /opt/dvb_native/dvb_hdhomerun_fe.ko
insmod /opt/dvb_native/dvb_hdhomerun.ko
#
#lsmod to check if everything is running
#grep -i dvb /proc/devices
#
DYNAMIC_ID=$(grep hdhomerun_control /proc/misc | awk "{print $1}")
if [ "$DYNAMIC_ID" != "" ]; then
  echo "making node hdhomerun_control" $DYNAMIC_ID
  mknod /dev/hdhomerun_control c 10 $DYNAMIC_ID
else
  echo "Unable to detect hdhomerun_control inside /proc/misc." 
fi
# Set permissions
chmod 666 /dev/hdhomerun_control
chown root:root /dev/hdhomerun_control
#
# Clear userhdhomerun log
rm -f "/opt/dvbhdhomerun/dvbhdhomerun.log" 
#
# Run userhdhomerun with LD_PRELOAD
/opt/dvbhdhomerun/userhdhomerun/build/userhdhomerun -f -u root -g root -l "/opt/dvbhdhomerun/dvbhdhomerun.log" 
#
sleep 1
#
# Retrieve the major device number for DVB
# (normally it should be 212)
DYNAMIC_ID=$(grep DVB /proc/devices | awk "{print $1}")
if [ "$DYNAMIC_ID" != "" ]; then
        echo "Creating DVB device nodes to major device #$DYNAMIC_ID..." 
        # Create device nodes for DVB
        mkdir -p /dev/dvb/adapter0
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.frontend0/dev)
        mknod /dev/dvb/adapter0/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.demux0/dev)
        mknod /dev/dvb/adapter0/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.dvr0/dev)
        mknod /dev/dvb/adapter0/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2
        mkdir -p /dev/dvb/adapter1
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.frontend0/dev)
        mknod /dev/dvb/adapter1/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.demux0/dev)
        mknod /dev/dvb/adapter1/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.dvr0/dev)
        mknod /dev/dvb/adapter1/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2
        mkdir -p /dev/dvb/adapter2
        DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.frontend0/dev)
           mknod /dev/dvb/adapter2/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
        DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.demux0/dev)
           mknod /dev/dvb/adapter2/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
        DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.dvr0/dev)
           mknod /dev/dvb/adapter2/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2
        mkdir -p /dev/dvb/adapter3
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.frontend0/dev)
        mknod /dev/dvb/adapter3/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.demux0/dev)
        mknod /dev/dvb/adapter3/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
           DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.dvr0/dev)
        mknod /dev/dvb/adapter3/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2
        # Set permissions
           chmod 755 /dev/dvb/adapter*
        chmod 666 /dev/dvb/adapter*/*
           chown root:users /dev/dvb/adapter*/*
else
           echo "ERROR: Unable to detect DVB inside /proc/devices;    dvb-core.k$" 
           exit 10
fi


Replies (1)

RE: Multiple HDHomeruns on a Synology DS213 - Added by Chris N almost 12 years ago

Ok, I found that the problem is in the startup script.

DYNAMIC_ID=$(grep hdhomerun_control /proc/misc | awk "{print $1}")

creates a variable that contains " 57 hdhomerun_control", but it should only contain "57".

I added DYNAMIC_ID=${DYNAMIC_ID:0:4} after this line to correct it.

Also,

DYNAMIC_ID=$(grep DVB /proc/devices | awk "{print $1}")

creates a variable that contains "212 DVB", but it should only contain "212".

I also added DYNAMIC_ID=${DYNAMIC_ID:0:4} after this line to correct it.

Here's the working script:

#!/bin/sh

# Load Core modules
#
insmod /opt/dvb_native/dvb-core.ko
insmod /opt/dvb_native/dvb_hdhomerun_core.ko
#
# Load BE & FE modules
#
insmod /opt/dvb_native/dvb_hdhomerun_fe.ko
insmod /opt/dvb_native/dvb_hdhomerun.ko
#
#lsmod to check if everything is running
#grep -i dvb /proc/devices
#
DYNAMIC_ID=$(grep hdhomerun_control /proc/misc | awk "{print $1}")
DYNAMIC_ID=${DYNAMIC_ID:0:4}
if [ "$DYNAMIC_ID" != "" ]; then
  echo "making node hdhomerun_control" $DYNAMIC_ID
  mknod /dev/hdhomerun_control c 10 $DYNAMIC_ID
else
  echo "Unable to detect hdhomerun_control inside /proc/misc." 
fi
# Set permissions
chmod 666 /dev/hdhomerun_control
chown root:root /dev/hdhomerun_control
#
# Clear userhdhomerun log
rm -f "/opt/dvbhdhomerun/dvbhdhomerun.log" 
#
# Run userhdhomerun with LD_PRELOAD
/opt/dvbhdhomerun/userhdhomerun/build/userhdhomerun -f -u root -g root -l "/opt/dvbhdhomerun/dvbhdhomerun.log" 
#
sleep 1
#
# Retrieve the major device number for DVB
# (normally it should be 212)
DYNAMIC_ID=$(grep DVB /proc/devices | awk "{print $1}")
DYNAMIC_ID=${DYNAMIC_ID:0:4}
if [ "$DYNAMIC_ID" != "" ]; then
  echo "Creating DVB device nodes to major device $DYNAMIC_ID..." 

  # Create device nodes for DVB
  mkdir -p /dev/dvb/adapter0
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.frontend0/dev)
  mknod /dev/dvb/adapter0/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.demux0/dev)
  mknod /dev/dvb/adapter0/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb0.dvr0/dev)
  mknod /dev/dvb/adapter0/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2

  mkdir -p /dev/dvb/adapter1
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.frontend0/dev)
  mknod /dev/dvb/adapter1/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.demux0/dev)
  mknod /dev/dvb/adapter1/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb1.dvr0/dev)
  mknod /dev/dvb/adapter1/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2

  mkdir -p /dev/dvb/adapter2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.frontend0/dev)
  mknod /dev/dvb/adapter2/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.demux0/dev)
  mknod /dev/dvb/adapter2/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb2.dvr0/dev)
  mknod /dev/dvb/adapter2/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2

  mkdir -p /dev/dvb/adapter3
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.frontend0/dev)
  mknod /dev/dvb/adapter3/frontend0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.demux0/dev)
  mknod /dev/dvb/adapter3/demux0 c $DYNAMIC_ID $DYNAMIC_ID2
  DYNAMIC_ID2=$(cut -f2 -d':' /sys/class/dvb/dvb3.dvr0/dev)
  mknod /dev/dvb/adapter3/dvr0 c $DYNAMIC_ID $DYNAMIC_ID2

  DYNAMIC_ID=$(grep hdhomerun_data /proc/devices | awk "{print $1}")
  DYNAMIC_ID=${DYNAMIC_ID:0:4}
  if [ "$DYNAMIC_ID" != "" ]; then
    rm -rf /dev/hdhomerun_data*

    echo "Making node hdhomerun_data" $DYNAMIC_ID
    mknod /dev/hdhomerun_data0 c $DYNAMIC_ID 0
    mknod /dev/hdhomerun_data1 c $DYNAMIC_ID 1
    mknod /dev/hdhomerun_data2 c $DYNAMIC_ID 2
    mknod /dev/hdhomerun_data3 c $DYNAMIC_ID 3

    chmod 666 /dev/hdhomerun_data*
    chown root:root /dev/hdhomerun_data*
  else
    echo "Unable to detect hdhomerun_data inside /proc/devices." 
  fi

  # Set permissions
  chmod 755 /dev/dvb/adapter*
  chmod 666 /dev/dvb/adapter*/*
  chown root:root /dev/dvb/adapter*/*
else
  echo "ERROR: Unable to detect DVB inside /proc/devices; dvb-core.k$" 
  exit 10
fi

    (1-1/1)