platformio / platform-teensy

Teensy: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/teensy
Apache License 2.0
91 stars 48 forks source link

TeensyLoaderCLI won't upload anymore when Karabiner Elements is installed on OSX Sierra #23

Closed mgcrea closed 5 years ago

mgcrea commented 7 years ago

Not sure what changed on my machine (up-to-date OSX on Sierra) but uploading sketches with pio run -t upload -e teensy30 -v via CLI does not work anymore, looks like the script does not see the teensy:

$ pio run -t upload -e teensy30 -v
[Mon May 22 18:28:08 2017] Processing teensy30 (platform: teensy, board: teensy30, framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Collected 90 compatible libraries
Looking for dependencies...
Project does not have dependencies
arm-none-eabi-g++ -o .pioenvs/teensy30/firmware.elf -Os -Wl,--gc-sections,--relax -mthumb -mcpu=cortex-m4 -Wl,--defsym=__rtc_localtime=1495470488 -fsingle-precision-constant --specs=nano.specs -Wl,-T"mk20dx128.ld" .pioenvs/teensy30/src/main.o -L/Users/olivier/.platformio/packages/framework-arduinoteensy/cores/teensy3 -L.pioenvs/teensy30 -Wl,--start-group .pioenvs/teensy30/libFrameworkArduino.a -lm -lc -lgcc -larm_cortexM4l_math -Wl,--end-group
Checking program size
text       data     bss     dec     hex filename
11040       168    2032   13240    33b8 .pioenvs/teensy30/firmware.elf
arm-none-eabi-objcopy -O ihex -R .eeprom .pioenvs/teensy30/firmware.elf .pioenvs/teensy30/firmware.hex
teensy_loader_cli -mmcu=mk20dx128 -w -s -v .pioenvs/teensy30/firmware.hex
Teensy Loader, Command Line, Version 2.1
Read ".pioenvs/teensy30/firmware.hex": 11208 bytes, 8.6% usage
Error opening HID Manager
Soft reboot is not implemented for OSX
Waiting for Teensy device...
(hint: press the reset button

Hitting the reset button only turns the teensy off (flash mode), but the CLI stays stuck. Used to work fine a few weeks ago.

Uploading via GUI (auto-opened with Arduino.app) is working fine.

Using latest teensy_loader_cli built from source, I get the following output:

$ /Users/olivier/Developer/teensy/teensy_loader_cli/teensy_loader_cli  -mmcu=mk20dx128 -w -s -v .pioenvs/teensy30/firmware.hex
Teensy Loader, Command Line, Version 2.1
Read ".pioenvs/teensy30/firmware.hex": 11208 bytes, 8.6% usage
Unable to claim interface, check USB permissions
Error opening USB device: Permission denied
Waiting for Teensy device...
 (hint: press the reset button)
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions
Unable to claim interface, check USB permissions

EDIT: I think I found the culprit:

Did install Karabiner lately to support a Windows keyboard on OSX. Looks like it steals HID. I still think this should be considered as a bug since the Arduino GUI does properly upload even when Karabiner is started.


Thanks!

JMStudiosJoe commented 7 years ago

is there a fix for this..?

ErinCall commented 7 years ago

@mgcrea I'm having this problem as well. I had Karabiner installed; I uninstalled it (with sudo /Library/Application\ Support/org.pqrs/Karabiner/uninstall.sh) and rebooted, but I'm still getting "Unable to claim interface." Do you know if Karabiner's uninstaller might have left some config lines around?

EDIT: turns out I had built teensy_loader_cli for Linux rather than OSX. I edited the Makefile and now I'm good to go. Not sure if Karabiner was ever the problem.

billputer commented 7 years ago

I was having the exact same issue with the QMK firmware and my Ergodox EZ, and uninstalling Karabiner Elements fixed it.

ivankravets commented 6 years ago

Does it work with the latest 3.0.0 version? Please run pio update and try again.

ivankravets commented 5 years ago

https://github.com/platformio/platform-teensy/issues/54