Skip to content

"Device found but unable to open" error with teensy-loader-cli on Linux #14

@rzetterberg

Description

@rzetterberg

Problem description

When using teensy-loader-cli to flash a layout I get the following error when I press the reset button on my Ergodox EZ:

$ teensy-loader-cli --mcu=atmega32u4 -w -v ergodox_ez_firmware_zeds_layout_mggjzw.hex -v
Teensy Loader, Command Line, Version 2.1
Read "ergodox_ez_firmware_zeds_layout_mggjzw.hex": 25854 bytes, 80.2% usage
Waiting for Teensy device...
 (hint: press the reset button)
Found device but unable to open
Found device but unable to open

Steps to reproduce

Here are the exact steps I take:

  1. Plug in the Ergodox EZ USB-cable into my computer
  2. Verify that the Ergodox EZ is initialized and appears as a new USB device (using dmesg)
  3. Run teensy-loader-cli --mcu=atmega32u4 -v -w ergodox_ez_firmware_zeds_layout_mggjzw.hex
  4. Verify that teensy-loader-cli is running and that it has output Waiting for Teensy device...
  5. Press reset pint on Ergodox EZ with a paperclip

Troubleshooting

What I have tried the following without success:

  • Using the default layout downloaded from the graphical configurator
  • Using a custom layout downloaded from the graphical configurator
  • Holding the reset button pressed while plugging in the Ergodox EZ
  • Tried different versions of teensy-loader-cli on different computers

Solution

After reading the following PJRC forum post
I tried adding the mentioned UDEV rules, and that solved the problem for me:

$ teensy-loader-cli --mcu=atmega32u4 -v -w ergodox_ez_firmware_zeds_layout_mggjzw.hex
Teensy Loader, Command Line, Version 2.1
Read "ergodox_ez_firmware_zeds_layout_mggjzw.hex": 25854 bytes, 80.2% usage
Waiting for Teensy device...
 (hint: press the reset button)
Found HalfKay Bootloader
Read "ergodox_ez_firmware_zeds_layout_mggjzw.hex": 25854 bytes, 80.2% usage
Programming..........................................................................................................................................................................................................
Booting

I'm closing this ticket directly since the problem is solved. The only
reason I created it was so that anyone else faced with the same problem will
easily find this ticket while searching for "Ergodox EZ found device unable to open"
or similar search terms.

For maximum convenience, here's a script that will install the UDEV rules for you
(unless you are using NixOS):

install-teensy-udev-rules.sh

#!/usr/bin/env bash

#
# Script that installs PJRC UDEV rules for allowing to use Teensy-based devices.
# Downloads the rules file, checks that it matches the SHA256 checksum in this
# script and then moves the downloaded UDEV file
# to "/lib/udev/rules.d/49-teensy.rules".
#
# Note: you need to be able to run sudo to use this script.
#
# Run without providing any arguments:
#
# ./install-teensy-udev-rules.sh
#

set -e

UDEV_RULES_NAME="49-teensy.rules"
UDEV_RULES_URL="https://www.pjrc.com/teensy/$UDEV_RULES_NAME"
UDEV_RULES_SHA256="031de0b26991b5a3b19c497d9c0a17f86c40c55d925b9d07d19ab89f2286469d  $UDEV_RULES_NAME"
UDEV_RULES_DEST="/lib/udev/rules.d/49-teensy.rules"

WORK_DIR=$(mktemp -d)

function finish {
  echo ">> Cleaning up work dir"
  popd
  rm -rf "$WORK_DIR"
  echo "-- Clean up done"
}
trap finish EXIT

pushd "$WORK_DIR"

echo ">> Downloading UDEV rules file"

curl "$UDEV_RULES_URL" --output "$UDEV_RULES_NAME"
echo "031de0b26991b5a3b19c497d9c0a17f86c40c55d925b9d07d19ab89f2286469d  $UDEV_RULES_NAME" > "$UDEV_RULES_NAME.sha256"

sha256sum -c "$UDEV_RULES_NAME.sha256"

if [ -f "$UDEV_RULES_DEST" ]; then
    echo "UDEV rule '$UDEV_RULES_DEST' is already installed, quitting."
    exit
fi

echo ">> Installing UDEV rules file"

sudo install -o root -g root -m 0664 "$UDEV_RULES_NAME" "$UDEV_RULES_DEST"
sudo udevadm control --reload-rules
sudo udevadm trigger

echo "-- Installation complete"

If you are using NixOS you simply add this to your
/etc/nixos/configuration.nix file and run nixos-rebuild switch:

    services.udev.extraRules = ''
      # UDEV rules for Teensy USB devices
      ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
      ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
      SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
      KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
    '';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions