QMK debugging blues on Ubuntu

The short version: Building the third-party tool “hid_listen” from source and using Ubuntu 20.04 (Focal Fossa) or later enables debugging of QMK firmware on Ubuntu.

Introduction

Printf debugging is enabled in QMK by using the standard printf (or its cousin dprintf()) and by configuration at compile time (CONSOLE_ENABLE = yes in file rules.mk (for example, keyboards/keychron/v6/iso_encoder/keymaps/keychron/rules.mk)), though it is difficult (or impossible) to capture output early at startup time, e.g., in function eeconfig_init_kb().

Example code:

    int tickCount = timer_read32();
    printf("Ticks: %d\n", tickCount);

The standard way to capture the output is (command line):

qmk console

While this works perfectly fine in Arch Linux (e.g., ArcoLinux. Linux kernel version 6.4.10-arch1-1), it doesn’t on Ubuntu 20.04 (the minimum version to install and compile the current version of QMK):

<class 'AttributeError'>
☒ /usr/lib/x86_64-linux-gnu/libhidapi-hidraw.so: undefined symbol: hid_get_input_report
Traceback (most recent call last):
  File "/home/mortensen/.local/lib/python3.8/site-packages/milc/milc.py", line 539, in __call__
    return self.__call__()
  File "/home/mortensen/.local/lib/python3.8/site-packages/milc/milc.py", line 544, in __call__
    return self._subcommand(self)
  File "/home/mortensen/.local/lib/python3.8/site-packages/qmk_cli/subcommands/console.py", line 353, in console
    device_finder = FindDevices(vid, pid, index, cli.args.numeric)
  File "/home/mortensen/.local/lib/python3.8/site-packages/qmk_cli/subcommands/console.py", line 153, in __init__
    self.hid = import_hid()
  File "/home/mortensen/.local/lib/python3.8/site-packages/qmk_cli/subcommands/console.py", line 99, in import_hid
    import hid
  File "/home/mortensen/.local/lib/python3.8/site-packages/hid/__init__.py", line 83, in <module>
    hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t]
  File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/x86_64-linux-gnu/libhidapi-hidraw.so: undefined symbol: hid_get_input_report

Some mention a minimum Linux kernel version of 5.11. But using a later (HWE) Linux kernel version, 5.15.0-83-generic, sudo apt-get install linux-image-generic-hwe-20.04, did not help either (though it may or may not be that it is necessary, but not sufficient). Note that HWE is not enabled if upgrading from an older version of Ubuntu to 20.04; the kernel version thus stays at 5.4 (by default).

Using a newer version of Ubuntu, Ubuntu 22.04 (Jammy Jellyfish. Linux kernel 6.2.0-32-generic (HWE)) or Ubuntu 23.04 (Lunar Lobster. Also Linux kernel 6.2.0-32-generic) is not much better. It launches, but the result is an endless loop of “Could not connect to” (to standard error), about 8 times per second:

qmk console

Output:

Looking for devices...
q*6-☒ Could not connect to Keychron Keychron V5 (:3434:0353:1): HIDException: unable to open device
☒ Could not connect to Keychron Keychron V5 (:3434:0353:1): HIDException: unable to open device
☒ Could not connect to Keychron Keychron V5 (:3434:0353:1): HIDException: unable to open device
☒ Could not connect to Keychron Keychron V5 (:3434:0353:1): HIDException: unable to open device
☒ Could not connect to Keychron Keychron V5 (:3434:0353:1): HIDException: unable to open device

(Note: The installation of QMK (the step python3 -m pip install –user qmk) is a challenge on Ubuntu 23.04. The error is “error: externally-managed-environment” and is specific to later versions of Debian (and derived, like Ubuntu. It may be a sound approach, but the QMK documentation is completely silent on the matter. QMK can be force-installed by using the parameter with the scary name “–break-system-packages” (note: it is two times ASCII “-” before “break”; it doesn’t render as such here): “python3 -m pip install –break-system-packages –user qmk” (note: it is two times ASCII “-” before “user”; see also the official documentation; see also Appendix A for a properly rendered command line). Disclaimer: Do it at your own risk.))

The solution

hid_listen promises to be an (officially recommended) alternative. But it is old and for Linux, only a 32-bit binary is provided.

Compiling hid_listen from source

The solution is to compile from source. This is much less scary than it sounds. The abstract is: Download the source (only about 70 KB (yes, kilobyte, not megabyte)), uncompress it, cd to the folder with the “hid_listen.c” file, and execute ‘make’.

This is all that is needed:

cd /home/mortensen/temp2/2023-09-11/hid_listen_1.01/hid_listen
make

The result should be something like:

16 -rwxrwxr-x 1 mortensen mortensen 14472 Sep 11 14:42 hid_listen

‘hid_listen’ can be run like:

/home/mortensen/temp2/2023-09-11/hid_listen_1.01/hid_listen/hid_listen

Output:

    Waiting for device:
    Listening:

(For download integrity, the MD5 sum for the hid_listen_1.01.zip file is FCC94F8248F5642F1FC9747E0F280569 (2023-09-11).)

Limitation: hid_listen only works with one device

If there is more than one device for this, say two Keychron keyboards connected at the same time, hid_listen will only listen to (and capture debug output) one of them. At this time, it is unknown what rule is used for this (e.g., physical USB position or order of powering on) or if there is a way to specify which device hid_listen should pick.

One of keyboards can be disconnected to be sure which one is used, but this is inconvenient if doing any extensive development, as one of the keyboards has to be constantly plugged and unplugged (and the USB plugs aren’t designed for that).

In this case, it is recommended to use some other keyboard as the main keyboard during development.

Possible workaround

It should be possible to hard code the USB vendor ID and product ID in the rawhid_open_only1() call in line 41 of file hid_listen.c (or add command-line parameters for the two), the first two parameters, respectively.

But that is not the case! See below.

The source line.

    hid = rawhid_open_only1(0, 0, 0xFF31, 0x0074);

This would only work for different products, not for two completely identical keyboard models.

One way to discover the the USB vendor ID and product ID is using dmesg. Unplug and plug the keyboard to ensure it is the last one and then:

clear ; dmesg | tail -n 20 | grep found

(Note that lsusb may not be useful as, for example, the explaining line is empty for Keychron V5 keyboards… (but not for Keychron V6).)

Result for Keychron V5:

[11600.408431] usb 3-1.5: New USB device found, idVendor=3434, idProduct=0353, bcdDevice= 1.00

Thus the source code line in hid_listen.c would be:

    hid = rawhid_open_only1(0x3434, 0x0353, 0xFF31, 0x0074);

Note that in bootloader mode all Keychron keyboards have the same IDs, 0x0483 and 0xDF11.

But this approach doesn’t work in its current form… The first two parameters to rawhid_open_only1() are ignored (file rawhid.c): “// TODO; inputs are ignored and hardcoded into this signature….”. Making it work would require more extensive changes.

hid_listen is open source!

The reference from the QMK documentation to only the web site www.pjrc.com and under “Teensy” makes it seem like hid_listen is somewhat proprietary, but it is not.

The source code at www.pjrc.com is also outdated (version 1.01 and unknown publication date. But it is at least from before 2011 as there is a note with a timestamp of 2011-01-01 about 32-bit Linux vs. 64-bit). The QMK documentation fails to mention this.

The original source code repository is this one (last change in 2022).

And the TMK project has forked it here (last change in 2022). For example, the 64-bit Linux issue was addressed in 2020: “Add binary for Linux 64-bit” (FFB011).

Though the problem remains: The source code changes are mainly related to building hid_listen for various other systems. Parameters “vid” and “pid” to function rawhid_open_only1 are still ignored (not used at all).

Is there a solution anyway?

The call “ioctl(fd, HIDIOCGRAWINFO, &info)” in rawhid_open_only1() returns a struct of type hidraw_devinfo. hidraw_devinfo is defined as:

struct hidraw_devinfo
{
    uint32_t  bustype;
    int16_t   vendor;
    int16_t   product;
};

Thus info.vendor and info.product can be matched with the filter parameters to rawhid_open_only1(), “vid” and “pid”, respectively.

An alternative: Arch Linux

For example, ArcoLinux.

Though if the Arch Linux installation is out of date, for example, a few months, it may be necessary to deviate from the official instructions to make it work at all and use:

sudo pacman --needed --noconfirm -Syu git python-pip libffi

As this may fail:

sudo pacman --needed --noconfirm -S git python-pip libffi

Conclusion

Compiling hid_listen from source for a 64-bit system is relatively straightforward and makes it possible to debug QMK keyboards on the older Ubuntu 20.04 version.

However, it is inconvenient on a system with more than Keychron keyboard. With sufficient effort, the hid_listen source code could probably be changed to work with a USB product ID filter. Though that would not help with two Keychron keyboards of the same model (the USB product IDs are the same in that case).

A possible workaround is to only enable debugging (at compile-time) for the Keychron keyboard that is being developed on (and disable it for all other Keychron keyboards).

Appendix A: Transcript of installing QMK on Ubuntu 23.04 (Lunar Lobster)

python3 -m pip install --break-system-packages --user qmk

Output:

Collecting qmk
  Downloading qmk-1.1.2-py2.py3-none-any.whl (13 kB)
Collecting hid
  Downloading hid-1.0.5.tar.gz (3.9 kB)
  Preparing metadata (setup.py) ... done
Collecting milc>=1.4.2
  Downloading milc-1.6.8-py2.py3-none-any.whl (24 kB)
Collecting pyusb
  Downloading pyusb-1.2.1-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.4/58.4 kB 1.9 MB/s eta 0:00:00
Requirement already satisfied: setuptools>=45 in /usr/lib/python3/dist-packages (from qmk) (66.1.1)
Collecting dotty-dict
  Downloading dotty_dict-1.3.1-py3-none-any.whl (7.0 kB)
Collecting hjson
  Downloading hjson-3.1.0-py3-none-any.whl (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.0/54.0 kB 1.7 MB/s eta 0:00:00
Collecting jsonschema>=4
  Downloading jsonschema-4.19.0-py3-none-any.whl (83 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.4/83.4 kB 1.6 MB/s eta 0:00:00
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from qmk) (9.4.0)
Requirement already satisfied: pygments in /usr/lib/python3/dist-packages (from qmk) (2.14.0)
Collecting pyserial
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 kB 1.8 MB/s eta 0:00:00
Collecting attrs>=22.2.0
  Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 2.5 MB/s eta 0:00:00
Collecting jsonschema-specifications>=2023.03.6
  Downloading jsonschema_specifications-2023.7.1-py3-none-any.whl (17 kB)
Collecting referencing>=0.28.4
  Downloading referencing-0.30.2-py3-none-any.whl (25 kB)
Collecting rpds-py>=0.7.1
  Downloading rpds_py-0.10.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 2.0 MB/s eta 0:00:00
Collecting appdirs
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting argcomplete
  Downloading argcomplete-3.1.1-py3-none-any.whl (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.5/41.5 kB 3.1 MB/s eta 0:00:00
Requirement already satisfied: colorama in /usr/lib/python3/dist-packages (from milc>=1.4.2->qmk) (0.4.6)
Collecting halo
  Downloading halo-0.0.31.tar.gz (11 kB)
  Preparing metadata (setup.py) ... done
Collecting spinners
  Downloading spinners-0.0.24-py3-none-any.whl (5.5 kB)
Collecting log_symbols>=0.0.14
  Downloading log_symbols-0.0.14-py3-none-any.whl (3.1 kB)
Requirement already satisfied: six>=1.12.0 in /usr/lib/python3/dist-packages (from halo->milc>=1.4.2->qmk) (1.16.0)
Collecting termcolor>=1.1.0
  Downloading termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Building wheels for collected packages: hid, halo
  Building wheel for hid (setup.py) ... done
  Created wheel for hid: filename=hid-1.0.5-py3-none-any.whl size=3730 sha256=7702aeb0d1f632b4254133ef54ab06e14ef787d46073b79f35a02b57eac74078
  Stored in directory: /home/embo/.cache/pip/wheels/b7/5a/4e/b427a96232d1fae99d5f9c28ef68ffdaf03d2d593838fd7995
  Building wheel for halo (setup.py) ... done
  Created wheel for halo: filename=halo-0.0.31-py3-none-any.whl size=11242 sha256=c3045def7842fcfabf12867d61974e28b9d86e73186c42857dde93e21f5cfe30
  Stored in directory: /home/embo/.cache/pip/wheels/2e/b1/0a/62566170555f623c8327d47df1f53b6e4311ec9dd0ea70a99c
Successfully built hid halo
Installing collected packages: spinners, pyserial, hjson, hid, appdirs, termcolor, rpds-py, pyusb, log_symbols, dotty-dict, attrs, argcomplete, referencing, halo, milc, jsonschema-specifications, jsonschema, qmk
Successfully installed appdirs-1.4.4 argcomplete-3.1.1 attrs-23.1.0 dotty-dict-1.3.1 halo-0.0.31 hid-1.0.5 hjson-3.1.0 jsonschema-4.19.0 jsonschema-specifications-2023.7.1 log_symbols-0.0.14 milc-1.6.8 pyserial-3.5 pyusb-1.2.1 qmk-1.1.2 referencing-0.30.2 rpds-py-0.10.2 spinners-0.0.24 termcolor-2.3.0

And:

qmk setup

Output:

Ψ Found qmk_firmware at /home/embo/qmk_firmware.
Ψ QMK Doctor is checking your environment.
Ψ CLI version: 1.1.2
Ψ QMK home: /home/embo/qmk_firmware
Ψ Detected Linux (Ubuntu 23.04).
⚠ Missing or outdated udev rules for 'atmel-dfu' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'kiibohd' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'stm32-dfu' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'apm32-dfu' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'gd32v-dfu' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'wb32-dfu' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'bootloadhid' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'usbasploader' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'usbtinyisp' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'md-boot' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.
⚠ Missing or outdated udev rules for 'caterina' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'hid-bootloader' boards. Run 'sudo cp /home/embo/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
Ψ Git branch: master
Ψ Repo version: 0.22.2
⚠ The official repository does not seem to be configured as git remote "upstream".
☒ Can't find arm-none-eabi-gcc in your path.
☒ Can't find avr-gcc in your path.
☒ Can't find avrdude in your path.
☒ Can't find dfu-programmer in your path.
☒ Can't find dfu-util in your path.
Would you like to install dependencies? [Y/n] Y
Get:1 http://security.ubuntu.com/ubuntu lunar-security InRelease [109 kB]
Hit:2 http://dk.archive.ubuntu.com/ubuntu lunar InRelease                                 
Hit:3 http://dk.archive.ubuntu.com/ubuntu lunar-updates InRelease                         
Hit:4 http://dk.archive.ubuntu.com/ubuntu lunar-backports InRelease
Fetched 109 kB in 1s (97.8 kB/s)
Reading package lists... Done
Installing dependencies
Reading package lists...
Building dependency tree...
Reading state information...
build-essential is already the newest version (12.9ubuntu3).
build-essential set to manually installed.
diffutils is already the newest version (1:3.8-4).
gcc is already the newest version (4:12.2.0-3ubuntu1).
gcc set to manually installed.
git is already the newest version (1:2.39.2-1ubuntu1.1).
unzip is already the newest version (6.0-27ubuntu1).
unzip set to manually installed.
wget is already the newest version (1.21.3-1ubuntu1).
wget set to manually installed.
zip is already the newest version (3.0-13).
zip set to manually installed.
python3-pip is already the newest version (23.0.1+dfsg-1ubuntu0.1).
Suggested packages:
  avrdude-doc gcc-doc libnewlib-doc
The following NEW packages will be installed:
  avr-libc avrdude binutils-arm-none-eabi binutils-avr clang-format clang-format-15 dfu-programmer dfu-util gcc-arm-none-eabi gcc-avr
  libclang-cpp15 libftdi1 libhidapi-hidraw0 libhidapi-libusb0 libnewlib-arm-none-eabi libnewlib-dev libstdc++-arm-none-eabi-dev
  libstdc++-arm-none-eabi-newlib libusb-0.1-4 libusb-dev teensy-loader-cli
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 489 MB of archives.
After this operation, 2,689 MB of additional disk space will be used.
Get:1 http://dk.archive.ubuntu.com/ubuntu lunar-updates/universe amd64 libclang-cpp15 amd64 1:15.0.7-3ubuntu0.23.04.1 [12.7 MB]
Get:2 http://dk.archive.ubuntu.com/ubuntu lunar-updates/universe amd64 clang-format-15 amd64 1:15.0.7-3ubuntu0.23.04.1 [51.9 kB]
Get:3 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 clang-format amd64 1:15.0-56~exp2 [2,804 B]
Get:4 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 dfu-programmer amd64 0.6.1-1build1 [30.6 kB]
Get:5 http://dk.archive.ubuntu.com/ubuntu lunar/main amd64 libusb-0.1-4 amd64 2:0.1.12-32build3 [17.7 kB]
Get:6 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libftdi1 amd64 0.20-4ubuntu1 [15.4 kB]
Get:7 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 binutils-arm-none-eabi amd64 2.39-1ubuntu1+17ubuntu1 [3,008 kB]
Get:8 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 gcc-arm-none-eabi amd64 15:12.2.rel1-1 [53.1 MB]
Get:9 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libstdc++-arm-none-eabi-dev all 15:12.2.rel1-1+23 [1,236 kB]
Get:10 http://dk.archive.ubuntu.com/ubuntu lunar/main amd64 libusb-dev amd64 2:0.1.12-32build3 [32.0 kB]
Get:11 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 teensy-loader-cli amd64 2.2-1 [12.0 kB]
Get:12 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 binutils-avr amd64 2.26.20160125+Atmel3.6.2-4 [1,697 kB]
Get:13 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 gcc-avr amd64 1:5.4.0+Atmel3.6.2-3 [17.2 MB]
Get:14 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 avr-libc all 1:2.0.0+Atmel3.6.2-3 [4,859 kB]
Get:15 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libhidapi-libusb0 amd64 0.13.1-1 [17.5 kB]
Get:16 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 avrdude amd64 6.3-20171130+svn1429-2 [316 kB]
Get:17 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 dfu-util amd64 0.11-1 [41.6 kB]
Get:18 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libhidapi-hidraw0 amd64 0.13.1-1 [12.9 kB]
Get:19 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libnewlib-dev all 3.3.0-1.3 [137 kB]
Get:20 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libnewlib-arm-none-eabi all 3.3.0-1.3 [43.2 MB]
Get:21 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 libstdc++-arm-none-eabi-newlib all 15:12.2.rel1-1+23 [352 MB]
Fetched 489 MB in 2min 14s (3,664 kB/s)
Selecting previously unselected package libclang-cpp15.
(Reading database ... 209736 files and directories currently installed.)
Preparing to unpack .../00-libclang-cpp15_1%3a15.0.7-3ubuntu0.23.04.1_amd64.deb ...
Unpacking libclang-cpp15 (1:15.0.7-3ubuntu0.23.04.1) ...
Selecting previously unselected package clang-format-15.
Preparing to unpack .../01-clang-format-15_1%3a15.0.7-3ubuntu0.23.04.1_amd64.deb ...
Unpacking clang-format-15 (1:15.0.7-3ubuntu0.23.04.1) ...
Selecting previously unselected package clang-format:amd64.
Preparing to unpack .../02-clang-format_1%3a15.0-56~exp2_amd64.deb ...
Unpacking clang-format:amd64 (1:15.0-56~exp2) ...
Selecting previously unselected package dfu-programmer.
Preparing to unpack .../03-dfu-programmer_0.6.1-1build1_amd64.deb ...
Unpacking dfu-programmer (0.6.1-1build1) ...
Selecting previously unselected package libusb-0.1-4:amd64.
Preparing to unpack .../04-libusb-0.1-4_2%3a0.1.12-32build3_amd64.deb ...
Unpacking libusb-0.1-4:amd64 (2:0.1.12-32build3) ...
Selecting previously unselected package libftdi1:amd64.
Preparing to unpack .../05-libftdi1_0.20-4ubuntu1_amd64.deb ...
Unpacking libftdi1:amd64 (0.20-4ubuntu1) ...
Selecting previously unselected package binutils-arm-none-eabi.
Preparing to unpack .../06-binutils-arm-none-eabi_2.39-1ubuntu1+17ubuntu1_amd64.deb ...
Unpacking binutils-arm-none-eabi (2.39-1ubuntu1+17ubuntu1) ...
Selecting previously unselected package gcc-arm-none-eabi.
Preparing to unpack .../07-gcc-arm-none-eabi_15%3a12.2.rel1-1_amd64.deb ...
Unpacking gcc-arm-none-eabi (15:12.2.rel1-1) ...
Selecting previously unselected package libstdc++-arm-none-eabi-dev.
Preparing to unpack .../08-libstdc++-arm-none-eabi-dev_15%3a12.2.rel1-1+23_all.deb ...
Unpacking libstdc++-arm-none-eabi-dev (15:12.2.rel1-1+23) ...
Selecting previously unselected package libusb-dev.
Preparing to unpack .../09-libusb-dev_2%3a0.1.12-32build3_amd64.deb ...
Unpacking libusb-dev (2:0.1.12-32build3) ...
Selecting previously unselected package teensy-loader-cli.
Preparing to unpack .../10-teensy-loader-cli_2.2-1_amd64.deb ...
Unpacking teensy-loader-cli (2.2-1) ...
Selecting previously unselected package binutils-avr.
Preparing to unpack .../11-binutils-avr_2.26.20160125+Atmel3.6.2-4_amd64.deb ...
Unpacking binutils-avr (2.26.20160125+Atmel3.6.2-4) ...
Selecting previously unselected package gcc-avr.
Preparing to unpack .../12-gcc-avr_1%3a5.4.0+Atmel3.6.2-3_amd64.deb ...
Unpacking gcc-avr (1:5.4.0+Atmel3.6.2-3) ...
Selecting previously unselected package avr-libc.
Preparing to unpack .../13-avr-libc_1%3a2.0.0+Atmel3.6.2-3_all.deb ...
Unpacking avr-libc (1:2.0.0+Atmel3.6.2-3) ...
Selecting previously unselected package libhidapi-libusb0:amd64.
Preparing to unpack .../14-libhidapi-libusb0_0.13.1-1_amd64.deb ...
Unpacking libhidapi-libusb0:amd64 (0.13.1-1) ...
Selecting previously unselected package avrdude.
Preparing to unpack .../15-avrdude_6.3-20171130+svn1429-2_amd64.deb ...
Unpacking avrdude (6.3-20171130+svn1429-2) ...
Selecting previously unselected package dfu-util.
Preparing to unpack .../16-dfu-util_0.11-1_amd64.deb ...
Unpacking dfu-util (0.11-1) ...
Selecting previously unselected package libhidapi-hidraw0:amd64.
Preparing to unpack .../17-libhidapi-hidraw0_0.13.1-1_amd64.deb ...
Unpacking libhidapi-hidraw0:amd64 (0.13.1-1) ...
Selecting previously unselected package libnewlib-dev.
Preparing to unpack .../18-libnewlib-dev_3.3.0-1.3_all.deb ...
Unpacking libnewlib-dev (3.3.0-1.3) ...
Selecting previously unselected package libnewlib-arm-none-eabi.
Preparing to unpack .../19-libnewlib-arm-none-eabi_3.3.0-1.3_all.deb ...
Unpacking libnewlib-arm-none-eabi (3.3.0-1.3) ...
Selecting previously unselected package libstdc++-arm-none-eabi-newlib.
Preparing to unpack .../20-libstdc++-arm-none-eabi-newlib_15%3a12.2.rel1-1+23_all.deb ...
Unpacking libstdc++-arm-none-eabi-newlib (15:12.2.rel1-1+23) ...
Setting up binutils-avr (2.26.20160125+Atmel3.6.2-4) ...
Setting up binutils-arm-none-eabi (2.39-1ubuntu1+17ubuntu1) ...
Setting up gcc-arm-none-eabi (15:12.2.rel1-1) ...
Setting up libhidapi-hidraw0:amd64 (0.13.1-1) ...
Setting up libusb-0.1-4:amd64 (2:0.1.12-32build3) ...
Setting up gcc-avr (1:5.4.0+Atmel3.6.2-3) ...
Setting up libnewlib-dev (3.3.0-1.3) ...
Setting up libhidapi-libusb0:amd64 (0.13.1-1) ...
Setting up libnewlib-arm-none-eabi (3.3.0-1.3) ...
Setting up libclang-cpp15 (1:15.0.7-3ubuntu0.23.04.1) ...
Setting up dfu-programmer (0.6.1-1build1) ...
Setting up clang-format-15 (1:15.0.7-3ubuntu0.23.04.1) ...
Setting up dfu-util (0.11-1) ...
Setting up clang-format:amd64 (1:15.0-56~exp2) ...
Setting up libstdc++-arm-none-eabi-dev (15:12.2.rel1-1+23) ...
Setting up teensy-loader-cli (2.2-1) ...
Setting up libftdi1:amd64 (0.20-4ubuntu1) ...
Setting up libusb-dev (2:0.1.12-32build3) ...
Setting up avr-libc (1:2.0.0+Atmel3.6.2-3) ...
Setting up libstdc++-arm-none-eabi-newlib (15:12.2.rel1-1+23) ...
Setting up avrdude (6.3-20171130+svn1429-2) ...
Processing triggers for man-db (2.11.2-1) ...
Processing triggers for libc-bin (2.37-0ubuntu2) ...
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  binutils-riscv64-unknown-elf gcc-riscv64-unknown-elf picolibc-riscv64-unknown-elf
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 173 MB of archives.
After this operation, 1,212 MB of additional disk space will be used.
Get:1 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 binutils-riscv64-unknown-elf amd64 2.35.1-0ubuntu1 [2,386 kB]
Get:2 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 gcc-riscv64-unknown-elf amd64 10.2.0-0ubuntu1 [37.0 MB]
Get:3 http://dk.archive.ubuntu.com/ubuntu lunar/universe amd64 picolibc-riscv64-unknown-elf all 1.8-1 [134 MB]
Fetched 173 MB in 49s (3,532 kB/s)
Selecting previously unselected package binutils-riscv64-unknown-elf.
(Reading database ... 217532 files and directories currently installed.)
Preparing to unpack .../binutils-riscv64-unknown-elf_2.35.1-0ubuntu1_amd64.deb ...
Unpacking binutils-riscv64-unknown-elf (2.35.1-0ubuntu1) ...
Selecting previously unselected package gcc-riscv64-unknown-elf.
Preparing to unpack .../gcc-riscv64-unknown-elf_10.2.0-0ubuntu1_amd64.deb ...
Unpacking gcc-riscv64-unknown-elf (10.2.0-0ubuntu1) ...
Selecting previously unselected package picolibc-riscv64-unknown-elf.
Preparing to unpack .../picolibc-riscv64-unknown-elf_1.8-1_all.deb ...
Unpacking picolibc-riscv64-unknown-elf (1.8-1) ...
Setting up binutils-riscv64-unknown-elf (2.35.1-0ubuntu1) ...
Setting up gcc-riscv64-unknown-elf (10.2.0-0ubuntu1) ...
Setting up picolibc-riscv64-unknown-elf (1.8-1) ...
Processing triggers for man-db (2.11.2-1) ...
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
--2023-09-07 13:46:25--  https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz
Resolving www.obdev.at (www.obdev.at)... 167.235.211.211
Connecting to www.obdev.at (www.obdev.at)|167.235.211.211|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://www.obdev.at/ftp/pub/Products/vusb/bootloadHID.2012-12-08.tar.gz [following]
--2023-09-07 13:46:26--  https://www.obdev.at/ftp/pub/Products/vusb/bootloadHID.2012-12-08.tar.gz
Reusing existing connection to www.obdev.at:443.
HTTP request sent, awaiting response... 200 OK
Length: 107970 (105K) [application/x-gzip]
Saving to: ‘STDOUT’

-                                 100%[=============================================================>] 105.44K   629KB/s    in 0.2s    

2023-09-07 13:46:26 (629 KB/s) - written to stdout [107970/107970]

gcc  -O2 -Wall `libusb-config --cflags` -c main.c -o main.o
gcc  -O2 -Wall `libusb-config --cflags` -c usbcalls.c -o usbcalls.o
In file included from usbcalls.c:19:
usb-libusb.c: In function ‘usbGetReport’:
usb-libusb.c:196:9: warning: value computed is not used [-Wunused-value]
  196 |         *len++;
      |         ^~~~~~
gcc  -O2 -Wall `libusb-config --cflags` -o bootloadHID main.o usbcalls.o `libusb-config --libs`
Ψ All dependencies are installed.
Ψ Found arm-none-eabi-gcc version 12.2.1
Ψ Found avr-gcc version 5.4.0
Ψ Found avrdude version 6.3-20171130
Ψ Found dfu-programmer version 0.6.1
Ψ Found dfu-util version 0.11
Ψ Submodules are up to date.
Ψ Submodule status:
Ψ - lib/chibios: 2023-04-15 13:48:04 +0000 --  (11edb1610)
Ψ - lib/chibios-contrib: 2023-07-17 11:39:05 +0200 --  (da78eb37)
Ψ - lib/googletest: 2021-06-11 06:37:43 -0700 --  (e2239ee6)
Ψ - lib/lufa: 2022-08-26 12:09:55 +1000 --  (549b97320)
Ψ - lib/vusb: 2022-06-13 09:18:17 +1000 --  (819dbc1)
Ψ - lib/printf: 2022-06-29 23:59:58 +0300 --  (c2e3b4e)
Ψ - lib/pico-sdk: 2023-02-12 20:19:37 +0100 --  (a3398d8)
Ψ - lib/lvgl: 2022-04-11 04:44:53 -0600 --  (e19410f8)
Ψ QMK is ready to go, but minor problems were found

Appendix B: Getting system information

From the command line:

Ubuntu version, incl. the minor version number

lsb_release -a

Sample output:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

Linux kernel version

uname -r

Sample output:

5.15.0-83-generic

HWE status

If it is enabled (typically later minor versions of a Ubuntu major version), a newer Linux kernel is used.

hwe-support-status  --verbose

Sample output (when it is enabled):

Your Hardware Enablement Stack (HWE) is supported until April 2025.

Leave a Reply

Your email address will not be published. Required fields are marked *

*