diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 015c187a..6f2e2025 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -10,10 +10,6 @@ LIBRARY="${LIBRARY:-${SKETCH}}" ######## Keyboard hardware definitions ######## -# These should be pulled from Arduino boards.txt -VID="${VID:-1209}" -BOOTLOADER_PID="${BOOTLOADER_PID:-2300}" -SKETCH_PID="${SKEYCH_PID:-2301}" BOARD="${BOARD:-model01}" MCU="${MCU:-atmega32u4}" if [ "${BOARD}" = "virtual" ]; then @@ -32,8 +28,21 @@ fi # Shamelessly stolen from git's Makefile uname_S=$(uname -s 2>/dev/null || echo not) +find_device_vid_pid() { + VPIDS=$(${ARDUINO_BUILDER} \ + -hardware "${ARDUINO_PATH}/hardware" \ + -hardware "${BOARD_HARDWARE_PATH}" \ + ${ARDUINO_TOOLS_PARAM} \ + -tools "${ARDUINO_PATH}/tools-builder" \ + -fqbn "${FQBN}" \ + -dump-prefs | grep "\.[vp]id=") + VID=${VID:-$(echo "${VPIDS}" | grep build.vid= | cut -dx -f2)} + SKETCH_PID=${SKETCH_PID:-$(echo "${VPIDS}" | grep build.pid= | cut -dx -f2)} + BOOTLOADER_PID=${BOOTLOADER_PID:-$(echo "${VPIDS}" | grep bootloader.pid= | cut -dx -f2)} +} find_device_port() { + find_device_vid_pid DIR=$(dirname "$(readlink -f "$0")") DEVICE_PORT_PROBER="${DIR}/find-device-port-linux-udev" DEVICE_PORT="$(perl ${DEVICE_PORT_PROBER} ${VID} ${SKETCH_PID})" @@ -49,6 +58,7 @@ reset_device_cmd() { MD5="md5sum" find_bootloader_ports() { + find_device_vid_pid DIR=$(dirname "$(readlink -f "$0")") DEVICE_PORT_PROBER="${DIR}/find-device-port-linux-udev" DEVICE_PORT_BOOTLOADER="$(perl ${DEVICE_PORT_PROBER} ${VID} ${BOOTLOADER_PID})"