a5bd9f6
From c769c9030bec4ec97310bf93e440020b83d8f100 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Mon, 21 Jan 2013 21:05:33 +0100
a5bd9f6
Subject: [PATCH 135/364] Improve spkmodem reliability by adding a separator
a5bd9f6
 between bytes.
a5bd9f6
a5bd9f6
---
a5bd9f6
 grub-core/term/spkmodem.c | 14 +++++++-------
a5bd9f6
 1 file changed, 7 insertions(+), 7 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/grub-core/term/spkmodem.c b/grub-core/term/spkmodem.c
a5bd9f6
index 5bff429..f20a27d 100644
a5bd9f6
--- a/grub-core/term/spkmodem.c
a5bd9f6
+++ b/grub-core/term/spkmodem.c
a5bd9f6
@@ -70,12 +70,7 @@ put (struct grub_term_output *term __attribute__ ((unused)), const int c)
a5bd9f6
 {
a5bd9f6
   int i;
a5bd9f6
 
a5bd9f6
-  if (!inited)
a5bd9f6
-    {
a5bd9f6
-      make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 50, 20);
a5bd9f6
-      inited = 1;
a5bd9f6
-    }
a5bd9f6
-
a5bd9f6
+  make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 200, 4);
a5bd9f6
   for (i = 7; i >= 0; i--)
a5bd9f6
     {
a5bd9f6
       if ((c >> i) & 1)
a5bd9f6
@@ -84,12 +79,17 @@ put (struct grub_term_output *term __attribute__ ((unused)), const int c)
a5bd9f6
 	make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 4000, 40);
a5bd9f6
       make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 1000, 10);
a5bd9f6
     }
a5bd9f6
-  make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 50, 0);
a5bd9f6
+  make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 200, 0);
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
 static grub_err_t
a5bd9f6
 grub_spkmodem_init_output (struct grub_term_output *term)
a5bd9f6
 {
a5bd9f6
+  /* Some models shutdown sound when not in use and it takes for it
a5bd9f6
+     around 30 ms to come back on which loses 3 bits. So generate a base
a5bd9f6
+     200 Hz continously. */
a5bd9f6
+
a5bd9f6
+  make_tone (GRUB_SPEAKER_PIT_FREQUENCY / 200, 0);
a5bd9f6
   grub_terminfo_output_init (term);
a5bd9f6
 
a5bd9f6
   return 0;
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6