diff --git a/scripts/flash_klipper.sh b/scripts/flash_klipper.sh index 8ea0ab8..c281214 100644 --- a/scripts/flash_klipper.sh +++ b/scripts/flash_klipper.sh @@ -70,6 +70,7 @@ function select_mcu_connection() { echo -e "| How is the controller board connected to the host? |" echo -e "| 1) USB |" echo -e "| 2) UART |" + echo -e "| 3) USB (DFU mode) |" blank_line back_help_footer @@ -85,6 +86,10 @@ function select_mcu_connection() { status_msg "Identifying MCU possibly connected via UART ...\n" get_uart_id || true # continue even after exit code 1 break;; + 3) + status_msg "Identifying MCU connected via USB in DFU mode ...\n" + get_dfu_id || true # continue even after exit code 1 + break;; B|b) advanced_menu break;; @@ -329,6 +334,16 @@ function get_uart_id() { done } +function get_dfu_id() { + unset mcu_list + sleep 1 + mcus=$(lsusb | grep "DFU" | cut -d " " -f 6 2>/dev/null) + + for mcu in ${mcus}; do + mcu_list+=("${mcu}") + done +} + function show_flash_method_help() { top_border echo -e "| ~~~~~~~~ < ? > Help: Flash MCU < ? > ~~~~~~~~ |" @@ -406,4 +421,4 @@ function show_mcu_connection_help() { error_msg "Invalid command!";; esac done -} \ No newline at end of file +}