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

Infinity Keyboard doesn't work on OS X; works on Windows and Linux #266

Closed
kevinmost opened this issue Nov 4, 2015 · 17 comments
Closed

Comments

@kevinmost
Copy link

Note: I am building this firmware on Ubuntu Linux because I can't seem to get the toolchain working properly on OS X.

Tested on a Macbook running 10.10 and a Macbook running 10.11. Neither device will detect the Infinity Keyboard when it's plugged in. Pressing the flash button on the bottom does put the device into bootloader mode, and then dfu-util can flash a firmware from OS X successfully.

Flashing the stock Kiibohd firmware that came with the Infinity makes the device work on all OSes, including OS X. Flashing tmk-keyboard results in a device that works on Linux and Windows, but not OS X.

On OS X, however, it seems like even when the keyboard is unresponsive, it will show up in lsusb.

lsusb output when the kiibohd firmware is installed:

Bus 020 Device 004: ID 05ac:0259 Apple Inc. Apple Internal Keyboard / Trackpad  
Bus 020 Device 002: ID 0a5c:4500 Broadcom Corp. BRCM20702 Hub  
Bus 020 Device 008: ID 05ac:8289 Apple Inc. Bluetooth USB Host Controller  
Bus 020 Device 023: ID 1c11:b04d 1c11 Keyboard - MD1 PartialMap pjrcUSB full  Serial: Clean master - 2015-11-01 17:19:09 -0800
Bus 000 Device 001: ID 1d6b:ILPT Linux Foundation USB 3.0 Bus

lsusb output when the tmk firmware is installed:

Bus 020 Device 004: ID 05ac:0259 Apple Inc. Apple Internal Keyboard / Trackpad
Bus 020 Device 002: ID 0a5c:4500 Broadcom Corp. BRCM20702 Hub
Bus 020 Device 008: ID 05ac:8289 Apple Inc. Bluetooth USB Host Controller
Bus 020 Device 025: ID feed:abed feed mbed  Serial: 0
Bus 000 Device 001: ID 1d6b:ILPT Linux Foundation USB 3.0 Bus

Let me know if there's any more info I can provide and I will provide it ASAP. I'd really like to get this working on OS X

@tmk
Copy link
Owner

tmk commented Nov 4, 2015

Thanks for the report.
Yeah, someone also reported exact problem on OSX. I guess there is something wrong related to USB3 or Mac OS X. This problem is specific to tmk/mbed protocol, the latest mbed version may fix this, I'll update mbed code some later.

Now flabbergast's tmk/chibios protocol is also available for Infinity60, it probably works on OSX. See this comment.
#261 (comment)

@kevinmost
Copy link
Author

I tried the ChibiOS build and while it is detected on OS X, all my keys were transcribed over one to the left! Maybe something wrong with the matrix setup or something?

Also, the ChibiOS was detected on OS X but not Linux! :(

@tmk
Copy link
Owner

tmk commented Nov 5, 2015

Ah, my Infinity60 is prototype and has different matrix than production model. My code is configured for it. comment out this line.
https://github.com/tmk/tmk_keyboard/blob/flabbergast-tmk_chibios/keyboard/infinity_chibios/config.h#L55

(Infinity is one of InputClub's brand?, they call their boards as Inifinty 60% and Infinity ergodox, confusing now :D )

@tmk
Copy link
Owner

tmk commented Nov 5, 2015

Really sure?
I confirmed on Linux. It should work on Linux.

Also, the ChibiOS was detected on OS X but not Linux! :(

@kevinmost
Copy link
Author

Commenting that line out makes it work on OS X now, thanks! 👍

But yeah, I did test it on Linux and it won't work. I built and flashed the firmware from Linux because, again, I can't get the build setup working right on OS X yet. But after building and flashing from this device, it's not responding as a keyboard... but is responding perfectly on my Mac!

Output of lsusb from the Linux device:

Bus 003 Device 002: ID 8087:8001 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 04ca:7049 Lite-On Technology Corp. 
Bus 001 Device 004: ID 8087:0a2a Intel Corp. 
Bus 001 Device 003: ID 138a:0017 Validity Sensors, Inc. 
Bus 001 Device 002: ID 04f3:012d Elan Microelectronics Corp. 
Bus 001 Device 012: ID feed:6464  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

@kevinmost
Copy link
Author

I can actually build it on OS X when I use the ChibiOS variant! Very exciting. :)

My Linux box still won't let me type with the keyboard, unfortunately. It's Ubuntu 15.04. Maybe it's the 3.x kernel or something?

@tmk
Copy link
Owner

tmk commented Nov 5, 2015

I'm also on 15.04 and I confirmed the problem.
To startup keyboard hid_listen console is needed for some reason. This problem is related to debug print, I'll look into further.

For a while workaround is disabling console function by commenting out this in Makefile.

#CONSOLE_ENABLE = yes   # Console for debug

@kevinmost
Copy link
Author

Nice, that worked! Thanks so much for all the help. If anyone else stumbles upon this issue and is looking for a solution, the way to get your Infinity60 working on OS X and Linux (and you can even build on OS X!):

Check out the flabbergast-tmk_chibios branch.

cd tmk_core/tool/chibios

git clone -b kinetis https://github.com/flabbergast/ChibiOS.git chibios

Go back to the keyboard/infinity_chibios folder

Edit the config.h and comment out #define INFINITY_PROTOTYPE

Edit the Makefile and comment out CONSOLE_ENABLE = yes

Now make clean && make and you have a built .bin that can be flashed with dfu-util. :)

@kaansoral
Copy link

Thanks a lot for this info, I will use it to convert my infinities to tmk's when I can find some free time

flabbergast is such a life saver too :)

@kevinmost
Copy link
Author

Also should point out, I had some issues with lag in the keyboard once I moved to the ChibiOS build; I thought maybe ChibiOS wasn't as responsive as mbed was or something? But it turns out that if you look in the config.h for the infinity_chibios folder, there's a line #define DEBOUNCE 5. I think that setting that to #define DEBOUNCE 0 has removed the feeling of "lag" for me. I probably was typing too fast for that setting and it was missing some keystrokes for me.

@tmk
Copy link
Owner

tmk commented Nov 13, 2015

OK. I confirmed the key drop problem. Slow scan casues it.
See this issue #268 to solve it.

@kevinmost
Copy link
Author

Oh, glad I'm not going crazy! I'm going to remove that line and try it out for a few days and see if it makes it better. I think setting the debounce to 0 did make it better but it's still not perfect, so I'll try what you mentioned in #268

@kevinmost
Copy link
Author

Seems to be working much better, thanks @tmk for pointing me towards that delay line in the ChibiOS firmware. Everything is working fine with it removed and I'm making a lot less typos!

@flabbergast
Copy link
Contributor

I'll have a look at the original hid_listen/console problem (on a freescale board with a hw debugger) soon.

I also apologise for the needless delay in the main loop - I put it there pretty much during the development just so that the firmware doesn't "needlessly" run a full busy wait loop; I even documented it somewhere, but then forgot about it. When I saw this issue I realised that that's the problem, but you guys are faster ;)

flabbergast added a commit to flabbergast/tmk_keyboard that referenced this issue Dec 18, 2015
@flabbergast
Copy link
Contributor

Hopefully fixed the console problem. Now writing to the console queue has 5us timeout - so when it's full, the function returns after 5us.

The root of the problem is (I think) that Linux handles RAW HID endpoints differently than OS X or Windows - the latter two still accept data over them, even if nobody's listening (which meant that the fw could keep pushing and the console output queue never got stuck); but Linux only does this after at least one someone has listened. Hence running hid_listen on linux got the queue "unstuck" and the firmware then could happily continue correctly.

Anyway, another of my silly mistakes.

@tmk
Copy link
Owner

tmk commented Dec 19, 2015

Thanks, I'll pull that fix later.
flabbergast@a75834e

Good to know the different behaviours among OSes, it makes sense indeed.
Some users reported that console function on LUFA causes stack in UEFI or failure on resuming from sleep, I'll have to look into that problems.

@tmk tmk added the TODO label Dec 19, 2015
kairyu pushed a commit to kairyu/tmk_keyboard that referenced this issue Jun 14, 2016
tenderlove pushed a commit to tenderlove/tmk_keyboard that referenced this issue Aug 13, 2016
* Modularity and gcc warnings fixes.

* Add ChibiOS support (USB stack + support files).

* Make usb_main more USB_DRIVER #define independent.

* Move chibios to tool.

* Implement jump-to-bootloader.

* Small updates.

* Fix bootloader-jump compiling.

* Move AVR specific sleep_led.c into avr.

* Add basic sleep_led for chibios.

* Update chibios README.

* NKRO fixes.

* Rename some Makefile defines.

* Move STM32 bootloader address config to separate .h file.

* Add ARM Teensies bootloader code.

* Fix chibios/usb_main GET_REPORT handing.

* Add missing #include to keymap.c.

* Make bootmagic.c code portable (_delay_ms -> wait_ms).

* Move declaration of keymap_config.

Should really not declare variables in .h files - since it's included
in different .c files, a proper linker then complains that the same
variable is declared more than once (once for each .c file that the
offending .h is included in).

* Add eeprom support for chibios/kinetis.

* Rename chibios example keyboard.

* Move chibios/cortex selection to local Makefiles.

* Chibios: use WFI in idle. WIP suspend stuff.

* ChibiOS/kinetis: sending remote wakeup.

* ChibiOS/STM32: send remote wakeup.

* Fix report size of boot protocol.

* Fix drop key stroke

Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.

Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.

* Chibios/usb_main: rename a variable for clarity.

* Add correct chibios/bootloader_jump for infinity KB.

* ChibiOS: make reset request more CMSISy.

* Chibios: Add breathing sleep LED on Kinetis MCUs.

* ChibiOS: Update infinity bootloader code to match updated ChibiOS.

* ChibiOS: prettify/document sleep_led code.

* Chibios: Remove the wait in the main loop.

* Add maple mini code.

* Do timeout when writing to CONSOLE EP queue.

Fixes TMK bug tmk#266.

* Chibios: add 'core/protocol' to the makefiles' search path.

* Chibios: Update to new USB API.

* Chibios: add more guards for transmitting (fix a deadlock bug).

* Add update for chibios in README

* Chibios: Fix a HardFault bug (wait after start).

* Chibios: cleanup usb_main code.

* Chibios: Revert common.mk change (fix AVR linking problem).

* core: Fix chibios user compile options

Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS.

* Sysv format for ChibiOS arm-none-eabi-size

Some new patches to ChibiOS puts heap as it's own section. So the
berkeley format is now useless, as the heap will be included in the
BSS report. The sysv format displays the bss size correctly.

* Fix hard-coded path of CHIBIOS

* Add support for new version of ChibiOS and Contrib

The Kinetis support has moved to a separate Contrib repository in
the newest version of Chibios. There has also been some structure
changes. So this adds support for those, while maintaining back-
wards compability.

* Update ChibiOS instructions

* Chibios: implement sleep LED for STM32.

* Chibios: Update the main chibios README.

* Chibios: fix STM32_BOOTLOADER_ADDRESS name.

* Chibios: make the default bootloader_jump redefinable (weak).

* Chibios: disable LTO (link-time optimisation).

With LTO enabled, sometimes things fail for mysterious reasons
(e.g. bootloader jump on WF with LEDs enabled), just because the
linker optimisation is too aggressive.

* Chibios: add default location for chibios-contrib.

* ChibiOS: update mk to match chibios/master.

* ChibiOS: update instructions.md.

* Add chibi_onekey example.

* Add comments to chibi_onekey Makefile.

* Rename some Makefile defines.

* Move STM32 bootloader address config to separate .h file.

* Rename chibios example keyboard.

* Move chibios/cortex selection to local Makefiles.

* Add Teensy LC onekey example.

* Chibios: use WFI in idle. WIP suspend stuff.

* Update chibi/teensy instructions.

* Update chibios/Teensy instructions.

* Add infinity_chibios

* Add keymap_hasu.c

* Infinity_chibios: select correct bootloader_jump.

* Infinity_chibios: improve comments.

* Add generic STM32F103C8T6 example.

* Add maple mini code.

* STM32F103x fixes.

* Add maple mini pinout pic.

* Chibios: updates for 3.0.4 git.

* Chibios: rename example stm32_onekey -> stm32_f072_onekey.

* Chibios: add makefiles for Teensy 3.x examples.

* Chibios: update Teensy 3.x instructions.

* Chibios: Tsy LC is cortex-m0plus.

* Chibios: add more guards for transmitting (fix a deadlock bug).

* Change README for chibios

* Chibios: update examples to current chibios git.

Match the changes in mainline chibios:
 - update chconf.h
 - update supplied ld scripts structure
 - update Teensy instructions (switch to official
    chibios and introduce contrib)

* Add ChibiOS and ChibiOS-Contrib submodules

Also fix the makefile path for them.

* Moves chibios keyboards to keyboards folder

* First version of ChibiOS compilation

Only the stm32_f072_onkey keyboard is ported at the moment. It
compiles, but still doesn't link.

* More chibios fixes

It now compiles without warnings and links

* Move the teensy_lc_onekey to the keyboards folder

* Clean up the make file rule structure

* Remove keymap_fn_to_action

* Update more ChibiOS keyboards to QMK

Most of them does not compile at the moment though.

* Use older version of Chibios libraries

The newest ones have problems with compilation

* Remove USB_UNCONFIGURED event

It isn't present in the older version of ChibiOS

* Fix the infinity_chibios compilation

* Fix potentially uninitialized variable

* Add missing include

* Fix the ChibiOS makefile

* Fix some Chibios keyboard compilation

* Revert the rules.mk file back to master version

* Combine the chibios and AVR makefiles

With just the required overrides in the respective platform
specific one.

* Slight makefile restrucuring

Platform specific compiler options

* Move avr specific targets out of the main rules

* Fix ChibiOS objcopy

The ChibiOS objcopy needs different parameters, so the parameters
are moved to the corresponding platform rule file

* Fix the objcopy for real this time

The comands were moved around, so chibios used avr and the ohter
way around.

Also change the objsize output format

* Fix the thumb flags

* Fix the infinity hasu keymap

* Per platform cpp flags

* Add gcc-arm-none-eabi package to travis

* Add arm-none-eabi-newlib to travis

* Fix the name of the libnewlib-arm-none-eabi lib

* Fix the ChibiOS paths

So that they are properly relative, and builds don't generate
extra folders

* Fix the board path of stm32_f103_onekey

* Only consider folders with Makefiles as subproject
@phoenixeliot
Copy link

Is this issue still unresolved? I'm having very strange problems with my newly assembled Infinity Ergodox, and they only happen on macOS. Certain keys only update their state if other keys are pressed or released. (eg ; and ' will only update keyup/keydown state if the J, K, or L key is pressed afterward). The keys behave normally on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants