Last active
November 10, 2024 03:00
-
-
Save skyjia/b504b3fabf5fd38b2077bd9938fa037e to your computer and use it in GitHub Desktop.
Connect to a Flipper Zero device using minicom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nu | |
# Connect to a Flipper Zero device using minicom | |
# https://docs.flipper.net/development/cli#rnDLl | |
# check if minicom is installed | |
if (which minicom | length) == 0 { | |
print "Please install minicom before using this script." | |
exit 1 | |
} | |
# list all Flipper Zero serial ports | |
let ports = ( | |
try { | |
ls /dev/cu.usbmodemflip_* | |
} | |
catch { | |
print "No Flipper Zero devices found."; | |
exit 1 | |
} | |
) | |
print $ports | |
# prompt user to select a port by index number | |
let index = (input "Select a port to connect by index (default: 0): " | try { into int } catch { 0 }) | |
# validate the index | |
if ($index < 0 or $index >= ($ports | length)) { | |
echo "Invalid index selected." | |
} else { | |
# get the selected port | |
let chosen_port = ($ports | get $index | get name) | |
echo $"You selected: ($chosen_port)" | |
# connect to the selected port using minicom | |
minicom -D $chosen_port | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment