LoginSignup
13
27

More than 3 years have passed since last update.

RaspberryPi 3B+ + PX-Q3U4 + EPGStation

Last updated at Posted at 2019-08-18

環境

  • ハード
    • Raspberry Pi 3B+
    • PX-Q3U4
    • ICカードリーダ と B-CASカード
  • ソフト
    • Raspbian Buster Lite July 2019

memo

RasPiの初期設定とかはざっくり省略
とりあえず、動くところまで確認出来たから一旦公開します。

初期設定

$ sudo timedatectl set-timezone Asia/Tokyo

ドライバ導入

必要なパッケージの導入

$ sudo apt install raspberrypi-kernel-headers dkms git pcscd libpcsclite-dev libccid pcsc-tools

ドライバのインストール

$ git clone https://github.com/nns779/px4_drv.git
$ cd px4_drv
$ cd fwtool
$ make
$ wget http://plex-net.co.jp/plex/pxw3u4/pxw3u4_BDA_ver1x64.zip -O pxw3u4_BDA_ver1x64.zip
$ unzip -oj pxw3u4_BDA_ver1x64.zip pxw3u4_BDA_ver1x64/PXW3U4.sys
$ ./fwtool PXW3U4.sys it930x-firmware.bin
$ sudo mkdir -p /lib/firmware
$ sudo cp it930x-firmware.bin /lib/firmware/
$ cd ../
$ sudo cp -a ./ /usr/src/px4_drv-0.2.1
$ sudo dkms add px4_drv/0.2.1
$ sudo dkms install px4_drv/0.2.1

設定ファイルの書き換え

/etc/modules.
# ファイル名は  /etc/modules 
# 追記
px4_drv 
/boot/cmdline.txt
# 追記
coherent_pool=4M
dwc_otg.host_rx_fifo_size=2048
/etc/modprobe.d/px4_drv.conf
options px4_drv xfer_packets=51 urb_max_packets=816 max_urbs=6 

再起動後、次のコマンドでドライバが読み込まれていることを確認

$  lsmod | grep px4
px4_drv                98304  0

PX-Q3U4を接続すると、/devにpx4video0~7が生えてくることを確認

$ ls /dev/ | grep px4
px4video0
px4video1
px4video2
px4video3
px4video4
px4video5
px4video6
px4video7

録画環境

必要なモジュールのインストール

$ sudo apt install cmake autoconf automake ffmpeg

B25ライブラリ

$ git clone https://github.com/stz2012/libarib25.git
$ cd libarib25
$ cmake .
$ make -j 4
$ sudo make install

recpt1の構築

$ git clone https://github.com/stz2012/recpt1.git
$ cd recpt1/recpt1
$ sed -i -e "/^char \*bsdev\[NUM_BSDEV\] = {$/a \ \ \ \ \"/dev/px4video1\",\n\ \ \ \ \"/dev/px4video0\",\n\ \ \ \ \"/dev/px4video4\",\n\ \ \ \ \"/dev/px4video5\"," pt1_dev.h
$ sed -i -e "/^char \*isdb_t_dev\[NUM_ISDB_T_DEV\] = {$/a \ \ \ \ \"/dev/px4video2\",\n\ \ \ \ \"/dev/px4video3\",\n\ \ \ \ \"/dev/px4video6\",\n\ \ \ \ \"/dev/px4video7\"," pt1_dev.h
$ ./autogen.sh
$ ./configure --enable-b25
$ make -j 4
$ sudo make install
$ cd /tmp
$ recpt1 --b25 --strip [チャンネル] 20 test.ts

録画したファイルがとりあえず再生出来ることを確認

Mirakurun

# curl -sL https://deb.nodesource.com/setup_10.x | bash -
$ sudo apt-get install -y nodejs
$ sudo npm install pm2 -g
$ sudo npm install mirakurun -g --unsafe-perm --production
$ sudo gpasswd -a $USER video
$ sudo mirakurun config tuners

エディタが立ち上がるので、全部消して次の内容に変更

/usr/local/etc/mirakurun/tuners.yml
- name: PX4-S1
  types:
    - BS
    - CS
  command: recpt1 --b25 --device /dev/px4video0 <channel> - -
  isDisabled: false

- name: PX4-S2
  types:
    - BS
    - CS
  command: recpt1 --b25 --device /dev/px4video1 <channel> - -
  isDisabled: false

- name: PX4-S3
  types:
    - BS
    - CS
  command: recpt1 --b25 --device /dev/px4video4 <channel> - -
  isDisabled: false

- name: PX4-S4
  types:
    - BS
    - CS
  command: recpt1 --b25 --device /dev/px4video5 <channel> - -
  isDisabled: false

- name: PX4-T1
  types:
    - GR
  command: recpt1 --b25 --device /dev/px4video2 <channel> - -
  isDisabled: false

- name: PX4-T2
  types:
    - GR
  command: recpt1 --b25 --device /dev/px4video3 <channel> - -
  isDisabled: false

- name: PX4-T3
  types:
    - GR
  command: recpt1 --b25 --device /dev/px4video6 <channel> - -
  isDisabled: false

- name: PX4-T4
  types:
    - GR
  command: recpt1 --b25 --device /dev/px4video7 <channel> - -
  isDisabled: false
$ sudo mirakurun restart
// チャンネルスキャン 時間が掛かるけど、とりあえず待つ
$ sudo curl -X PUT "http://localhost:40772/api/config/channels/scan"
$ sudo mirakurun restart
$ sudo npm install rivarun -g
// チャンネルスキャンした結果を確認
$ sudo rivarun --list | sed 's/},/},\n/g'

EPGStation

  • npm run buildは4時間ぐらい掛かったかも。
    RasPi4で同じ事したら2分ぐらいだった。SDカード寿命だったのかな?
$ cd
$ git clone https://github.com/l3tnun/EPGStation.git
$ cd EPGStation
$ sudo npm install
$ sudo npm run build
$ cp config/config.sample.json config/config.json
$ cp config/operatorLogConfig.sample.json config/operatorLogConfig.json
$ cp config/serviceLogConfig.sample.json config/serviceLogConfig.json
~/EPGStation/config/config.json
    "ffmpeg": "/usr/bin/ffmpeg",
    "ffprobe": "/usr/bin/ffprobe",
    "recorded": "/path/to/",
    "recordedTmp": "/path/to/",
$ sudo pm2 startup
$ sudo pm2 start dist/server/index.js --name "epgstation"
$ sudo pm2 save

ブラウザから http://host:8888 にアクセスして、EPGStationにアクセス出来ることを確認する。

個別の設定

手元の環境ではRasPiにNASをマウントしているので、memo

$ sudo mkdir /video
$ sudo apt install -y cifs-utils
$ sudo mkdir /etc/samba
/etc/samba/credentials.
username=user
password=pass
/etc/fstab.
//192.168.xxx.xxx/video /video cifs credentials=/etc/samba/credentials,_netdev,x-systemd.automount,uid=1000,gid=1000,forceuid,forcegid 0 0

参考にしたサイト

13
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
27