annotate src/pt1_common.c @ 179:ac23a9b417a2

Support Linux kernel version >= 3.8 Add ld opt -lm
author Naoya OYAMA <naoya.oyama@gmail.com>
date Fri, 03 May 2013 11:00:11 +0900
parents 4f3640bf350d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
169
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
1 /* pt1_common.c -- This file is part of recpt1.
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
2
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
3 Copyright 2012 Naoya OYAMA <naoya.oyama@gmail.com>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
4
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
7 the Free Software Foundation, either version 3 of the License, or
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
8 (at your option) any later version.
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
9
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
13 GNU General Public License for more details.
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
14
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
17
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
18 #include <ctype.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
19 #include <math.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
20 #include <stdio.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
21 #include <stdlib.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
22 #include <string.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
23 #include <sys/ioctl.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
24 #include <sys/types.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
25 #include <sys/stat.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
26 #include <fcntl.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
27
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
28 #include <pt1_ioctl.h>
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
29 #include "recpt1.h"
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
30 #include "pt1_dev.h"
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
31 #include "pt1_common.h"
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
32
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
33 // 変換テーブル(ISDB-T用)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
34 // 実際にioctl()を行う値の部分はREADMEを参照の事。
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
35 // BS/CSの設定値およびスロット番号は
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
36 // http://www5e.biglobe.ne.jp/~kazu_f/digital-sat/index.htmlより取得。
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
37 //
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
38
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
39 ISDB_T_FREQ_CONV_TABLE isdb_t_conv_table[] = {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
40 { 0, CHTYPE_SATELLITE, 0, "151"}, /* 151ch:BS朝日 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
41 { 0, CHTYPE_SATELLITE, 1, "161"}, /* 161ch:BS-TBS */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
42 { 1, CHTYPE_SATELLITE, 0, "191"}, /* 191ch:WOWOW prime */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
43 { 1, CHTYPE_SATELLITE, 1, "171"}, /* 171ch:BSジャパン */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
44 { 2, CHTYPE_SATELLITE, 0, "192"}, /* 192ch:WOWOWライブ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
45 { 2, CHTYPE_SATELLITE, 1, "193"}, /* 193ch:WOWOWシネマ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
46 { 3, CHTYPE_SATELLITE, 0, "201"}, /* 201ch:スター・チャンネル2 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
47 { 3, CHTYPE_SATELLITE, 0, "202"}, /* 202ch:スター・チャンネル3 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
48 { 3, CHTYPE_SATELLITE, 1, "236"}, /* 236ch:BSアニマックス */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
49 { 3, CHTYPE_SATELLITE, 2, "256"}, /* 256ch:ディズニー・チャンネル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
50 { 4, CHTYPE_SATELLITE, 0, "211"}, /* 211ch:BS11デジタル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
51 { 4, CHTYPE_SATELLITE, 1, "200"}, /* 200ch:スター・チャンネル1 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
52 { 4, CHTYPE_SATELLITE, 2, "222"}, /* 222ch:TwellV */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
53 { 5, CHTYPE_SATELLITE, 0, "238"}, /* 238ch:FOX bs238 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
54 { 5, CHTYPE_SATELLITE, 1, "241"}, /* 241ch:BSスカパー! */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
55 { 5, CHTYPE_SATELLITE, 2, "231"}, /* 231ch:放送大学テレビ1 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
56 { 5, CHTYPE_SATELLITE, 2, "232"}, /* 232ch:放送大学テレビ2 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
57 { 5, CHTYPE_SATELLITE, 2, "233"}, /* 233ch:放送大学テレビ3 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
58 { 5, CHTYPE_SATELLITE, 2, "531"}, /* 531ch:放送大学ラジオ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
59 { 6, CHTYPE_SATELLITE, 0, "141"}, /* 141ch:BS日テレ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
60 { 6, CHTYPE_SATELLITE, 1, "181"}, /* 181ch:BSフジ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
61 { 7, CHTYPE_SATELLITE, 0, "101"}, /* 101ch:NHK-BS1 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
62 { 7, CHTYPE_SATELLITE, 0, "102"}, /* 102ch:NHK-BS1臨時 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
63 { 7, CHTYPE_SATELLITE, 1, "103"}, /* 103ch:NHK-BSプレミアム*/
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
64 { 7, CHTYPE_SATELLITE, 1, "910"}, /* 910ch:ウェザーニュース(WNI)*/
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
65 { 8, CHTYPE_SATELLITE, 2, "291"}, /* 291ch:NHK総合テレビジョン(東京)*/
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
66 { 8, CHTYPE_SATELLITE, 2, "292"}, /* 292ch:NHK教育テレビジョン(東京)*/
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
67 { 8, CHTYPE_SATELLITE, 1, "294"}, /* 294ch:日本テレビ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
68 { 8, CHTYPE_SATELLITE, 1, "295"}, /* 295ch:テレビ朝日 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
69 { 8, CHTYPE_SATELLITE, 1, "296"}, /* 296ch:TBSテレビ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
70 { 8, CHTYPE_SATELLITE, 1, "297"}, /* 297ch:テレビ東京 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
71 { 8, CHTYPE_SATELLITE, 2, "298"}, /* 298ch:フジテレビ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
72 { 9, CHTYPE_SATELLITE, 0, "234"}, /* 234ch:グリーンチャンネル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
73 { 9, CHTYPE_SATELLITE, 1, "242"}, /* 242ch:J SPORTS 1 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
74 { 9, CHTYPE_SATELLITE, 2, "243"}, /* 243ch:J SPORTS 2 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
75 { 10, CHTYPE_SATELLITE, 0, "252"}, /* 252ch:IMAGICA BS */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
76 { 10, CHTYPE_SATELLITE, 1, "244"}, /* 244ch:J SPORTS 3 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
77 { 10, CHTYPE_SATELLITE, 2, "245"}, /* 245ch:J SPORTS 4 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
78 { 11, CHTYPE_SATELLITE, 0, "251"}, /* 251ch:BS釣りビジョン */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
79 { 11, CHTYPE_SATELLITE, 1, "255"}, /* 255ch:日本映画専門チャンネル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
80 { 11, CHTYPE_SATELLITE, 2, "258"}, /* 258ch:D-Life */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
81 { 12, CHTYPE_SATELLITE, 0, "CS2"}, /* ND2:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
82 * 237ch:スター・チャンネル プラス
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
83 * 239ch:日本映画専門チャンネルHD
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
84 * 306ch:フジテレビNEXT */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
85 { 13, CHTYPE_SATELLITE, 0, "CS4"}, /* ND4:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
86 * 100ch:e2プロモ
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
87 * 256ch:J sports ESPN
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
88 * 312ch:FOX
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
89 * 322ch:スペースシャワーTV
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
90 * 331ch:カートゥーンネットワーク
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
91 * 294ch:ホームドラマチャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
92 * 334ch:トゥーン・ディズニー */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
93 { 14, CHTYPE_SATELLITE, 0, "CS6"}, /* ND6:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
94 * 221ch:東映チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
95 * 222ch:衛星劇場
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
96 * 223ch:チャンネルNECO
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
97 * 224ch:洋画★シネフィル・イマジカ
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
98 * 292ch:時代劇専門チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
99 * 238ch:スター・チャンネル クラシック
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
100 * 310ch:スーパー!ドラマTV
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
101 * 311ch:AXN
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
102 * 250ch:スカイ・Asports+ */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
103 { 15, CHTYPE_SATELLITE, 0, "CS8"}, /* ND8:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
104 * 055ch:ショップ チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
105 * 335ch:キッズステーションHD */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
106 { 16, CHTYPE_SATELLITE, 0, "CS10"}, /* ND10:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
107 * 228ch:ザ・シネマ
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
108 * 800ch:スカチャンHD800
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
109 * 801ch:スカチャン801
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
110 * 802ch:スカチャン802 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
111 { 17, CHTYPE_SATELLITE, 0, "CS12"}, /* ND12:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
112 * 260ch:ザ・ゴルフ・チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
113 * 303ch:テレ朝チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
114 * 323ch:MTV 324ch:大人の音楽専門TV◆ミュージック・エア
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
115 * 352ch:朝日ニュースター
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
116 * 353ch:BBCワールドニュース
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
117 * 354ch:CNNj
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
118 * 110ch:ワンテンポータル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
119 { 18, CHTYPE_SATELLITE, 0, "CS14"}, /* ND14:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
120 * 251ch:J sports 1
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
121 * 252ch:J sports 2
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
122 * 253ch:J sports Plus
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
123 * 254ch:GAORA */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
124 { 19, CHTYPE_SATELLITE, 0, "CS16"}, /* ND16:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
125 * 305ch:チャンネル銀河
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
126 * 333ch:アニメシアターX(AT-X)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
127 * 342ch:ヒストリーチャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
128 * 290ch:TAKARAZUKA SKYSTAGE
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
129 * 803ch:スカチャン803
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
130 * 804ch:スカチャン804 */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
131 { 20, CHTYPE_SATELLITE, 0, "CS18"}, /* ND18:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
132 * 240ch:ムービープラスHD
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
133 * 262ch:ゴルフネットワーク
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
134 * 314ch:LaLa HDHV */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
135 { 21, CHTYPE_SATELLITE, 0, "CS20"}, /* ND20:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
136 * 258ch:フジテレビONE
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
137 * 302ch:フジテレビTWO
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
138 * 332ch:アニマックス
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
139 * 340ch:ディスカバリーチャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
140 * 341ch:アニマルプラネット */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
141 { 22, CHTYPE_SATELLITE, 0, "CS22"}, /* ND22:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
142 * 160ch:C-TBSウェルカムチャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
143 * 161ch:QVC
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
144 * 185ch:プライム365.TV
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
145 * 293ch:ファミリー劇場
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
146 * 301ch:TBSチャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
147 * 304ch:ディズニー・チャンネル
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
148 * 325ch:MUSIC ON! TV
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
149 * 351ch:TBSニュースバード
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
150 * 343ch:ナショナルジオグラフィックチャンネル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
151 { 23, CHTYPE_SATELLITE, 0, "CS24"}, /* ND24:
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
152 * 257ch:日テレG+ HD
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
153 * 291ch:fashiontv
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
154 * 300ch:日テレプラス
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
155 * 315ch:FOXプラス
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
156 * 321ch:MusicJapan TV
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
157 * 350ch:日テレNEWS24
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
158 * 362ch:旅チャンネル */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
159 { 0, CHTYPE_GROUND, 0, "1"}, { 1, CHTYPE_GROUND, 0, "2"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
160 { 2, CHTYPE_GROUND, 0, "3"}, { 3, CHTYPE_GROUND, 0, "C13"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
161 { 4, CHTYPE_GROUND, 0, "C14"}, { 5, CHTYPE_GROUND, 0, "C15"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
162 { 6, CHTYPE_GROUND, 0, "C16"}, { 7, CHTYPE_GROUND, 0, "C17"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
163 { 8, CHTYPE_GROUND, 0, "C18"}, { 9, CHTYPE_GROUND, 0, "C19"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
164 { 10, CHTYPE_GROUND, 0, "C20"}, { 11, CHTYPE_GROUND, 0, "C21"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
165 { 12, CHTYPE_GROUND, 0, "C22"}, { 13, CHTYPE_GROUND, 0, "4"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
166 { 14, CHTYPE_GROUND, 0, "5"}, { 15, CHTYPE_GROUND, 0, "6"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
167 { 16, CHTYPE_GROUND, 0, "7"}, { 17, CHTYPE_GROUND, 0, "8"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
168 { 18, CHTYPE_GROUND, 0, "9"}, { 19, CHTYPE_GROUND, 0, "10"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
169 { 20, CHTYPE_GROUND, 0, "11"}, { 21, CHTYPE_GROUND, 0, "12"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
170 { 22, CHTYPE_GROUND, 0, "C23"}, { 23, CHTYPE_GROUND, 0, "C24"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
171 { 24, CHTYPE_GROUND, 0, "C25"}, { 25, CHTYPE_GROUND, 0, "C26"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
172 { 26, CHTYPE_GROUND, 0, "C27"}, { 27, CHTYPE_GROUND, 0, "C28"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
173 { 28, CHTYPE_GROUND, 0, "C29"}, { 29, CHTYPE_GROUND, 0, "C30"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
174 { 30, CHTYPE_GROUND, 0, "C31"}, { 31, CHTYPE_GROUND, 0, "C32"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
175 { 32, CHTYPE_GROUND, 0, "C33"}, { 33, CHTYPE_GROUND, 0, "C34"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
176 { 34, CHTYPE_GROUND, 0, "C35"}, { 35, CHTYPE_GROUND, 0, "C36"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
177 { 36, CHTYPE_GROUND, 0, "C37"}, { 37, CHTYPE_GROUND, 0, "C38"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
178 { 38, CHTYPE_GROUND, 0, "C39"}, { 39, CHTYPE_GROUND, 0, "C40"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
179 { 40, CHTYPE_GROUND, 0, "C41"}, { 41, CHTYPE_GROUND, 0, "C42"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
180 { 42, CHTYPE_GROUND, 0, "C43"}, { 43, CHTYPE_GROUND, 0, "C44"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
181 { 44, CHTYPE_GROUND, 0, "C45"}, { 45, CHTYPE_GROUND, 0, "C46"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
182 { 46, CHTYPE_GROUND, 0, "C47"}, { 47, CHTYPE_GROUND, 0, "C48"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
183 { 48, CHTYPE_GROUND, 0, "C49"}, { 49, CHTYPE_GROUND, 0, "C50"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
184 { 50, CHTYPE_GROUND, 0, "C51"}, { 51, CHTYPE_GROUND, 0, "C52"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
185 { 52, CHTYPE_GROUND, 0, "C53"}, { 53, CHTYPE_GROUND, 0, "C54"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
186 { 54, CHTYPE_GROUND, 0, "C55"}, { 55, CHTYPE_GROUND, 0, "C56"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
187 { 56, CHTYPE_GROUND, 0, "C57"}, { 57, CHTYPE_GROUND, 0, "C58"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
188 { 58, CHTYPE_GROUND, 0, "C59"}, { 59, CHTYPE_GROUND, 0, "C60"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
189 { 60, CHTYPE_GROUND, 0, "C61"}, { 61, CHTYPE_GROUND, 0, "C62"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
190 { 62, CHTYPE_GROUND, 0, "C63"}, { 63, CHTYPE_GROUND, 0, "13"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
191 { 64, CHTYPE_GROUND, 0, "14"}, { 65, CHTYPE_GROUND, 0, "15"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
192 { 66, CHTYPE_GROUND, 0, "16"}, { 67, CHTYPE_GROUND, 0, "17"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
193 { 68, CHTYPE_GROUND, 0, "18"}, { 69, CHTYPE_GROUND, 0, "19"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
194 { 70, CHTYPE_GROUND, 0, "20"}, { 71, CHTYPE_GROUND, 0, "21"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
195 { 72, CHTYPE_GROUND, 0, "22"}, { 73, CHTYPE_GROUND, 0, "23"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
196 { 74, CHTYPE_GROUND, 0, "24"}, { 75, CHTYPE_GROUND, 0, "25"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
197 { 76, CHTYPE_GROUND, 0, "26"}, { 77, CHTYPE_GROUND, 0, "27"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
198 { 78, CHTYPE_GROUND, 0, "28"}, { 79, CHTYPE_GROUND, 0, "29"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
199 { 80, CHTYPE_GROUND, 0, "30"}, { 81, CHTYPE_GROUND, 0, "31"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
200 { 82, CHTYPE_GROUND, 0, "32"}, { 83, CHTYPE_GROUND, 0, "33"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
201 { 84, CHTYPE_GROUND, 0, "34"}, { 85, CHTYPE_GROUND, 0, "35"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
202 { 86, CHTYPE_GROUND, 0, "36"}, { 87, CHTYPE_GROUND, 0, "37"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
203 { 88, CHTYPE_GROUND, 0, "38"}, { 89, CHTYPE_GROUND, 0, "39"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
204 { 90, CHTYPE_GROUND, 0, "40"}, { 91, CHTYPE_GROUND, 0, "41"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
205 { 92, CHTYPE_GROUND, 0, "42"}, { 93, CHTYPE_GROUND, 0, "43"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
206 { 94, CHTYPE_GROUND, 0, "44"}, { 95, CHTYPE_GROUND, 0, "45"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
207 { 96, CHTYPE_GROUND, 0, "46"}, { 97, CHTYPE_GROUND, 0, "47"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
208 { 98, CHTYPE_GROUND, 0, "48"}, { 99, CHTYPE_GROUND, 0, "49"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
209 { 100, CHTYPE_GROUND, 0, "50"}, { 101, CHTYPE_GROUND, 0, "51"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
210 { 102, CHTYPE_GROUND, 0, "52"}, { 103, CHTYPE_GROUND, 0, "53"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
211 { 104, CHTYPE_GROUND, 0, "54"}, { 105, CHTYPE_GROUND, 0, "55"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
212 { 106, CHTYPE_GROUND, 0, "56"}, { 107, CHTYPE_GROUND, 0, "57"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
213 { 108, CHTYPE_GROUND, 0, "58"}, { 109, CHTYPE_GROUND, 0, "59"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
214 { 110, CHTYPE_GROUND, 0, "60"}, { 111, CHTYPE_GROUND, 0, "61"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
215 { 112, CHTYPE_GROUND, 0, "62"},
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
216 { 0, 0, 0, NULL} /* terminate */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
217 };
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
218
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
219 char *bsdev[NUM_BSDEV] = {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
220 "/dev/pt1video1",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
221 "/dev/pt1video0",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
222 "/dev/pt1video5",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
223 "/dev/pt1video4",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
224 "/dev/pt1video9",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
225 "/dev/pt1video8",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
226 "/dev/pt1video13",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
227 "/dev/pt1video12",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
228 "/dev/pt3video1",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
229 "/dev/pt3video0",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
230 "/dev/pt3video5",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
231 "/dev/pt3video4",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
232 "/dev/pt3video9",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
233 "/dev/pt3video8",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
234 "/dev/pt3video13",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
235 "/dev/pt3video12"
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
236 };
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
237 char *isdb_t_dev[NUM_ISDB_T_DEV] = {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
238 "/dev/pt1video2",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
239 "/dev/pt1video3",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
240 "/dev/pt1video6",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
241 "/dev/pt1video7",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
242 "/dev/pt1video10",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
243 "/dev/pt1video11",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
244 "/dev/pt1video14",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
245 "/dev/pt1video15",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
246 "/dev/pt3video2",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
247 "/dev/pt3video3",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
248 "/dev/pt3video6",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
249 "/dev/pt3video7",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
250 "/dev/pt3video10",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
251 "/dev/pt3video11",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
252 "/dev/pt3video14",
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
253 "/dev/pt3video15"
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
254 };
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
255
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
256 //global
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
257 char bs_channel_buf[8];
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
258 ISDB_T_FREQ_CONV_TABLE isdb_t_conv_set = { 0, CHTYPE_SATELLITE, 0, bs_channel_buf };
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
259 extern boolean f_exit;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
260
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
261 /* lookup frequency conversion table*/
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
262 ISDB_T_FREQ_CONV_TABLE *
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
263 searchrecoff(char *channel)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
264 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
265 int lp;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
266
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
267 if((channel[0] == 'B' || channel[0] == 'b') &&
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
268 (channel[1] == 'S' || channel[1] == 's')) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
269 int node = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
270 int slot = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
271 char *bs_ch;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
272
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
273 bs_ch = channel + 2;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
274 while(isdigit(*bs_ch)) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
275 node *= 10;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
276 node += *bs_ch++ - '0';
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
277 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
278 if(*bs_ch == '_' && (node&0x01) && node < ISDB_T_NODE_LIMIT) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
279 if(isdigit(*++bs_ch)) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
280 slot = *bs_ch - '0';
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
281 if(*++bs_ch == '\0' && slot < ISDB_T_SLOT_LIMIT) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
282 isdb_t_conv_set.set_freq = node / 2;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
283 isdb_t_conv_set.add_freq = slot;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
284 sprintf(bs_channel_buf, "BS%d_%d", node, slot);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
285 return &isdb_t_conv_set;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
286 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
287 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
288 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
289 return NULL;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
290 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
291
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
292 for(lp = 0; isdb_t_conv_table[lp].parm_freq != NULL; lp++) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
293 /* return entry number in the table when strings match and
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
294 * lengths are same. */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
295 if((memcmp(isdb_t_conv_table[lp].parm_freq, channel,
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
296 strlen(channel)) == 0) &&
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
297 (strlen(channel) == strlen(isdb_t_conv_table[lp].parm_freq))) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
298 return &isdb_t_conv_table[lp];
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
299 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
300 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
301 return NULL;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
302 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
303
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
304 void
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
305 show_channels(void)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
306 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
307 FILE *f;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
308 char *home;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
309 char buf[255], filename[255];
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
310
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
311 fprintf(stderr, "Available Channels:\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
312
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
313 home = getenv("HOME");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
314 sprintf(filename, "%s/.recpt1-channels", home);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
315 f = fopen(filename, "r");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
316 if(f) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
317 while(fgets(buf, 255, f))
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
318 fprintf(stderr, "%s", buf);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
319 fclose(f);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
320 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
321 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
322 fprintf(stderr, "13-62: Terrestrial Channels\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
323 fprintf(stderr, "101ch: NHK BS1\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
324 fprintf(stderr, "102ch: NHK BS2\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
325 fprintf(stderr, "103ch: NHK BShi\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
326 fprintf(stderr, "141ch: BS Nittele\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
327 fprintf(stderr, "151ch: BS Asahi\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
328 fprintf(stderr, "161ch: BS-TBS\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
329 fprintf(stderr, "171ch: BS Japan\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
330 fprintf(stderr, "181ch: BS Fuji\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
331 fprintf(stderr, "191ch: WOWOW\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
332 fprintf(stderr, "192ch: WOWOW2\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
333 fprintf(stderr, "193ch: WOWOW3\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
334 fprintf(stderr, "200ch: Star Channel\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
335 fprintf(stderr, "211ch: BS11 Digital\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
336 fprintf(stderr, "222ch: TwellV\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
337 fprintf(stderr, "C13-C63: CATV Channels\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
338 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
339 fprintf(stderr, "CS2-CS24: CS Channels\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
340 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
341
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
342 float
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
343 getsignal_isdb_s(int signal)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
344 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
345 /* apply linear interpolation */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
346 static const float afLevelTable[] = {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
347 24.07f, // 00 00 0 24.07dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
348 24.07f, // 10 00 4096 24.07dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
349 18.61f, // 20 00 8192 18.61dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
350 15.21f, // 30 00 12288 15.21dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
351 12.50f, // 40 00 16384 12.50dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
352 10.19f, // 50 00 20480 10.19dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
353 8.140f, // 60 00 24576 8.140dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
354 6.270f, // 70 00 28672 6.270dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
355 4.550f, // 80 00 32768 4.550dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
356 3.730f, // 88 00 34816 3.730dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
357 3.630f, // 88 FF 35071 3.630dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
358 2.940f, // 90 00 36864 2.940dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
359 1.420f, // A0 00 40960 1.420dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
360 0.000f // B0 00 45056 -0.01dB
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
361 };
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
362
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
363 unsigned char sigbuf[4];
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
364 memset(sigbuf, '\0', sizeof(sigbuf));
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
365 sigbuf[0] = (((signal & 0xFF00) >> 8) & 0XFF);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
366 sigbuf[1] = (signal & 0xFF);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
367
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
368 /* calculate signal level */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
369 if(sigbuf[0] <= 0x10U) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
370 /* clipped maximum */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
371 return 24.07f;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
372 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
373 else if (sigbuf[0] >= 0xB0U) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
374 /* clipped minimum */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
375 return 0.0f;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
376 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
377 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
378 /* linear interpolation */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
379 const float fMixRate =
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
380 (float)(((unsigned short)(sigbuf[0] & 0x0FU) << 8) |
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
381 (unsigned short)sigbuf[0]) / 4096.0f;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
382 return afLevelTable[sigbuf[0] >> 4] * (1.0f - fMixRate) +
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
383 afLevelTable[(sigbuf[0] >> 4) + 0x01U] * fMixRate;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
384 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
385 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
386
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
387 static void
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
388 do_bell(int bell)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
389 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
390 int i;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
391 for(i=0; i < bell; i++) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
392 fprintf(stderr, "\a");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
393 usleep(400000);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
394 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
395 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
396
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
397 void
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
398 calc_cn(int fd, int type, boolean use_bell)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
399 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
400 int rc;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
401 double P;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
402 double CNR;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
403 int bell = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
404
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
405 if(ioctl(fd, GET_SIGNAL_STRENGTH, &rc) < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
406 fprintf(stderr, "Tuner Select Error\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
407 return ;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
408 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
409
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
410 if(type == CHTYPE_GROUND) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
411 P = log10(5505024/(double)rc) * 10;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
412 CNR = (0.000024 * P * P * P * P) - (0.0016 * P * P * P) +
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
413 (0.0398 * P * P) + (0.5491 * P)+3.0965;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
414 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
415 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
416 CNR = getsignal_isdb_s(rc);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
417 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
418
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
419 if(CNR >= 30.0)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
420 bell = 3;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
421 else if(CNR >= 15.0 && CNR < 30.0)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
422 bell = 2;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
423 else if(CNR < 15.0)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
424 bell = 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
425
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
426 fprintf(stderr, "\rC/N = %fdB", CNR);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
427 if(use_bell)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
428 do_bell(bell);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
429 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
430
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
431 int
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
432 tune(char *channel, thread_data *tdata, char *device)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
433 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
434 char **tuner;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
435 int num_devs;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
436 int lp;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
437 FREQUENCY freq;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
438
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
439 /* get channel */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
440 tdata->table = searchrecoff(channel);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
441 if(tdata->table == NULL) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
442 fprintf(stderr, "Invalid Channel: %s\n", channel);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
443 return 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
444 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
445
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
446 freq.frequencyno = tdata->table->set_freq;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
447 freq.slot = tdata->table->add_freq;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
448
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
449 /* open tuner */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
450 /* case 1: specified tuner device */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
451 if(device) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
452 tdata->tfd = open(device, O_RDONLY);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
453 if(tdata->tfd < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
454 fprintf(stderr, "Cannot open tuner device: %s\n", device);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
455 return 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
456 }
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
457 tdata->device_name = device;
169
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
458
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
459 /* power on LNB */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
460 if(tdata->table->type == CHTYPE_SATELLITE) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
461 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
462 fprintf(stderr, "Power on LNB failed: %s\n", device);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
463 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
464 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
465
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
466 /* tune to specified channel */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
467 while(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
468 if(f_exit) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
469 close_tuner(tdata);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
470 return 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
471 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
472 fprintf(stderr, "No signal. Still trying: %s\n", device);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
473 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
474
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
475 fprintf(stderr, "device = %s\n", device);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
476 strncpy(tdata->ch, channel, sizeof(tdata->ch));
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
477 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
478 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
479 /* case 2: loop around available devices */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
480 if(tdata->table->type == CHTYPE_SATELLITE) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
481 tuner = bsdev;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
482 num_devs = NUM_BSDEV;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
483 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
484 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
485 tuner = isdb_t_dev;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
486 num_devs = NUM_ISDB_T_DEV;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
487 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
488
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
489 for(lp = 0; lp < num_devs; lp++) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
490 int count = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
491
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
492 tdata->tfd = open(tuner[lp], O_RDONLY);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
493 if(tdata->tfd >= 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
494 /* power on LNB */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
495 if(tdata->table->type == CHTYPE_SATELLITE) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
496 if(ioctl(tdata->tfd, LNB_ENABLE, tdata->lnb) < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
497 fprintf(stderr, "Warning: Power on LNB failed: %s\n", tuner[lp]);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
498 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
499 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
500
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
501 /* tune to specified channel */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
502 while(ioctl(tdata->tfd, SET_CHANNEL, &freq) < 0 &&
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
503 count < MAX_RETRY) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
504 if(f_exit) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
505 close_tuner(tdata);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
506 return 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
507 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
508 fprintf(stderr, "No signal. Still trying: %s\n", tuner[lp]);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
509 count++;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
510 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
511
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
512 if(count >= MAX_RETRY) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
513 close_tuner(tdata);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
514 count = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
515 continue;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
516 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
517
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
518 fprintf(stderr, "device = %s\n", tuner[lp]);
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
519 tdata->device_name = tuner[lp];
169
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
520 break; /* found suitable tuner */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
521 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
522 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
523
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
524 /* all tuners cannot be used */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
525 if(tdata->tfd < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
526 fprintf(stderr, "Cannot tune to the specified channel\n");
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
527 return 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
528 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
529 else {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
530 strncpy(tdata->ch, channel, sizeof(tdata->ch));
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
531 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
532 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
533
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
534 return 0; /* success */
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
535 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
536
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
537 int
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
538 close_tuner(thread_data *tdata)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
539 {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
540 int rv = 0;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
541
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
542 if(tdata->tfd == -1)
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
543 return rv;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
544
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
545 if(tdata->table->type == CHTYPE_SATELLITE) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
546 if(ioctl(tdata->tfd, LNB_DISABLE, 0) < 0) {
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
547 rv = 1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
548 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
549 }
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
550 close(tdata->tfd);
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
551 tdata->tfd = -1;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
552
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
553 return rv;
cb54f9777734 Add pt1_common.c
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
diff changeset
554 }
170
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
555
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
556 uint16_t
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
557 get_device_id_by_name(char *device_name)
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
558 {
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
559 char *p = NULL;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
560 uint8_t id = -1;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
561 uint8_t pt = -1;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
562 uint16_t device_id = -1;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
563
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
564 p = strstr(device_name, "/dev/pt");
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
565 if(!p)
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
566 return -1;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
567 p += strlen("/dev/pt");
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
568 pt = atoi(p++);
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
569
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
570 p = strstr(p, "video");
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
571 if(!p)
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
572 return -1;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
573 p += strlen("video");
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
574 id = atoi(p);
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
575
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
576 device_id = (pt & 0xff) <<8 | (id & 0xff);
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
577 return device_id;
4f3640bf350d Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents: 169
diff changeset
578 }