X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=protocol%2Fadb.c;h=d7105b3a9ae5b44564088f2923ea290da7c67113;hb=8a81986191ba797a8501cd7b3f8a0e9b58b5b30e;hp=116f612721abcad03c8da8866122ee9ffe34d2a6;hpb=f4125707399d11a7d80587659c464b9bcddb8c56;p=max%2Ftmk_keyboard.git diff --git a/protocol/adb.c b/protocol/adb.c index 116f6127..d7105b3a 100644 --- a/protocol/adb.c +++ b/protocol/adb.c @@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #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; @@ -381,7 +387,6 @@ Keyboard Data(Register0) You can read the state from PSW line(active low) however the switch has a special scancode 0x7F7F, so you can also read from Data line. It uses 0xFFFF for release scancode. - Release code seems to delay about some 100ms. Due to Mac soft power? Keyboard LEDs & state of keys(Register2) This register hold current state of three LEDs and nine keys.