konradr / rpms / grub2

Forked from rpms/grub2 6 years ago
Clone
31004e6
From 259d86f862615a6135d96553768b564785f56a30 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
f74b50e
Subject: [PATCH 136/482] 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
-- 
31004e6
1.8.2.1
a5bd9f6