summaryrefslogtreecommitdiff
path: root/protocol/adb.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-09-19 12:05:47 +0900
committertmk <nobody@nowhere>2012-09-19 12:05:47 +0900
commitdd0017558e8c582760d9eb0adb2c12a04765b4c5 (patch)
tree067437a4366a8995f7b8cccb662172fa2d00f174 /protocol/adb.c
parentf1a64fc959f96fda5cce5c6aff94db867ba769b5 (diff)
ad hoc fix for wrong bit read problem of adb.c.
Diffstat (limited to 'protocol/adb.c')
-rw-r--r--protocol/adb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/protocol/adb.c b/protocol/adb.c
index d60b8608b1..d7105b3a9a 100644
--- a/protocol/adb.c
+++ b/protocol/adb.c
@@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <stdbool.h>
#include <util/delay.h>
#include <avr/io.h>
+#include <avr/interrupt.h>
#include "adb.h"
@@ -85,8 +86,13 @@ uint16_t adb_host_kbd_recv(void)
return 0; // No data to send
if (!read_bit()) // Startbit(1)
return -2;
+
+ // ad hoc fix: without block inerrupt read wrong bit occasionally and get keys stuck
+ cli();
data = read_byte();
data = (data<<8) | read_byte();
+ sei();
+
if (read_bit()) // Stopbit(0)
return -3;
return data;