|
|
|
@ -61,18 +61,25 @@ find_max_prog_size() {
|
|
|
|
|
find_device_vid_pid() {
|
|
|
|
|
# SKETCH and -build-path in this command are here because of a bug introduced in Arduino 1.8.10
|
|
|
|
|
# https://github.com/arduino/arduino-builder/issues/341
|
|
|
|
|
VPIDS=$("${ARDUINO_BUILDER}" \
|
|
|
|
|
VPIDS=$(dump_arduino_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)}
|
|
|
|
|
BOOTLOADER_VID=${BOOTLOADER_VID:-$(echo "${VPIDS}" | grep bootloader.vid= | cut -dx -f2)}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dump_arduino_prefs() {
|
|
|
|
|
prefs=$("${ARDUINO_BUILDER}" \
|
|
|
|
|
-hardware "${ARDUINO_PATH}/hardware" \
|
|
|
|
|
-hardware "${BOARD_HARDWARE_PATH}" \
|
|
|
|
|
${ARDUINO_TOOLS_FLAG:+"${ARDUINO_TOOLS_FLAG}"} ${ARDUINO_TOOLS_PARAM:+"${ARDUINO_TOOLS_PARAM}"} \
|
|
|
|
|
-tools "${ARDUINO_PATH}/tools-builder" \
|
|
|
|
|
-fqbn "${FQBN}" \
|
|
|
|
|
-build-path "${ARDUINO_PATH}" \
|
|
|
|
|
-dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" | 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)}
|
|
|
|
|
BOOTLOADER_VID=${BOOTLOADER_VID:-$(echo "${VPIDS}" | grep bootloader.vid= | cut -dx -f2)}
|
|
|
|
|
-dump-prefs "${SKETCH_DIR}/${SKETCH}.ino" )
|
|
|
|
|
echo "$prefs"
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
find_device_port() {
|
|
|
|
|