All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] emulator/b1ee: Enable to specify connecting host
@ 2018-04-06  8:45 ERAMOTO Masaya
  2018-04-10 12:33 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: ERAMOTO Masaya @ 2018-04-06  8:45 UTC (permalink / raw)
  To: linux-bluetooth

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] emulator/b1ee: Enable to specify connecting host
  2018-04-06  8:45 [PATCH BlueZ] emulator/b1ee: Enable to specify connecting host ERAMOTO Masaya
@ 2018-04-10 12:33 ` Luiz Augusto von Dentz
  2018-04-26  9:10   ` ERAMOTO Masaya
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-04-10 12:33 UTC (permalink / raw)
  To: ERAMOTO Masaya; +Cc: linux-bluetooth, Marcel Holtmann

Hi Marcel,

On Fri, Apr 6, 2018 at 11:45 AM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> 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

Any input regarding this changes? I guess it would be fine to have the
host as argument but then perhaps we should take the port as well,
though the port could be an option so we still default to the current
port.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] emulator/b1ee: Enable to specify connecting host
  2018-04-10 12:33 ` Luiz Augusto von Dentz
@ 2018-04-26  9:10   ` ERAMOTO Masaya
  0 siblings, 0 replies; 3+ messages in thread
From: ERAMOTO Masaya @ 2018-04-26  9:10 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On 04/10/2018 09:33 PM, Luiz Augusto von Dentz wrote:
> Hi Marcel,
> 
> On Fri, Apr 6, 2018 at 11:45 AM, ERAMOTO Masaya
> <eramoto.masaya@jp.fujitsu.com> wrote:
>> 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
> 
> Any input regarding this changes? I guess it would be fine to have the
> host as argument but then perhaps we should take the port as well,
> though the port could be an option so we still default to the current
> port.
> 

I had sent an updated patch:

https://www.spinics.net/lists/linux-bluetooth/msg75355.html


Regards,
Eramoto


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-26  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06  8:45 [PATCH BlueZ] emulator/b1ee: Enable to specify connecting host ERAMOTO Masaya
2018-04-10 12:33 ` Luiz Augusto von Dentz
2018-04-26  9:10   ` ERAMOTO Masaya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.