コミットメタ情報

リビジョン01d4e337ec27ba20036e9a10b654f05b3e482d8f (tree)
日時2019-11-03 18:16:09
作者Satoshi Yasuda <7m3tjz@jarl...>
コミッターSatoshi Yasuda

ログメッセージ

modified: dmonitor.h
modified: dmonitor_utils.c
modified: inet_read.c
modified: main.c
modified: repeater_scan.c
modified: rig_read.c

変更サマリ

差分

--- a/config.h
+++ b/config.h
@@ -86,7 +86,7 @@
8686 #define PACKAGE_NAME "dmonitor"
8787
8888 /* Define to the full name and version of this package. */
89-#define PACKAGE_STRING "dmonitor 01.21"
89+#define PACKAGE_STRING "dmonitor 01.24"
9090
9191 /* Define to the one symbol short name of this package. */
9292 #define PACKAGE_TARNAME "dmonitor"
@@ -95,10 +95,10 @@
9595 #define PACKAGE_URL ""
9696
9797 /* Define to the version of this package. */
98-#define PACKAGE_VERSION "01.21"
98+#define PACKAGE_VERSION "01.24"
9999
100100 /* Define to 1 if you have the ANSI C header files. */
101101 #define STDC_HEADERS 1
102102
103103 /* Version number of package */
104-#define VERSION "01.21"
104+#define VERSION "01.24"
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
11 #! /bin/sh
22 # Guess values for system-dependent variables and create Makefiles.
3-# Generated by GNU Autoconf 2.69 for dmonitor 01.21.
3+# Generated by GNU Autoconf 2.69 for dmonitor 01.24.
44 #
55 # Report bugs to <7m3tjz@jarl.com>.
66 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
580580 # Identity of this package.
581581 PACKAGE_NAME='dmonitor'
582582 PACKAGE_TARNAME='dmonitor'
583-PACKAGE_VERSION='01.21'
584-PACKAGE_STRING='dmonitor 01.21'
583+PACKAGE_VERSION='01.24'
584+PACKAGE_STRING='dmonitor 01.24'
585585 PACKAGE_BUGREPORT='7m3tjz@jarl.com'
586586 PACKAGE_URL=''
587587
@@ -1277,7 +1277,7 @@ if test "$ac_init_help" = "long"; then
12771277 # Omit some internal or obsolete options to make the list less imposing.
12781278 # This message is too long to be a string in the A/UX 3.1 sh.
12791279 cat <<_ACEOF
1280-\`configure' configures dmonitor 01.21 to adapt to many kinds of systems.
1280+\`configure' configures dmonitor 01.24 to adapt to many kinds of systems.
12811281
12821282 Usage: $0 [OPTION]... [VAR=VALUE]...
12831283
@@ -1344,7 +1344,7 @@ fi
13441344
13451345 if test -n "$ac_init_help"; then
13461346 case $ac_init_help in
1347- short | recursive ) echo "Configuration of dmonitor 01.21:";;
1347+ short | recursive ) echo "Configuration of dmonitor 01.24:";;
13481348 esac
13491349 cat <<\_ACEOF
13501350
@@ -1435,7 +1435,7 @@ fi
14351435 test -n "$ac_init_help" && exit $ac_status
14361436 if $ac_init_version; then
14371437 cat <<\_ACEOF
1438-dmonitor configure 01.21
1438+dmonitor configure 01.24
14391439 generated by GNU Autoconf 2.69
14401440
14411441 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1804,7 +1804,7 @@ cat >config.log <<_ACEOF
18041804 This file contains any messages produced by compilers while
18051805 running configure, to aid debugging if configure makes a mistake.
18061806
1807-It was created by dmonitor $as_me 01.21, which was
1807+It was created by dmonitor $as_me 01.24, which was
18081808 generated by GNU Autoconf 2.69. Invocation command line was
18091809
18101810 $ $0 $@
@@ -2670,7 +2670,7 @@ fi
26702670
26712671 # Define the identity of the package.
26722672 PACKAGE='dmonitor'
2673- VERSION='01.21'
2673+ VERSION='01.24'
26742674
26752675
26762676 cat >>confdefs.h <<_ACEOF
@@ -4768,7 +4768,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
47684768 # report actual input values of CONFIG_FILES etc. instead of their
47694769 # values after options handling.
47704770 ac_log="
4771-This file was extended by dmonitor $as_me 01.21, which was
4771+This file was extended by dmonitor $as_me 01.24, which was
47724772 generated by GNU Autoconf 2.69. Invocation command line was
47734773
47744774 CONFIG_FILES = $CONFIG_FILES
@@ -4834,7 +4834,7 @@ _ACEOF
48344834 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
48354835 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
48364836 ac_cs_version="\\
4837-dmonitor config.status 01.21
4837+dmonitor config.status 01.24
48384838 configured by $0, generated by GNU Autoconf 2.69,
48394839 with options \\"\$ac_cs_config\\"
48404840
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,31 @@
1+dmonitor (01.25) unstable; urgency=low
2+
3+ * update Closes: (#087)
4+ * changed the 32 byte packet routine.
5+
6+ -- Satoshi Yasuda <7m3tjz@jarl.com> Sun, 3 Nov 2019 18:15:00 +0900
7+
8+dmonitor (01.24) unstable; urgency=low
9+
10+ * update Closes: (#086)
11+ * changed getFifo.
12+
13+ -- Satoshi Yasuda <7m3tjz@jarl.com> Sat, 2 Nov 2019 09:30:00 +0900
14+
15+dmonitor (01.23) unstable; urgency=low
16+
17+ * update Closes: (#085)
18+ * changed rig ack routine.
19+
20+ -- Satoshi Yasuda <7m3tjz@jarl.com> Thu, 31 Oct 2019 10:30:00 +0900
21+
22+dmonitor (01.22) unstable; urgency=low
23+
24+ * update Closes: (#084)
25+ * added jitter buffer.
26+
27+ -- Satoshi Yasuda <7m3tjz@jarl.com> Wed, 30 Oct 2019 15:00:00 +0900
28+
129 dmonitor (01.21) unstable; urgency=low
230
331 * update Closes: (#083)
--- a/debian/dmonitor/DEBIAN/control
+++ b/debian/dmonitor/DEBIAN/control
@@ -1,8 +1,8 @@
11 Package: dmonitor
2-Version: 01.21
2+Version: 01.24
33 Architecture: armhf
44 Maintainer: Satoshi Yasuda <7m3tjz@jarl.com>
5-Installed-Size: 139
5+Installed-Size: 143
66 Depends: libc6 (>= 2.15), perl:any
77 Section: hamradio
88 Priority: optional
--- a/debian/dmonitor/DEBIAN/md5sums
+++ b/debian/dmonitor/DEBIAN/md5sums
@@ -1,9 +1,9 @@
11 d27fb6e6be7d30ba05eedaf0319f2ce9 usr/bin/auto_repmon
2-048088331b4a83c6e3c4163fd31de922 usr/bin/dmonitor
2+b8b0a1ae5c8daacb26db9583466f2ade usr/bin/dmonitor
33 4883951bb1a98b2aebec93706608ed67 usr/bin/repeater_mon
4-f14b43ef0775dfe1e1ef0608a8dcd8da usr/bin/repeater_scan
4+c5b0337b130e0b603f3c18c521b94c99 usr/bin/repeater_scan
55 fd7d34a7321d40fd2c1c039565778ec9 usr/bin/rig_port_check
6-073afff0e9f5155926c73ba0948a34ba usr/share/doc/dmonitor/changelog.gz
6+29e02e0d1d6d3b5390b986740e7a7214 usr/share/doc/dmonitor/changelog.gz
77 50704bff5afce197b1ea87f23e44f64a usr/share/doc/dmonitor/copyright
88 7a7d517fe81db8a20e729e972b95e943 var/tmp/10-cgi.conf.buster
99 474a2f7237ded372896c3d3020c5a953 var/tmp/10-expire.conf.buster
@@ -14,23 +14,23 @@ c445d79dbc0f455f11e4571b96d02dbc var/tmp/rc.local.new
1414 6a90cfd5694d36946458968923289676 var/www/cgi-bin/RegistCall
1515 aa5923807af7900b8fe07694ec4fc1e3 var/www/cgi-bin/Shutdown
1616 e0081f02dc77e7ef87cea584add175ad var/www/cgi-bin/Update
17-984c80f9347cc8f47250825c96762a7e var/www/cgi-bin/add_buffer
17+cc0b4506b8c48d08043183ab7e6bb270 var/www/cgi-bin/add_buffer
1818 6ebb966c3e3d71d8a6da3648d6f24059 var/www/cgi-bin/init_cmd
1919 c2cb1bcb277afdc44fd678198404b57e var/www/cgi-bin/kill_dmon
2020 6d034a17fb4dce8e47fff2767b6ca705 var/www/cgi-bin/kill_repScan
21-efdf9e30f825c905112d82ac6c2befd7 var/www/cgi-bin/menu
22-e9bc988e93b4a28dbf228c339111d585 var/www/cgi-bin/monitor
21+6fe96aa66f9408b970bfaa5edf1eb9e2 var/www/cgi-bin/menu
22+12c3bae07dfe0d76a25b9f042f08a26b var/www/cgi-bin/monitor
2323 bffa48941e01dee9ced1fb836476faab var/www/cgi-bin/redirect
2424 a5a6370479b0af00df0a9c1b87719188 var/www/cgi-bin/repActive
2525 de110ae308456d9a9f1689272e226bf2 var/www/cgi-bin/repMon
2626 0065c03f23c5757abc113929a6b83355 var/www/cgi-bin/repScan
2727 6f40ef2beb41d6bb59cb5d4e2b92141b var/www/cgi-bin/repUpd
28-cb11ad742cbc92d10b53d9127dc08701 var/www/cgi-bin/sub_buffer
28+440252ca9bf01ed117125bc9ca3cac8e var/www/cgi-bin/sub_buffer
2929 b48eb3a363cba9a5d49dd28c4f964165 var/www/cgi-bin/update_log
3030 899400a1c7d58e203b3346654342f5d9 var/www/html/TrustAccessLog.html
3131 c4887e79fc60e14a6da36e60c5c289ae var/www/html/connected_table.html.save
3232 9333598fbda6ba76bf217af8d1b0d6c7 var/www/html/error_msg.html.save
33-2dbcb893cd2ba877c37d5fbc47ea7d8b var/www/html/index.html
33+1b141d65489d048cf5e63ea97ed15112 var/www/html/index.html
3434 5f04b5bd014e38d6e15649d9f590cb15 var/www/html/localhost.index.html
3535 eed77569ec04a7b133457b537642b4d6 var/www/html/menu1.html
3636 123aa57a96f80931eb3203f173350331 var/www/html/repActive.html
Binary files a/debian/dmonitor/usr/bin/dmonitor and b/debian/dmonitor/usr/bin/dmonitor differ
Binary files a/debian/dmonitor/usr/share/doc/dmonitor/changelog.gz and b/debian/dmonitor/usr/share/doc/dmonitor/changelog.gz differ
--- a/debian/files
+++ b/debian/files
@@ -1,3 +1,3 @@
1-dmonitor-dbgsym_01.21_armhf.deb debug optional automatic=yes
2-dmonitor_01.21_armhf.buildinfo hamradio optional
3-dmonitor_01.21_armhf.deb hamradio optional
1+dmonitor-dbgsym_01.24_armhf.deb debug optional automatic=yes
2+dmonitor_01.24_armhf.buildinfo hamradio optional
3+dmonitor_01.24_armhf.deb hamradio optional
--- a/debian/tmp/add_buffer
+++ b/debian/tmp/add_buffer
@@ -20,7 +20,7 @@ print <<'EOF';
2020
2121 </HEAD>
2222 <BODY>
23-<h3>dmonitor connection status V01.21</h3>
23+<h3>dmonitor connection status V01.24</h3>
2424 EOF
2525 print $call;
2626 open(BuffSize, "< /var/tmp/buff_hold.txt") or die("Error: $!");
--- a/debian/tmp/index.html
+++ b/debian/tmp/index.html
@@ -11,15 +11,15 @@
1111 <frameset cols="60%,40%" frameborder="0" border="0" framespaceing="0">
1212 <frame src="/cgi-bin/init_cmd" frameborder=0 NAME="cmd1">
1313 <frameset rows="80%,20%" frameborder="0" border="0" framespaceing="0">
14-<frame src="connected_table.html" frameborder="0" NAME="ctbl">
15-<frame src="error_msg.html" frameborder=0 NAME="err" scrolling="no">
14+<frame src="./connected_table.html" frameborder="0" NAME="ctbl">
15+<frame src="./error_msg.html" frameborder=0 NAME="err" scrolling="no">
1616 </frameset>
1717 </frameset>
1818 </frameset>
1919 <frameset rows="40%,60%" fameborder="0" border="0" framespacing="0" >
20-<frame src="TrustAccessLog.html" frameborder=0 NAME="AccLog" scrolling="no">
20+<frame src="./TrustAccessLog.html" frameborder=0 NAME="AccLog" scrolling="no">
2121 <frameset rows="40,*" frameborder="0" border="0" framespaceing="0">
22-<frame src="title2.html" frameborder=0 NAME="title2" scrolling="no">
22+<frame src="./title2.html" frameborder=0 NAME="title2" scrolling="no">
2323 <frame src="http://log.d-star.info/usr/log_view.html" frameborder="0" NAME="log_view">
2424 </frameset>
2525 </frameset>
--- a/debian/tmp/menu
+++ b/debian/tmp/menu
@@ -85,7 +85,7 @@ EOF
8585 print '<a href=http://' . $result . '/tool.html target=list>システム ツール</a>&nbsp;&nbsp;&nbsp;';
8686 print '<a href=http://log.d-star.info/dmonitor_news.html target=_blank>ニュース</a>&nbsp;&nbsp;&nbsp;';
8787 print <<'EOF'
88-閉じる(戻るボタンで閉じてください) Multi Forward Monitor (dmonitor) V01.21
88+閉じる(戻るボタンで閉じてください) Multi Forward Monitor (dmonitor) V01.24
8989 </center></body>
9090 </html>
9191 EOF
--- a/debian/tmp/monitor
+++ b/debian/tmp/monitor
@@ -22,7 +22,7 @@ print <<'EOF';
2222 <TITLE>Monitor Interface</TITLE>
2323 </HEAD>
2424 <BODY>
25-<h3>dmonitor connection status V01.21</h3>
25+<h3>dmonitor connection status V01.24</h3>
2626 <font color=red>
2727 接続コールサインが設定されていません<br>
2828 最上部のメニューから<br>
@@ -46,7 +46,7 @@ print <<'EOF';
4646
4747 </HEAD>
4848 <BODY>
49-<h3>dmonitor connection status V01.21</h3>
49+<h3>dmonitor connection status V01.24</h3>
5050 EOF
5151 system ("sudo killall -q -s 9 repeater_scan");
5252 system ("sudo killall -q -s 2 dmonitor");
--- a/debian/tmp/sub_buffer
+++ b/debian/tmp/sub_buffer
@@ -23,7 +23,7 @@ print <<'EOF';
2323
2424 </HEAD>
2525 <BODY>
26-<h3>dmonitor connection status V01.21</h3>
26+<h3>dmonitor connection status V01.24</h3>
2727 EOF
2828 print $call;
2929 print "<br><br>";
--- a/dmonitor.h
+++ b/dmonitor.h
@@ -27,9 +27,11 @@
2727 #include <wiringPi.h>
2828 #include "config.h"
2929
30-#define _DEBUG
31-//#define TRUE 1
32-//#define FALSE 0
30+//#define _DEBUG
31+//#define _DEBUG_RIG
32+//#define _DEBUG_RIG_9
33+//#define _DEBUG_INET
34+//#define _DEBUG_JITTER
3335 #define GW 0x80
3436 #define ZR 0x40
3537 #define FWD 0x04
@@ -49,6 +51,9 @@
4951 #define RIG_LED 19
5052 #define INET_LED 26
5153
54+
55+void drop_rate_print (void);
56+
5257 int debug_sw;
5358 int sig_term;
5459
@@ -92,6 +97,7 @@ char hole_punch_server[128];
9297 unsigned char inet_frame_id[2];
9398 struct timeval inet_recv_time;
9499 struct timeval inet_recv_time_save;
100+struct timeval inet_recv_timeout;
95101
96102 struct timeval rig_last_timeout;
97103 int seq;
@@ -130,8 +136,6 @@ int fifo_hold;
130136 int fifo_new_hold;
131137 int rig_last_frame_send;
132138
133-//unsigned char inet_frame_id_save[2];
134-
135139 int inet_led_sw;
136140 int rig_led_sw;
137141
@@ -150,10 +154,6 @@ unsigned int inet_m_save;
150154 long int inet_read_cnt;
151155 long int inet_read_drop_cnt;
152156
153-unsigned char last_frame_seq;
154-
155-int rig_ack_wait;
156-
157157 long int jitter_max;
158158 long int jitter_min;
159159 long int jitter_ave;
@@ -162,3 +162,5 @@ unsigned char jitter_buff[21][13];
162162 int jitter_rd_pnt;
163163 int jitter_wr_cnt;
164164 int jitter_wr_pnt;
165+
166+char ptt;
--- a/dmonitor_utils.c
+++ b/dmonitor_utils.c
@@ -64,7 +64,7 @@ void handler (int sig)
6464 {
6565 sig_term = FALSE;
6666 if (sig == SIGINT) sig_term = TRUE;
67- if (sig == SIGUSR1)
67+ else if (sig == SIGUSR1)
6868 {
6969 fifo_new_hold += 50;
7070 syslog (LOG_INFO, "New FiFo buffer hold size %d", fifo_new_hold);
@@ -77,6 +77,8 @@ void handler (int sig)
7777 syslog (LOG_INFO, "New FiFo buffer hold size %d", fifo_new_hold);
7878 buff_hold_size(fifo_new_hold);
7979 }
80+ else
81+ syslog (LOG_INFO, "signal %d", sig);
8082 }
8183
8284 void buff_hold_size (int cnt)
@@ -211,23 +213,20 @@ int send_rig (void)
211213 int length;
212214 int rate;
213215
214- if (rig_ack_wait) return FALSE;
215-
216216 length = getFifo (&send_buff[3]);
217- if (length == 42)
217+ if (length == 0)
218+ {
219+ Fifo_cnt = 0;
220+ rig_send_sw = FALSE;
221+ return FALSE;
222+ }
223+ else if (length == 42)
218224 {
219225 rig_write (42, &send_buff[3]);
220226 seq = 0;
221- rig_ack_wait = TRUE;
222227 }
223228 else if (length == 13)
224229 {
225- #ifdef _DEBUG
226- syslog (LOG_INFO, "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x",
227- send_buff[2], send_buff[3],
228- send_buff[4], send_buff[5], send_buff[6], send_buff[7], send_buff[8], send_buff[9],
229- send_buff[10], send_buff[11], send_buff[12], send_buff[13], send_buff[14], send_buff[15]);
230- #endif
231230 send_buff[0] = 0x10;
232231 send_buff[1] = 0x22;
233232 send_buff[2] = seq & 0xff;
@@ -236,15 +235,11 @@ int send_rig (void)
236235 rig_write (17, send_buff);
237236 if (send_buff[3] & 0x40)
238237 {
239- memset (inet_frame_id, 0x00, 2);
240238 #ifdef _DEBUG
241239 syslog (LOG_INFO, "Fifo_cnt (last frame) %d", Fifo_cnt);
242240 #endif
243241 if (Fifo_cnt < fifo_hold) rig_send_sw = FALSE;
244242 }
245- last_frame_seq = send_buff[3];
246- last_frame_seq &= 0x1f;
247- rig_ack_wait = TRUE;
248243 }
249244 return TRUE;
250245 }
@@ -275,20 +270,10 @@ void LastFrameSend (void)
275270 send_buff[3] |= 0x40;
276271 memcpy (&send_buff[4], last_data1, 3);
277272 rig_write (17, send_buff);
278-#if 0
279- if (inet_read_cnt)
280- {
281- rate = (inet_read_drop_cnt * 10000) / inet_read_cnt;
282- syslog(LOG_INFO, "drop pakcet rate %d.%02d%% (%ld/%ld)",
283- rate/100, rate%100, inet_read_drop_cnt, inet_read_cnt);
284- syslog(LOG_INFO, "jitter info. ave:%ldmSec. max:%ldmSec. min:%ldmSec.",
285- jitter_ave/inet_read_cnt + 20, jitter_max, jitter_min);
286- }
287-#endif
273+ drop_rate_print();
288274 inet_read_cnt = 0;
289275 inet_read_drop_cnt = 0;
290276 rig_last_frame_send = TRUE;
291- memset (inet_frame_id, 0x00, 2);
292277 if (Fifo_cnt < fifo_hold) rig_send_sw = FALSE;
293278 }
294279
@@ -297,7 +282,7 @@ int getFifo (char pkt[])
297282 struct FifoPkt *tmp;
298283 int len;
299284
300- if (Rp->next == NULL) return 0;
285+ if (Rp->next == NULL) return 0;
301286 tmp = Rp;
302287 Rp = Rp->next;
303288 len = Rp->length;
@@ -451,10 +436,13 @@ void jitter_buff_init(void)
451436 void jitter_put (unsigned char buff[])
452437 {
453438 jitter_wr_pnt = buff[0] & 0x1f;
439+ if (jitter_wr_pnt > 20) return;
454440 memcpy (&jitter_buff[jitter_wr_pnt][0], buff, 13);
455441 jitter_wr_cnt++;
456442 if (jitter_wr_cnt < 0) jitter_wr_cnt = 0;
443+ #ifdef _DEBUG_JITTER
457444 syslog (LOG_INFO, "jitter put %d %d", jitter_wr_pnt, jitter_wr_cnt);
445+ #endif
458446 }
459447
460448 void jitter_putFifo (void)
@@ -464,10 +452,16 @@ void jitter_putFifo (void)
464452
465453 if ((jitter_buff[jitter_wr_pnt][0] != 0xff) && (jitter_buff[jitter_wr_pnt][0] & 0x40))
466454 {
467-syslog(LOG_INFO, "last freame in jitter");
455+ #ifdef _DEBUG_JITTER
456+ syslog(LOG_INFO, "last freame in jitter");
457+ #endif
468458 while (jitter_wr_pnt != jitter_rd_pnt)
469459 {
470- if (jitter_buff[jitter_rd_pnt][0] == 0xff) jitter_buff[jitter_rd_pnt][0] = jitter_rd_pnt;
460+ if (jitter_buff[jitter_rd_pnt][0] == 0xff)
461+ {
462+ jitter_buff[jitter_rd_pnt][0] = jitter_rd_pnt;
463+ inet_read_drop_cnt++;
464+ }
471465 putFifo (13, &jitter_buff[jitter_rd_pnt][0]);
472466 jitter_buff[jitter_rd_pnt][0] = 0x00;
473467 if (jitter_rd_pnt == 0) memcpy (&jitter_buff[jitter_rd_pnt][1], NullVoice, 12);
@@ -490,14 +484,18 @@ syslog(LOG_INFO, "last freame in jitter");
490484 if (jitter_rd_pnt > 20) jitter_rd_pnt = 0;
491485 jitter_wr_cnt--;
492486 }
493-syslog (LOG_INFO, "debug %d %d", jitter_wr_pnt, jitter_rd_pnt);
487+ #ifdef _DEBUG_JITTER
488+ syslog (LOG_INFO, "debug %d %d", jitter_wr_pnt, jitter_rd_pnt);
494489 syslog (LOG_INFO, "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x",
495- jitter_buff[0][0], jitter_buff[1][0],jitter_buff[2][0],jitter_buff[3][0],jitter_buff[4][0],jitter_buff[5][0],jitter_buff[6][0],jitter_buff[7][0],jitter_buff[8][0],jitter_buff[8][0],jitter_buff[10][0],
496- jitter_buff[11][0], jitter_buff[12][0],jitter_buff[13][0],jitter_buff[14][0],jitter_buff[15][0],jitter_buff[16][0],jitter_buff[17][0],jitter_buff[18][0],jitter_buff[19][0],jitter_buff[20][0]);
490+ jitter_buff[0][0], jitter_buff[1][0],jitter_buff[2][0],jitter_buff[3][0],jitter_buff[4][0],
491+ jitter_buff[5][0],jitter_buff[6][0],jitter_buff[7][0],jitter_buff[8][0],jitter_buff[8][0],jitter_buff[10][0],
492+ jitter_buff[11][0], jitter_buff[12][0],jitter_buff[13][0],jitter_buff[14][0],jitter_buff[15][0],
493+ jitter_buff[16][0],jitter_buff[17][0],jitter_buff[18][0],jitter_buff[19][0],jitter_buff[20][0]);
494+ #endif
495+ n = 0;
497496 if (((jitter_wr_pnt + 1) != jitter_rd_pnt) && ((jitter_wr_pnt + 1) != (jitter_rd_pnt + 21)))
498497 {
499498 k = jitter_wr_pnt;
500- n = 0;
501499 while (k != jitter_rd_pnt)
502500 {
503501 if (jitter_buff[k][0] != 0xff)
@@ -509,13 +507,15 @@ syslog (LOG_INFO, "debug %d %d", jitter_wr_pnt, jitter_rd_pnt);
509507 k--;
510508 if (k < 0) k = 20;
511509 }
512-
513-syslog (LOG_INFO, "n:%d\n", n);
510+ #ifdef _DEBUG_JITTER
511+ syslog (LOG_INFO, "n:%d\n", n);
512+ #endif
514513 }
515- if (jitter_wr_cnt > 10)
514+ if (n > 3)
516515 {
517516 while (jitter_rd_pnt != jitter_wr_pnt)
518517 {
518+ if (jitter_buff[jitter_rd_pnt][0] == 0xff) inet_read_drop_cnt++;
519519 jitter_buff[jitter_rd_pnt][0] = jitter_rd_pnt;
520520 putFifo (13, &jitter_buff[jitter_rd_pnt][0]);
521521 jitter_buff[jitter_rd_pnt][0] = 0xff;
@@ -524,18 +524,20 @@ syslog (LOG_INFO, "n:%d\n", n);
524524 jitter_rd_pnt++;
525525 if (jitter_rd_pnt > 20) jitter_rd_pnt = 0;
526526 }
527-#if 0
528- jitter_buff[jitter_wr_pnt][0] = jitter_wr_pnt;
529- putFifo (13, &jitter_buff[jitter_wr_pnt][0]);
530- jitter_buff[jitter_wr_pnt][0] = 0xff;
531- if (jitter_rd_pnt == 0) memcpy (&jitter_buff[jitter_wr_pnt][1], NullVoice, 12);
532- else memcpy (&jitter_buff[jitter_wr_pnt][1], NullVoice1, 12);
533- jitter_rd_pnt = jitter_wr_pnt + 1;
534- if (jitter_rd_pnt > 20) jitter_rd_pnt = 0;
535-#endif
536527 jitter_wr_cnt = 0;
537528 }
538- //if (jitter_wr_pnt >= jitter_rd_pnt) syslog (LOG_INFO, "jitter0 %d", jitter_wr_pnt - jitter_rd_pnt);
539- //else syslog (LOG_INFO, "jitter1 %d", jitter_wr_pnt - jitter_rd_pnt + 1);
540529 }
541530
531+void drop_rate_print (void)
532+{
533+ int rate;
534+
535+ if (inet_read_cnt)
536+ {
537+ rate = (inet_read_drop_cnt * 10000) / inet_read_cnt;
538+ syslog(LOG_INFO, "drop pakcet rate %d.%02d%% (%ld/%ld)",
539+ rate/100, rate%100, inet_read_drop_cnt, inet_read_cnt);
540+ syslog(LOG_INFO, "jitter info. ave:%ldmSec. max:%ldmSec. min:%ldmSec.",
541+ jitter_ave/inet_read_cnt + 20, jitter_max, jitter_min);
542+ }
543+}
--- a/inet_read.c
+++ b/inet_read.c
@@ -12,6 +12,8 @@ void inet_led_onoff(void);
1212 void connected_table(char str[]);
1313 void error_msg (char str[]);
1414 void jitter_put (unsigned char str[]);
15+void jitter_putFifo(void);
16+void rig_send_check(void);
1517
1618 unsigned char recvBuff[64];
1719 char LastFrame0[3] = {0x55, 0x55, 0x55};
@@ -43,65 +45,24 @@ void rig_fifo_check (void)
4345
4446 void dummy_last_frame (void)
4547 {
46- recvBuff[16] = recv_frame_seq;
48+ recvBuff[16] = jitter_rd_pnt;
4749 memcpy (&recvBuff[17], NullVoice, 12);
4850 memcpy (&recvBuff[26], LastFrame0, 3);
49- //putFifo (13, &recvBuff[16]);
5051 jitter_put (&recvBuff[16]);
52+ jitter_putFifo();
5153 recvBuff[16]++;
52- recvBuff[16] %= 015;
54+ if (recvBuff[16] > 20) recvBuff[16] = 0x00;
5355 recvBuff[16] |= 0x40;
5456 memcpy (&recvBuff[17], LastFrame1, 3);
55- //putFifo (13, &recvBuff[16]);
5657 jitter_put (&recvBuff[16]);
5758 memset (inet_frame_id, 0x00, 2);
5859 rig_send_check();
5960 digitalWrite (INET_LED, 0);
6061 digitalWrite (RIG_LED, 0);
6162 rig_last_frame_send = TRUE;
63+ drop_rate_print();
6264 }
6365
64-#if 0
65-void frame_seq_check (void)
66-{
67- unsigned char dummy[13];
68- unsigned char temp1, temp2, temp3;
69-
70- inet_read_cnt++;
71- recv_frame_seq++;
72- recv_frame_seq %= 0x15;
73- if (recv_frame_seq == ((recvBuff[16]) & 0x1f)) return;
74- temp1 = recv_frame_seq;
75- temp2 = 0;
76- temp3 = (recvBuff[16] & 0x1f) % 0x15;
77- while (temp1 != temp3)
78- {
79- #ifdef _DEBUG
80- syslog (LOG_INFO, "insert packet seq. %2.2x recv. %2.2x", temp1, recvBuff[16] & 0x1f);
81- #endif
82- temp2++;
83- temp1++;
84- temp1 %= 0x15;
85- }
86- if (temp2 > 5)
87- {
88- syslog (LOG_INFO, "Many packets droped %d", temp2);
89- dummy_last_frame();
90- return;
91- }
92- while (recv_frame_seq != temp3)
93- {
94- inet_read_drop_cnt++;
95- memcpy (&dummy[1], NullVoice, 12);
96- dummy[0] = recv_frame_seq;
97- if (recv_frame_seq) memcpy (&dummy[10], null_data, 3);
98- putFifo (13, dummy);
99- recv_frame_seq++;
100- recv_frame_seq %= 0x15;
101- }
102-}
103-#endif
104-
10566 void inet_read(void)
10667 {
10768 int length;
@@ -155,7 +116,7 @@ void inet_read(void)
155116 if (!scan_sw) connected_table(recvBuff);
156117 return;
157118 }
158- if (!memcmp (recvBuff, "ERROR", 5))
119+ if (!memcmp (recvBuff, "ERROR", 5) || !memcmp (recvBuff, "MESSG", 5))
159120 {
160121 if (!scan_sw) error_msg (recvBuff);
161122 return;
@@ -222,7 +183,7 @@ void inet_read(void)
222183 #ifdef _DEBUG
223184 if ((recvBuff[16] & 0x1f) > 0x14) syslog (LOG_INFO, "bad seq. info. %2.2x", recvBuff[16]);
224185 #endif
225- //frame_seq_check ();
186+ inet_read_cnt++;
226187 if (recvBuff[16] == 0x00) inet_led_onoff();
227188 if (recvBuff[16] & 0x40)
228189 {
@@ -232,16 +193,9 @@ void inet_read(void)
232193 digitalWrite (INET_LED, 0);
233194 digitalWrite (RIG_LED, 0);
234195 rig_last_frame_send = TRUE;
235- if (inet_read_cnt)
236- {
237- rate = (inet_read_drop_cnt * 10000) / inet_read_cnt;
238- syslog(LOG_INFO, "drop pakcet rate %d.%02d%% (%ld/%ld)",
239- rate/100, rate%100, inet_read_drop_cnt, inet_read_cnt);
240- syslog(LOG_INFO, "jitter info. ave:%ldmSec. max:%ldmSec. min:%ldmSec.",
241- jitter_ave/inet_read_cnt + 20, jitter_max, jitter_min);
242- }
196+ drop_rate_print();
197+ rig_send_check();
243198 }
244- //putFifo (13, &recvBuff[16]);
245199 jitter_put (&recvBuff[16]);
246200 inet_recv_time_save.tv_sec = inet_recv_time.tv_sec;
247201 inet_recv_time_save.tv_usec = inet_recv_time.tv_usec;
@@ -260,12 +214,16 @@ void inet_read(void)
260214 #ifdef _DEBUG
261215 if ((recvBuff[16] & 0x1f) > 0x14) syslog (LOG_INFO, "bad seq. info. %2.2x", recvBuff[16]);
262216 #endif
263- //frame_seq_check ();
264- //recvBuff[16] &= 0x1f;
265- recvBuff[16] |= 0x40;
217+ inet_read_cnt++;
218+ recvBuff[16] &= 0x1f;
219+ memcpy (&recvBuff[17], NullVoice, 12);
266220 memset (&recvBuff[26], 0x55, 3);
221+ jitter_put (&recvBuff[16]);
222+ jitter_putFifo();
223+ recvBuff[16]++;
224+ if (recvBuff[16] > 20) recvBuff[16] = 0x00;
225+ recvBuff[16] |= 0x40;
267226 memcpy (&recvBuff[17], LastFrame1, 3);
268- //putFifo (13, &recvBuff[16]);
269227 jitter_put (&recvBuff[16]);
270228 memset (inet_frame_id, 0x00, 2);
271229 inet_recv_time_save.tv_sec = inet_recv_time.tv_sec;
@@ -279,14 +237,8 @@ void inet_read(void)
279237 digitalWrite (INET_LED, 0);
280238 digitalWrite (RIG_LED, 0);
281239 rig_last_frame_send = TRUE;
282- if (inet_read_cnt)
283- {
284- rate = (inet_read_drop_cnt * 10000) / inet_read_cnt;
285- syslog(LOG_INFO, "drop pakcet rate %d.%02d%% (%ld/%ld)",
286- rate/100, rate%100, inet_read_drop_cnt, inet_read_cnt);
287- syslog(LOG_INFO, "jitter info. ave:%ldmSec. max:%ldmSec. min:%ldmSec.",
288- jitter_ave/inet_read_cnt + 20, jitter_max, jitter_min);
289- }
240+ drop_rate_print();
241+ rig_send_check();
290242 }
291243 }
292244 }
--- a/main.c
+++ b/main.c
@@ -19,7 +19,8 @@ void dmonitor_close(void);
1919 void send_rig_init(void);
2020 int getFifo (unsigned char str[]);
2121 void dummy_last_frame (void);
22-void jitter_purFifo(void);
22+void jitter_putFifo(void);
23+void jitter_buff_init (void);
2324
2425 time_t send_time;
2526
@@ -31,6 +32,7 @@ int main(int argc, char *argv[])
3132 int i;
3233 int k;
3334 int len;
35+ long int l_int;
3436 time_t cur_time;
3537 int ret;
3638 int ret_code;
@@ -44,8 +46,7 @@ int main(int argc, char *argv[])
4446 struct timeval add_time;
4547 struct timeval temp_time;
4648
47- //struct timeval rig_send_time_20mSec;
48- struct timeval rig_send_timeout;
49+ struct timeval rig_send_time_20mSec;
4950
5051 ret = nice (-15);
5152 send_sw = FALSE;
@@ -74,6 +75,11 @@ int main(int argc, char *argv[])
7475 }
7576 len = strlen(argv[1]);
7677 if (len > 8) len = 8;
78+ if (!memcmp (argv[1], "XX0XX", 5))
79+ {
80+ syslog (LOG_ERR, "connect callsing wrong %8.8s", argv[1]);
81+ return 5;
82+ }
7783 memcpy (connect_call, argv[1], len);
7884 dest_address = argv[2];
7985 dest_inet_port = (unsigned short)atoi(argv[3]);
@@ -124,11 +130,12 @@ int main(int argc, char *argv[])
124130 add_time.tv_sec = 1;
125131 add_time.tv_usec = 0;
126132
127- //rig_send_time_20mSec.tv_sec = 0;
128- //rig_send_time_20mSec.tv_usec = 20000;
133+ rig_send_time_20mSec.tv_sec = 0;
134+ rig_send_time_20mSec.tv_usec = 20000;
129135
130- rig_send_timeout.tv_sec = 0;
131- rig_send_timeout.tv_usec = fifo_hold * 20000 - 100000;
136+ l_int = (fifo_hold - 5) * 20000;
137+ inet_recv_timeout.tv_sec = l_int / 1000000;
138+ inet_recv_timeout.tv_usec = l_int % 1000000;
132139
133140 rig_send_time.tv_sec = 0;
134141 rig_send_time.tv_usec = 0;
@@ -149,10 +156,10 @@ int main(int argc, char *argv[])
149156
150157 rig_buff_pnt = 0;
151158 rig_last_frame_send = TRUE;
152- rig_ack_wait = FALSE;
153159
154160 jitter_buff_init();
155161
162+ ptt = 0x00;
156163
157164 while (1)
158165 {
@@ -185,42 +192,33 @@ int main(int argc, char *argv[])
185192 {
186193 send_keep_alive();
187194 }
188-#if 0
189- if ((Fifo_cnt > fifo_hold) && (!rig_send_sw))
190- {
191- rig_send_sw = TRUE;
192- gettimeofday (&rig_send_time, NULL);
193- }
194-#endif
195195 if(rig_send_sw)
196196 {
197- //timeradd (&rig_send_time, &rig_send_time_20mSec, &temp_time);
198- //if (timercmp (&c_time, &temp_time, >))
197+ timeradd (&rig_send_time, &rig_send_time_20mSec, &temp_time);
198+ if (timercmp (&c_time, &temp_time, >))
199199 {
200200 if (send_rig())
201201 {
202- //rig_send_time.tv_sec = temp_time.tv_sec;
203- //rig_send_time.tv_usec = temp_time.tv_usec;
202+ rig_send_time.tv_sec = temp_time.tv_sec;
203+ rig_send_time.tv_usec = temp_time.tv_usec;
204204 }
205205 }
206-#if 0
207206 if ((inet_frame_id[0] != 0x00) || (inet_frame_id[1] != 0x00))
208207 {
209- timeradd (&inet_recv_time, &rig_send_timeout, &temp_time);
208+ timeradd (&inet_recv_time, &inet_recv_timeout, &temp_time);
210209 if (timercmp (&c_time, &temp_time, >))
211210 {
212211 syslog(LOG_INFO, "insert dummy_last_frame");
213- //dummy_last_frame();
214- memset (inet_frame_id, 0x00, 2);
212+ dummy_last_frame();
215213 }
216214 }
217-#endif
218215 }
219216 else
220217 {
221218 fifo_hold = fifo_new_hold;
222- rig_send_timeout.tv_sec = 0;
223- rig_send_timeout.tv_usec = fifo_hold * 20000;
219+ l_int = (fifo_hold - 5) * 20000;
220+ inet_recv_timeout.tv_sec = l_int / 1000000;
221+ inet_recv_timeout.tv_usec = l_int % 1000000;
224222 }
225223 if (scan_sw)
226224 {
@@ -233,7 +231,6 @@ skip:
233231
234232 if (!rig_last_frame_send)
235233 {
236- recv_frame_seq = last_frame_seq;
237234 LastFrameSend();
238235 }
239236 connected_table_clean();
--- a/repeater_scan.c
+++ b/repeater_scan.c
@@ -212,7 +212,7 @@ int main(int argc, char** argv)
212212
213213 ret = daemon (0, 0);
214214 call_fd = fopen (CALL_FILE, "r");
215- fread (connect_call, 8, 1, call_fd);
215+ ret = fread (connect_call, 8, 1, call_fd);
216216 fclose (call_fd);
217217 while (1)
218218 {
--- a/rig_read.c
+++ b/rig_read.c
@@ -12,11 +12,14 @@ int rig_status (void);
1212 void rig_write (int length, unsigned char buff[]);
1313 void rig_led_onoff(void);
1414 void inet_led_onoff(void);
15+int getFifo (char str[]);
16+void jitter_buff_init (void);
1517
1618 char init_pkt[] = {0xff, 0xff, 0xff};
1719 char alive[] = {0x02, 0x02, 0xff};
1820 int gw_on;
1921 unsigned char rig_buff[1024];
22+
2023 time_t rig_alive_send_time;
2124
2225 int rig_init_recv (void)
@@ -83,6 +86,8 @@ enum
8386 void rig(void)
8487 {
8588 time_t cur_time;
89+ char dummy[42];
90+ int length;
8691
8792 switch (rig_state)
8893 {
@@ -102,13 +107,17 @@ void rig(void)
102107 if (rig_init_recv())
103108 {
104109 rig_state = RIG_READ;
105- syslog (LOG_INFO, "RIG(ID-xxPlus) init done");
110+ syslog (LOG_INFO, "RIG(ID-xxPlus) init/re-init done");
106111 memset (inet_frame_id, 0x00, 2);
107112 rig_send_sw = FALSE;
108- Fifo_cnt = 0;
109- rig_ack_wait = FALSE;
110113 rig_buff_pnt = 0;
111114 rig_last_frame_send = TRUE;
115+ jitter_buff_init();
116+ length = 1;
117+ while (length) length = getFifo(dummy);
118+ gettimeofday (&inet_recv_time, NULL);
119+ Fifo_cnt = 0;
120+ rig_send_sw = FALSE;
112121 }
113122 else
114123 {
@@ -121,17 +130,13 @@ void rig(void)
121130 case RIG_READ:
122131 if (!rig_read()) rig_state = RIG_OPEN;
123132 time (&cur_time);
124- if (!rig_ack_wait)
125- {
126- if ((cur_time - rig_alive_send_time) >= 2)
127- {
128- rig_write (3, alive);
129- rig_alive_send_time = cur_time;
130- digitalWrite (RIG_LED, 0);
131- rig_ack_wait = TRUE;
132- }
133- }
134- if ((cur_time - rig_alive_recv) >= 10)
133+ if ((cur_time - rig_alive_send_time) >= 1)
134+ {
135+ rig_write (3, alive);
136+ //rig_alive_send_time = cur_time;
137+ digitalWrite (RIG_LED, 0);
138+ }
139+ if ((cur_time - rig_alive_recv) >= 3)
135140 {
136141 rig_reinit();
137142 }
@@ -149,7 +154,6 @@ void rig_reinit(void)
149154 }
150155 rig_state = RIG_INIT;
151156 rig_buff_pnt = 0;
152- rig_ack_wait = FALSE;
153157 digitalWrite (RIG_LED, 0);
154158 digitalWrite (INET_LED, 0);
155159 }
@@ -175,10 +179,10 @@ int rig_read (void)
175179 rig_close();
176180 return FALSE;
177181 }
178- time (&rig_alive_send_time);
182+ //time (&rig_alive_send_time);
179183 rig_buff_pnt += length;
180184 time (&rig_alive_recv);
181- #ifdef _DEBUG
185+ #ifdef _DEBUG_RIG
182186 syslog (LOG_INFO, "read length:%d (%d) %2.2x", length, rig_buff_pnt, rig_buff[0]);
183187 #endif
184188 }
@@ -191,17 +195,20 @@ int rig_read (void)
191195
192196 if (len == 3)
193197 {
194- #ifdef _DEBUG
195198 if (rig_buff[1] == 0x21)
196199 {
200+ #ifdef _DEBUG_RIG
197201 syslog (LOG_INFO, "ack header:%2.2x seq:%2.2x", rig_buff[1], rig_buff[2]);
202+ #endif
198203 }
199204 else if (rig_buff[1] = 0x03)
200205 {
206+ #ifdef _DEBUG_RIG
201207 syslog (LOG_INFO, "ack keep alive:%2.2x seq:%2.2x", rig_buff[1], rig_buff[2]);
208+ #endif
209+ ptt = rig_buff[2];
202210 }
203- #endif
204- rig_ack_wait = FALSE;
211+
205212 k = rig_buff_pnt - len;
206213 if (k > 0) memmove(&rig_buff[0], &rig_buff[len], k);
207214 rig_buff_pnt = k;
@@ -213,17 +220,15 @@ int rig_read (void)
213220 {
214221 if (rig_buff[2] == seq)
215222 {
216- #ifdef _DEBUG
223+ #ifdef _DEBUG_RIG
217224 syslog (LOG_INFO, "ack voice:%2.2x seq:%2.2x(%2.2x) %2.2x",
218225 rig_buff[1], rig_buff[2], seq & 0xff, rig_buff[3]);
219226 #endif
220- if (rig_buff[3] == 0x00)
221- {
222- seq++;
223- seq &= 0xff;
224- rig_ack_wait = FALSE;
225- }
226- rig_ack_wait = FALSE;
227+ //if (rig_buff[3] == 0x00)
228+ //{
229+ // seq++;
230+ // seq &= 0xff;
231+ //}
227232 k = rig_buff_pnt - len;
228233 if (k > 0) memmove(&rig_buff[0], &rig_buff[len], k);
229234 rig_buff_pnt = k;
@@ -231,10 +236,10 @@ int rig_read (void)
231236 }
232237 else
233238 {
234- seq = rig_buff[2] + 1;
235- seq &= 0xff;
239+ //seq = rig_buff[2] + 1;
240+ //seq &= 0xff;
236241 }
237- #ifdef _DEBUG
242+ #ifdef _DEBUG_RIG
238243 syslog(LOG_INFO, "ack seq error %2.2x %2.2x %2.2x", rig_buff[2], seq, rig_buff[3]);
239244 #endif
240245 }
@@ -324,7 +329,7 @@ int rig_read (void)
324329 m_seq++;
325330 m_seq &= 0xffff;
326331 }
327- #ifdef _DEBUG
332+ #ifdef _DEBUG_RIG
328333 else
329334 {
330335 syslog (LOG_INFO, "ack length:%d", len);
@@ -341,21 +346,45 @@ int rig_read (void)
341346 rig_buff_pnt = k;
342347 }
343348 error_msg_sw = FALSE;
349+
350+ if ((Fifo_cnt > (fifo_hold + 20)) || (Fifo_cnt < 0))
351+ {
352+ syslog (LOG_INFO, "rig fifo overflow");
353+ rig_state = RIG_INIT;
354+ drop_rate_print();
355+ }
344356 return TRUE;
345357 }
346358
347359 void rig_write (int length, unsigned char buff[])
348360 {
349361 int ret;
362+
363+ if (length == 17)
364+ {
365+ seq++;
366+ seq &= 0xff;
367+ recv_frame_seq = buff[3];
368+ }
369+
350370 ret = write (rig_fd, buff, length);
351371 if (ret == -1)
352372 {
353373 syslog(LOG_ERR, "rig write error %s", strerror(errno));
354374 }
355- //time (&rig_alive_send_time);
356- #ifdef _DEBUG
375+ time (&rig_alive_send_time);
376+ #ifdef _DEBUG_RIG
357377 syslog (LOG_INFO, "rig_write %d %d %2.2x %2.2x", length, ret, buff[2], buff[3]);
358378 #endif
379+ #ifdef _DEBUG_RIG_9
380+ if (length == 17)
381+ {
382+ syslog (LOG_DEBUG,
383+ "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %d",
384+ buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6], buff[7], buff[8], buff[9], buff[10],
385+ buff[11], buff[12], buff[13], buff[14], buff[15], buff[16], Fifo_cnt);
386+ }
387+ #endif
359388 }
360389
361390 void send_rig_init (void)
旧リポジトリブラウザで表示