[PATCH BlueZ] emulator/b1ee: Enable to specify connecting host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Because the default host seems to be unofficial since 2017, removes the
DEFAULT_SERVER macro.
---
 emulator/b1ee.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/emulator/b1ee.c b/emulator/b1ee.c
index 1fe46840f..42340f014 100644
--- a/emulator/b1ee.c
+++ b/emulator/b1ee.c
@@ -41,7 +41,6 @@
 
 #include "src/shared/mainloop.h"
 
-#define DEFAULT_SERVER		"b1ee.com"
 #define DEFAULT_HOST_PORT	"45550"		/* 0xb1ee */
 #define DEFAULT_SNIFFER_PORT	"45551"		/* 0xb1ef */
 
@@ -182,7 +181,7 @@ static int do_connect(const char *node, const char *service)
 	hints.ai_family = PF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
 
-	err = getaddrinfo(DEFAULT_SERVER, DEFAULT_HOST_PORT, &hints, &res);
+	err = getaddrinfo(node, DEFAULT_HOST_PORT, &hints, &res);
 	if (err) {
 		perror(gai_strerror(err));
 		exit(1);
@@ -227,8 +226,15 @@ int main(int argc, char *argv[])
 	ssize_t written;
 	sigset_t mask;
 
-	server_fd = do_connect(DEFAULT_SERVER, DEFAULT_HOST_PORT);
-	sniffer_fd = do_connect(DEFAULT_SERVER, DEFAULT_SNIFFER_PORT);
+	if (argc < 2) {
+		perror("b1ee - Bluetooth device testing tool over internet\n"
+			"Usage:\n"
+			"\tb1ee <host>\n");
+		return EXIT_FAILURE;
+	}
+
+	server_fd = do_connect(argv[1], DEFAULT_HOST_PORT);
+	sniffer_fd = do_connect(argv[1], DEFAULT_SNIFFER_PORT);
 
 	written = write(sniffer_fd, sniff_cmd, sizeof(sniff_cmd));
 	if (written < 0)
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux