diff --git a/.gitignore b/.gitignore index ceeb05b..84c048a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/tmp +/build/ diff --git a/.gitmodules b/.gitmodules index 83aa883..a8178bf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,6 @@ -[submodule "output"] - path = output - url = https://github.com/system76/thelio-io-output.git -[submodule "firmware"] - path = firmware - url = https://github.com/system76/thelio-io-firmware.git [submodule "hardware"] path = hardware url = https://github.com/system76/thelio-io-hardware.git -[submodule "dkms"] - path = dkms - url = https://github.com/pop-os/system76-io-dkms.git +[submodule "firmware"] + path = firmware + url = https://github.com/system76/qmk_firmware.git diff --git a/Makefile b/Makefile deleted file mode 100644 index 21b92da..0000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -.PHONY: all FORCE - -all: output/firmware output/hardware - -output/firmware: FORCE - rm -rf "$@" - mkdir -p "$@" - make -C "firmware" DEVICE=atmega32u4 clean - make -C "firmware" DEVICE=atmega32u4 all - cp "firmware/build/atmega32u4/"*.hex "$@" - touch "$@" - -output/hardware: FORCE - rm -rf "$@" - mkdir -p "$@" - make -C "hardware" clean - make -C "hardware" all - cp "hardware/"*-bom.csv "hardware/"*-pos.csv "hardware/build/"* "$@" - -FORCE: diff --git a/README.md b/README.md index c0dadbf..f6f6679 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ -# Thelio Io +# Thelio Io v2 -This is a master repository for the System76 Thelio Io device. Using `make`, you can update the outputs in the `output` submodule. +This is a master repository for the System76 Thelio Io device, version 2. For +verison 1, please see the [v1 branch](https://github.com/system76/thelio-io/tree/v1). diff --git a/dkms b/dkms deleted file mode 160000 index 6bb2635..0000000 --- a/dkms +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6bb2635f4863f06ff7a3fffc7b21697367423980 diff --git a/firmware b/firmware index df9110f..9bd6471 160000 --- a/firmware +++ b/firmware @@ -1 +1 @@ -Subproject commit df9110f54f73d7090096456ca389bd9bae2fbb78 +Subproject commit 9bd6471a5a2fe283d51a95f94f7372401fa1bfc0 diff --git a/hardware b/hardware index a8e166c..9033a2f 160000 --- a/hardware +++ b/hardware @@ -1 +1 @@ -Subproject commit a8e166cec9112d38d2bbe31a314689a8d7723ac8 +Subproject commit 9033a2faa9c8a22cbdb36771113580ed7177c157 diff --git a/output b/output deleted file mode 160000 index 9c43e45..0000000 --- a/output +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9c43e45901d42440180e8d79f4c947129a2e12ad diff --git a/scripts/lvfs.sh b/scripts/lvfs.sh new file mode 100755 index 0000000..30be5df --- /dev/null +++ b/scripts/lvfs.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +set -e + +if [ -z "$1" ] +then + echo "$0 [model] [description]" >&2 + exit 1 +fi +MODEL="$1" + +if [ -z "$2" ] +then + echo "$0 [model] [description]" >&2 + exit 1 +fi +DESCRIPTION="$2" + +BOOTLOADER_VID="03EB" # Raspberry Pi +RUNTIME_VID="3384" # System76 +case "${MODEL}" in + "thelio_io_2") + BOOTLOADER_PID="0003" # RP2040 + RUNTIME_PID="000B" + RUNTIME_REV="0001" + ;; + *) + echo "$0: unknown model '${MODEL}'" >&2 + exit 1 + ;; +esac + +echo "MODEL: ${MODEL}" +echo "DESCRIPTION: ${DESCRIPTION}" + +BOOTLOADER_ID="USB\\VID_${BOOTLOADER_VID}&PID_${BOOTLOADER_PID}" +echo "BOOTLOADER_ID: ${BOOTLOADER_ID}" + +BOOTLOADER_UUID="$(appstream-util generate-guid "${BOOTLOADER_ID}")" +echo "BOOTLOADER_UUID: ${BOOTLOADER_UUID}" + +RUNTIME_ID="USB\\VID_${RUNTIME_VID}&PID_${RUNTIME_PID}&REV_${RUNTIME_REV}" +echo "RUNTIME_ID: ${RUNTIME_ID}" + +RUNTIME_UUID="$(appstream-util generate-guid "${RUNTIME_ID}")" +echo "RUNTIME_UUID: ${RUNTIME_UUID}" + +make -C firmware distclean +make -C firmware "system76/${MODEL}:default" + +VERSION_HEADER="firmware/.build/obj_system76_${MODEL}_default/src/version.h" + +REVISION="$(grep QMK_VERSION "${VERSION_HEADER}" | cut -d '"' -f2)" +echo "REVISION: ${REVISION}" + +DATE="$(grep QMK_BUILDDATE "${VERSION_HEADER}" | cut -d '"' -f2 | cut -d '-' -f1,2,3)" +echo "DATE: ${DATE}" + +NAME="${MODEL}_${REVISION}" +echo "NAME: ${NAME}" + +SOURCE="https://github.com/system76/thelio-io" +echo "SOURCE: ${SOURCE}" + +BUILD="build/lvfs/${NAME}" +echo "BUILD: ${BUILD}" + +rm -rf "${BUILD}" +mkdir -pv "${BUILD}" + +cp "firmware/.build/system76_${MODEL}_default.uf2" "${BUILD}/firmware.uf2" + +echo "writing '${BUILD}/firmware.metainfo.xml'" +cat > "${BUILD}/firmware.metainfo.xml" < + + + com.system76.${MODEL}.firmware + Thelio Io + System76 Thelio Io Firmware + +

+ The System76 Thelio Io firmware is based on QMK and provides power button + and fan control functionality +

+
+ + + ${RUNTIME_UUID} + + https://github.com/system76/thelio-io + CC0-1.0 + GPL-2.0+ + System76 + + + + ${SOURCE} + +

${DESCRIPTION}

+
+
+
+ + X-Device + + + uf2 + + + com.microsoft.uf2 + plain + +
+EOF + +gcab \ + --verbose \ + --create \ + --nopath \ + "${BUILD}.cab" \ + "${BUILD}/"* + +echo "created '${BUILD}.cab'" diff --git a/test.sh b/test.sh deleted file mode 100755 index c9559e6..0000000 --- a/test.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -expected_drives=4 -expected_speed=512 -expected_devices=1 -set_pwm=127 -expected_pwm=126 -expected_rpm=300 - -function fail { - echo -e "\x1B[1;31mFAIL: $@\x1B[0m" - exit 1 -} - -test="tmp/$(date "+%Y-%m-%d_%H:%M:%S")" -rm -rf tmp -mkdir -p "$test" - -gsettings set org.gnome.settings-daemon.plugins.power button-power suspend -gsettings set org.gnome.settings-daemon.plugins.power power-button-action suspend -gsettings set org.gnome.desktop.lockdown disable-lock-screen true - -sudo avrdude \ - -c usbasp \ - -p atmega32u4 \ - -U flash:w:output/firmware/boot.hex:i\ - -U lfuse:w:0xFF:m \ - -U hfuse:w:0xD9:m \ - -U efuse:w:0xCB:m \ - || fail "failed to flash bootloader" -sleep 2 -sudo dfu-programmer atmega32u4 flash output/firmware/main.hex || fail "failed to flash program" -sudo dfu-programmer atmega32u4 reset || fail "failed to start program" - -drives=(/dev/disk/by-path/pci-????:??:??.?-ata-?) -echo "drives: ${#drives[@]}" -if [ "${#drives[@]}" != "$expected_drives" ] -then - fail "expected $expected_drives drives but found ${#drives[@]} drives" -fi - -pids=() -names=() -for drive in "${drives[@]}" -do - name="$(basename "$drive")" - sudo hdparm -t "$drive" > "$test/$name" & - pids+=("$!") - names+=("$name") -done - -for pid in "${pids[@]}" -do - wait "$pid" || fail "failed to test disk performance" -done - -for name in "${names[@]}" -do - speed="$(grep "Timing buffered disk reads:" "$test/$name" | cut -d '=' -f 2 | cut -d ' ' -f 2)" - echo "$name: $speed" - if [ "$(echo "$speed<$expected_speed" | bc -l)" == "1" ] - then - fail "expected $expected_speed speed but found $speed speed" - fi -done - -devices=(/sys/bus/usb/drivers/system76-io/?-?:?.1) -echo "devices: ${#devices[@]}" -if [ "${#devices[@]}" != "$expected_devices" ] -then - fail "expected $expected_devices devices but found ${#devices[@]} devices" -fi - -for device in "${devices[@]}" -do - for fan in 1 2 - do - for attempt in {1..10} - do - echo "$set_pwm" | sudo tee "$device"/hwmon/hwmon*/pwm"$fan" > /dev/null - sleep 0.2 - done - - label="$(cat "$device"/hwmon/hwmon*/fan"$fan"_label)" - pwm="$(cat "$device"/hwmon/hwmon*/pwm"$fan")" - rpm="$(cat "$device"/hwmon/hwmon*/fan"$fan"_input)" - - echo "$label: $pwm PWM, $rpm RPM" - - if [ "$pwm" != "$expected_pwm" ] - then - fail "expected $expected_pwm pwm but found $pwm pwm" - fi - - if [ "$(echo "$rpm<$expected_rpm" | bc -l)" == "1" ] - then - fail "expected $expected_rpm rpm but found $rpm rpm" - fi - done -done - -echo -e "\x1B[1;32mPASS\x1B[0m" -exit 0 diff --git a/update.sh b/update.sh deleted file mode 100755 index 9843295..0000000 --- a/update.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e - -git pull -git submodule update --init --recursive