diff --git a/src/main.rs b/src/main.rs
index 41a9d2479836a74fa58ba5c8b6bc4e23939e6216..d3b85f8821bdcf74531ac73aa5d84ef82a8a735f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,8 +21,19 @@ fn main() {
     // convert to packet sequence data structure
     let mut packets = PacketSequence::from(packets);
 
+    // get from args the serial port to use
+    let args: Vec<String> = std::env::args().collect();
+    if args.len() > 2 {
+        println!("Usage: {} <serial port>", args[0]);
+        std::process::exit(1);
+    }
+
     // Open the first serialport available.
-    let port_name = get_first_stm32_serial_port().expect("No STM32 serial port found!");
+    let port_name = if let Some(port_name) = args.get(1) {
+        port_name.to_owned()
+    } else {
+        get_first_stm32_serial_port().expect("No STM32 serial port found!")
+    };
     let mut port = serialport::new(port_name, 115200)
         .open()
         .expect("Failed to open serial port");