net: fastboot: make UDP port net: configurable
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Thu, 13 Jan 2022 07:40:06 +0000 (08:40 +0100)
committerRamon Fried <ramon@neureality.ai>
Sat, 15 Jan 2022 16:54:21 +0000 (18:54 +0200)
The fastboot protocol uses per default the UDP port 5554. In some cases
it might be needed to change the used port. The fastboot utility provides
a way to specifiy an other port number to use already.

  fastboot -s udp:192.168.1.76:1234 boot fastboot.img

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/fastboot/Kconfig
net/fastboot.c

index d5e4a02..b97c67b 100644 (file)
@@ -21,6 +21,13 @@ config UDP_FUNCTION_FASTBOOT
        help
          This enables the fastboot protocol over UDP.
 
+config UDP_FUNCTION_FASTBOOT_PORT
+       depends on UDP_FUNCTION_FASTBOOT
+       int "Define FASTBOOT UDP port"
+       default 5554
+       help
+         The fastboot protocol requires a UDP port number.
+
 if FASTBOOT
 
 config FASTBOOT_BUF_ADDR
index 7e7a601..139233b 100644 (file)
@@ -9,9 +9,6 @@
 #include <net.h>
 #include <net/fastboot.h>
 
-/* Fastboot port # defined in spec */
-#define WELL_KNOWN_PORT 5554
-
 enum {
        FASTBOOT_ERROR = 0,
        FASTBOOT_QUERY = 1,
@@ -310,7 +307,7 @@ void fastboot_start_server(void)
        printf("Using %s device\n", eth_get_name());
        printf("Listening for fastboot command on %pI4\n", &net_ip);
 
-       fastboot_our_port = WELL_KNOWN_PORT;
+       fastboot_our_port = CONFIG_UDP_FUNCTION_FASTBOOT_PORT;
 
 #if CONFIG_IS_ENABLED(FASTBOOT_FLASH)
        fastboot_set_progress_callback(fastboot_timed_send_info);