tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
4k stars 1.71k forks source link

USB protocol stack behaviour on boot time or BIOS #58

Closed tmk closed 8 years ago

tmk commented 11 years ago

I didn't test my firmware under boot/reboot, BIOS or boot selector like ntldr, grub and etc, and my code is not completely conformed to USB/HID spec. So I'm sure problems can remain to exist in my code.

NOTE: This issue comes form my work, not original PJRC/LUFA. I must say this for honor of them.

tmk commented 11 years ago

PJRC stack doesn't work on Windows after reboot:

http://geekhack.org/index.php?topic=41989.msg1032558#msg1032558

Well, I have the keyboard working now, and I've only come across one issue I haven't been able to figure out: If the keyboard is plugged in when the computer is restarted (or shut down and powered up), windows ignores the input. I can use hid_listen and watch all the debug info, so I know the keyboard is working, windows just seems to be ignoring it. I can also duplicate this behavior on my laptop. Both computers are running Windows 7 x64. Unplugging the keyboard and plugging it back in restores it's full functionality. This problem does not happen if I boot with Ubuntu.

http://geekhack.org/index.php?topic=41989.msg1033644#msg1033644

EDIT: Rebuilding with the LUFA stack instead of PJRC has eliminated this problem.

cub-uanic commented 11 years ago

I can confirm that I have same problem with Ergodox (on my fork). I use it with Debian. I can use kbd in BIOS and in Grub, but after system is loaded - I have to re-plug kbd to get it working.

I never had such problem with Ben's firmware.

Currently I use PJRC stack and never tried to use LUFA stack. I'll let you know about results with LUFA when I'll try it.

tmk commented 11 years ago

Using PJRC stack and Windows7 I also confirmed keyboard function doesn't work after reboot(but mouse function still worked). And resuming from sleep with keyboard(remote wakeup) only worked once, not after second.

LUFA stack has no problem on reboot and resuming.(I can resume computer four times in a row.) On BIOS configuration and bootloader(ntldr) both stacks seem to have no problem.

LUFA seems to has no problem on these. You are recommended to use LUFA stack. I made the transition to firmware built with LUFA stack and don't use PJRC stack recently. I recommend to use LUFA for your project now. There is no reason to hesitate to use LUFA except for binary size(about 1KB lager?). LUFA finally got support for NKRO recently, nothing prevents from using LUFA instead of PJRC now.

EDIT: I found and fixed problems; #114 and #115. 04/21/2014

yeeeargh commented 11 years ago

I used the PJRC stack till around july (when you said in [tmk_keyboard] USB spec confromance (#50) that you won't update the PJRC stat anymore). Until than PJRC worked great for me. But I don't know the exact commit which introduced that bug, because I switched to LUFA after that commit.

cub-uanic commented 11 years ago

I'd like to use LUFA, and even created Makefile for it: https://github.com/cub-uanic/tmk_keyboard/commit/f5f7a1793a27b18e87d0aa4692cd6ec94067978d

But unfortunately, it doesn't work for me: keyboard constantly rebooting (I see this with leds). I tried it with "-DBOOTLOADER_SIZE=4096" too, with same result. What I'm doing wrong?

tmk commented 11 years ago

umm, I can't come up with reasonable causes of the problem instantly so far. If I were you I would comment out all build options in Makefile and see the result at first. And then try another USB port or remove all drivers of the keyboard on Device Managet in particular if you are on Windows.

tmk commented 10 years ago

I fixed two problems of LUFA stack I found at commit 894a387; #114 and #115

The problem of PJRC stack won't be fixed probably. Use LUFA.

T045T commented 9 years ago

From the comments, it looks like this is no longer really an issue if I use LUFA - is that right?

tmk commented 9 years ago

Yes, it should be ok.