|
|
f96e0b |
From abeaa68b6a8318786ec2b9e642f328e7ca67c165 Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Mon, 21 Jan 2013 14:55:30 +0100
|
|
|
f96e0b |
Subject: [PATCH 128/482] Improve spkmomdem reliability by adding a
|
|
|
f96e0b |
separator between bytes.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 4 ++++
|
|
|
f96e0b |
util/spkmodem-recv.c | 11 ++++++++---
|
|
|
f96e0b |
2 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index ff29177..3c7552b 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,3 +1,7 @@
|
|
|
f96e0b |
+2013-01-21 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ Improve spkmomdem reliability by adding a separator between bytes.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
2013-01-21 Colin Watson <cjwatson@ubuntu.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
* grub-core/partmap/msdos.c (embed_signatures): Add the signature of
|
|
|
f96e0b |
diff --git a/util/spkmodem-recv.c b/util/spkmodem-recv.c
|
|
|
f96e0b |
index 9075f9a..9083c1a 100644
|
|
|
f96e0b |
--- a/util/spkmodem-recv.c
|
|
|
f96e0b |
+++ b/util/spkmodem-recv.c
|
|
|
f96e0b |
@@ -24,7 +24,7 @@
|
|
|
f96e0b |
/* Usage: parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */
|
|
|
f96e0b |
|
|
|
f96e0b |
#define SAMPLES_PER_TRAME 240
|
|
|
f96e0b |
-#define FREQ_SEP_MIN 6
|
|
|
f96e0b |
+#define FREQ_SEP_MIN 5
|
|
|
f96e0b |
#define FREQ_SEP_MAX 15
|
|
|
f96e0b |
#define FREQ_DATA_MIN 15
|
|
|
f96e0b |
#define FREQ_DATA_THRESHOLD 25
|
|
|
f96e0b |
@@ -32,6 +32,7 @@
|
|
|
f96e0b |
#define THRESHOLD 500
|
|
|
f96e0b |
|
|
|
f96e0b |
#define DEBUG 0
|
|
|
f96e0b |
+#define FLUSH_TIMEOUT 1
|
|
|
f96e0b |
|
|
|
f96e0b |
static signed short trame[2 * SAMPLES_PER_TRAME];
|
|
|
f96e0b |
static signed short pulse[2 * SAMPLES_PER_TRAME];
|
|
|
f96e0b |
@@ -70,15 +71,18 @@ main ()
|
|
|
f96e0b |
int bitn = 7;
|
|
|
f96e0b |
char c = 0;
|
|
|
f96e0b |
int i;
|
|
|
f96e0b |
+ int llp = 0;
|
|
|
f96e0b |
while (!feof (stdin))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (lp > 20000)
|
|
|
f96e0b |
+ if (lp > 3 * SAMPLES_PER_TRAME)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- fflush (stdout);
|
|
|
f96e0b |
bitn = 7;
|
|
|
f96e0b |
c = 0;
|
|
|
f96e0b |
lp = 0;
|
|
|
f96e0b |
+ llp++;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
+ if (llp == FLUSH_TIMEOUT)
|
|
|
f96e0b |
+ fflush (stdout);
|
|
|
f96e0b |
if (f2 > FREQ_SEP_MIN && f2 < FREQ_SEP_MAX
|
|
|
f96e0b |
&& f1 > FREQ_DATA_MIN && f1 < FREQ_DATA_MAX)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -100,6 +104,7 @@ main ()
|
|
|
f96e0b |
c = 0;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
lp = 0;
|
|
|
f96e0b |
+ llp = 0;
|
|
|
f96e0b |
for (i = 0; i < SAMPLES_PER_TRAME; i++)
|
|
|
f96e0b |
read_sample ();
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|