Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: ADB-USB converter misses keystrokes #14

Closed
tmk opened this issue Nov 23, 2012 · 8 comments
Closed

Fixed: ADB-USB converter misses keystrokes #14

tmk opened this issue Nov 23, 2012 · 8 comments
Labels

Comments

@tmk
Copy link
Owner

tmk commented Nov 23, 2012

2013/11/15

The problem is very complicated and comprised of various possible causes.

missing ADB singnal with interrupts by USB

During handle ADB signal the code have to be guraded from USB or other interrupts with cli(). Both receive and send signal codes needs this gurad in adb.c.
http://geekhack.org/index.php?topic=14290.msg1118206#msg1118206

mis-handle of two key events in an ADB transaction

Both of down and up event of a key can be sent with same one 16-bit ADB packet.

preventing keyboard from scaning matrix with high rate of ADB polling

If converter polls too frequently keyboard has to consume lots of controller cycles to respond to the requests and could miss change of key switch in the result. Older keyboard tends to suffer from this severely. 12ms is proper interval.
http://geekhack.org/index.php?topic=14290.msg1118206#msg1118206

Original description

This was not accurate at all:

At commit:38effe4ae4a691dcf034c31f67d1bdb2156ba7f5 the converter has this problem,
while old commit:33d58c2b5647623d2b07a210ef97a27920e5563e doesn't have it.

@tmk
Copy link
Owner Author

tmk commented Dec 12, 2012

AppleIIGS keyboard and M0116 suffer severely from this issue, while Extended keyboards M0115 and M3501 doesn't seem like so bad. Though it may depend on type speed. In my speed 50-60wpm with Extended keyboard I don't feel big problem.

Some ADB keyboards seem to have little key buffers so I guess we'll need to poll the keyboards much faster.

tmk pushed a commit that referenced this issue Apr 9, 2013
@tmk tmk closed this as completed Apr 9, 2013
@tmk
Copy link
Owner Author

tmk commented Apr 9, 2013

After stop bit of talk command it waits for start bit of data longer(255 to 500us) now.

@@ -88,19 +89,24 @@ uint16_t adb_host_kbd_recv(void)
     attention();
     send_byte(0x2C);            // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00)
     place_bit0();               // Stopbit(0)
-    if (!wait_data_lo(0xFF))    // Tlt/Stop to Start(140-260us)
+    if (!wait_data_lo(500)) {   // Tlt/Stop to Start(140-260us)
         return 0;               // No data to send

@tmk
Copy link
Owner Author

tmk commented Oct 4, 2013

IIgs and M0116 keyboards still sometime drop key stroke when pressing same key successively.
Not sure this is bug but firmware is not perfect in fact and could still have some bugs.

http://geekhack.org/index.php?topic=14290.msg1064533#msg1064533

This problem is not so severe than it used to be before the fix. To me it seems to be almost no problem for normal typing. My typing wpm is around 60.

@tmk tmk reopened this Oct 4, 2013
@tmk
Copy link
Owner Author

tmk commented Oct 4, 2013

Still key drop is thre. It must be bug. Looks like code is need to be rewritten from scratch completely
and check signal with scope to conform to the spec.

http://geekhack.org/index.php?topic=14290.msg1064567#msg1064567

@tmk
Copy link
Owner Author

tmk commented Oct 8, 2013

With interval between scans it seems the problem is gone or mitigated dramatically.

http://geekhack.org/index.php?topic=14290.msg1068919#msg1068919

tmk pushed a commit that referenced this issue Oct 8, 2013
- Add delay between scans to prevent overlaod of ADB keyboard controllers
- <http://geekhack.org/index.php?topic=14290.msg1068919#msg1068919>
@tmk
Copy link
Owner Author

tmk commented Oct 9, 2013

ADB scan rates of old Mac'. 12ms seems to be safe.
http://geekhack.org/index.php?topic=14290.msg1070139#msg1070139

@tmk
Copy link
Owner Author

tmk commented Oct 18, 2013

Fixed with this commit: c18c52f

Plz report if you still suffer from this.

@tmk
Copy link
Owner Author

tmk commented Nov 28, 2013

Finally fixed at d2a83da

http://geekhack.org/index.php?topic=14290.msg1134847#msg1134847

Thank you gblargg!

@tmk tmk closed this as completed Jan 19, 2015
lxol pushed a commit to lxol/tmk_keyboard that referenced this issue Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant