All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
@ 2005-04-04 15:16 Dimitry Andric
  2005-04-05  8:20 ` Johan Hedberg
  2005-04-05 15:27 ` Marcel Holtmann
  0 siblings, 2 replies; 8+ messages in thread
From: Dimitry Andric @ 2005-04-04 15:16 UTC (permalink / raw)
  To: BlueZ Mailing List

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

Some phones (e.g. Samsung D500, Motorola MPx220, and possibly some
other Windows Mobile models) don't return any services if you ask them
for the public browse group.  You notice this, when "sdptool browse
xx:xx:xx:xx:xx:xx" returns immediately, without any output.

It turns out that the Windows XP Bluetooth browser asks for
L2CAP_UUID, which *does* work for all the phones I've tested.

So I've made this simple patch, that adds a `-l' or `--l2cap' command
line option to sdptool, to use the L2CAP_UUID for browsing, instead of
PUBLIC_BROWSE_GROUP.

[-- Attachment #2: bluez-utils-2.15-sdpbrowse-l2cap.patch --]
[-- Type: text/plain, Size: 1423 bytes --]

# bluez-utils-2.15-sdpbrowse-l2cap.patch
#
# Some phones don't return any services if you ask them for the public
# browse group.  It turns out that the Windows XP Bluetooth browser
# asks for L2CAP_UUID, which seems to work for all phones.
#
# This patch adds a `-l' or `--l2cap' command line option to sdptool,
# to use the L2CAP_UUID for browsing, instead of PUBLIC_BROWSE_GROUP.
#
# Dimitry Andric <dimitry@andric.com>, 2005-04-04 16:39:33

diff -urNd a/utils/tools/sdptool.c b/utils/tools/sdptool.c
--- a/utils/tools/sdptool.c	2004-12-25 19:06:02.000000000 +0100
+++ b/utils/tools/sdptool.c	2005-04-04 16:35:01.000000000 +0200
@@ -2016,12 +2033,13 @@
 static struct option browse_options[] = {
 	{ "help",    0,0, 'h' },
 	{ "tree",    0,0, 't' },
+	{ "l2cap",   0,0, 'l' },
 	{ 0, 0, 0, 0 }
 };
 
 static char *browse_help = 
 	"Usage:\n"
-	"\tbrowse [--tree] [bdaddr]\n";
+	"\tbrowse [--tree] [--l2cap] [bdaddr]\n";
 
 /*
  * Browse the full SDP database (i.e. list all services starting from the
@@ -2042,6 +2060,13 @@
 		case 't':
 			context.tree = 1;
 			break;
+		case 'l':
+			/* Some phones don't return any services if you ask them for the
+			 * public browse group.  It turns out that the Windows XP Bluetooth
+			 * browser asks for L2CAP_UUID, which seems to work for all phones.
+			 */
+			sdp_uuid16_create(&(context.group), L2CAP_UUID);
+			break;
 		default:
 			printf(browse_help);
 			return -1;

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-04 15:16 [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID Dimitry Andric
@ 2005-04-05  8:20 ` Johan Hedberg
  2005-04-05  8:40   ` Peter Wippich
  2005-04-05 15:27 ` Marcel Holtmann
  1 sibling, 1 reply; 8+ messages in thread
From: Johan Hedberg @ 2005-04-05  8:20 UTC (permalink / raw)
  To: BlueZ Mailing List

On Mon, Apr 04, 2005, Dimitry Andric wrote:
> Some phones (e.g. Samsung D500, Motorola MPx220, and possibly some
> other Windows Mobile models) don't return any services if you ask them
> for the public browse group.  You notice this, when "sdptool browse
> xx:xx:xx:xx:xx:xx" returns immediately, without any output.
> 
> It turns out that the Windows XP Bluetooth browser asks for
> L2CAP_UUID, which *does* work for all the phones I've tested.

I can confirm this behaviour also on a Motorola A760. However, it is
also the only phone I have encountered this.

Johan


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-05  8:20 ` Johan Hedberg
@ 2005-04-05  8:40   ` Peter Wippich
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Wippich @ 2005-04-05  8:40 UTC (permalink / raw)
  To: BlueZ Mailing List


Hi,

I'm aware of many devices which do not have a public browse group tag in
their SDP records. Searching for all services with L2CAP is one solution.
Another is to do a search for a range of well known service UUIDs. And
another solution (as imlemented by Widcom) is to do a search for the whole
range of service UUIDs (0..0xffff).
However, the last method wil crash some embedded devices with a dump
local data base search implementation. Actually they will not realy crash
but you may get a connection timeout.....

Ciao,

Peter

On Tue, 5 Apr 2005, Johan Hedberg wrote:

> On Mon, Apr 04, 2005, Dimitry Andric wrote:
> > Some phones (e.g. Samsung D500, Motorola MPx220, and possibly some
> > other Windows Mobile models) don't return any services if you ask them
> > for the public browse group.  You notice this, when "sdptool browse
> > xx:xx:xx:xx:xx:xx" returns immediately, without any output.
> >
> > It turns out that the Windows XP Bluetooth browser asks for
> > L2CAP_UUID, which *does* work for all the phones I've tested.
>
> I can confirm this behaviour also on a Motorola A760. However, it is
> also the only phone I have encountered this.
>
> Johan
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>

|	Peter Wippich 			Voice: +49 30 46776411		|
|	G&W Instruments GmbH		fax:   +49 30 46776419		|
|	Gustav-Meyer-Allee 25, Geb. 12	Email: pewi@gw-instruments.de	|
|	D-13355 Berlin  / Germany					|




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-04 15:16 [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID Dimitry Andric
  2005-04-05  8:20 ` Johan Hedberg
@ 2005-04-05 15:27 ` Marcel Holtmann
  2005-04-07 12:08   ` Dimitry Andric
  1 sibling, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2005-04-05 15:27 UTC (permalink / raw)
  To: bluez-devel

Hi Dimitry,

> Some phones (e.g. Samsung D500, Motorola MPx220, and possibly some
> other Windows Mobile models) don't return any services if you ask them
> for the public browse group.  You notice this, when "sdptool browse
> xx:xx:xx:xx:xx:xx" returns immediately, without any output.
> 
> It turns out that the Windows XP Bluetooth browser asks for
> L2CAP_UUID, which *does* work for all the phones I've tested.
> 
> So I've made this simple patch, that adds a `-l' or `--l2cap' command
> line option to sdptool, to use the L2CAP_UUID for browsing, instead of
> PUBLIC_BROWSE_GROUP.

the patch is applied to the CVS. Maybe we should add another one to
browse any UUID in general. Something like "--uuid 0x0003" for example.

A small nitpick about the coding style. The braces around context.group
are not needed and normally we don't use them.

	sdp_uuid16_create(&(context.group), L2CAP_UUID);

I also realized that you only followed the example above that creates
the public browse group context (which I fixed now). So please keep that
in mind the next time.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-05 15:27 ` Marcel Holtmann
@ 2005-04-07 12:08   ` Dimitry Andric
  2005-04-07 13:44     ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Dimitry Andric @ 2005-04-07 12:08 UTC (permalink / raw)
  To: Marcel Holtmann

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

On 2005-04-05 at 17:27:17 Marcel Holtmann wrote:

> the patch is applied to the CVS. Maybe we should add another one to
> browse any UUID in general. Something like "--uuid 0x0003" for example.

Here is a patch that adds such an option.  It will be interesting to
see what browse info is returned with various weird uuid's. :)

[-- Attachment #2: bluez-utils-2.15-sdpbrowse-uuid.patch --]
[-- Type: text/plain, Size: 1545 bytes --]

# bluez-utils-2.15-sdpbrowse-uuid.patch
#
# This patch adds a `--uuid' command line option to sdptool, to specify the
# uuid of an arbitrary protocol for browsing, instead of PUBLIC_BROWSE_GROUP.
# The uuid can be specified in decimal, hex (using a '0x' prefix) or octal
# (using a '0' prefix).
#
# Dimitry Andric <dimitry@andric.com>, 2005-04-07 13:59:21

Index: tools/sdptool.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/sdptool.c,v
retrieving revision 1.20
diff -u -d -r1.20 sdptool.c
--- tools/sdptool.c	5 Apr 2005 15:20:10 -0000	1.20
+++ tools/sdptool.c	7 Apr 2005 11:56:27 -0000
@@ -2097,12 +2097,13 @@
 	{ "help",    0,0, 'h' },
 	{ "tree",    0,0, 't' },
 	{ "l2cap",   0,0, 'l' },
+	{ "uuid",    1,0, 'u' },
 	{ 0, 0, 0, 0 }
 };
 
 static char *browse_help = 
 	"Usage:\n"
-	"\tbrowse [--tree] [--l2cap] [bdaddr]\n";
+	"\tbrowse [--tree] [--l2cap] [--uuid uuid] [bdaddr]\n";
 
 /*
  * Browse the full SDP database (i.e. list all services starting from the
@@ -2112,6 +2113,7 @@
 {
 	struct search_context context;
 	int opt;
+	int num;
 
 	/* Initialise context */
 	memset(&context, '\0', sizeof(struct search_context));
@@ -2126,6 +2128,13 @@
 		case 'l':
 			sdp_uuid16_create(&context.group, L2CAP_UUID);
 			break;
+		case 'u':
+			if (sscanf(optarg, "%i", &num) != 1 || num < 0 || num > 0xffff) {
+				printf("Invalid uuid %s\n", optarg);
+				return -1;
+			}
+			sdp_uuid16_create(&context.group, num);
+			break;
 		default:
 			printf(browse_help);
 			return -1;

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-07 12:08   ` Dimitry Andric
@ 2005-04-07 13:44     ` Marcel Holtmann
  2005-04-07 19:19       ` Dimitry Andric
  0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2005-04-07 13:44 UTC (permalink / raw)
  To: BlueZ Mailing List

Hi Dimitry,

> > the patch is applied to the CVS. Maybe we should add another one to
> > browse any UUID in general. Something like "--uuid 0x0003" for example.
> 
> Here is a patch that adds such an option.  It will be interesting to
> see what browse info is returned with various weird uuid's. :)

patch is applied.

Maybe we should add somekind of short name to UUID translation function,
because the numeric values are hard to remember.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-07 13:44     ` Marcel Holtmann
@ 2005-04-07 19:19       ` Dimitry Andric
  2005-04-11 16:22         ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Dimitry Andric @ 2005-04-07 19:19 UTC (permalink / raw)
  To: Marcel Holtmann

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

On 2005-04-07 at 15:44:50 Marcel Holtmann wrote:

> Maybe we should add somekind of short name to UUID translation function,
> because the numeric values are hard to remember.

Here's an easy hack: I reused the existing uuid16_names array for
looking up (partial) matches.  You can also get a list of recognized
names.  If you think it would be nicer to add a separate name list
(i.e. made from the names in sdp.h), let me know.

[-- Attachment #2: bluez-utils-2.15-sdpbrowse-uuid2.patch --]
[-- Type: text/plain, Size: 2385 bytes --]

# bluez-utils-2.15-sdpbrowse-uuid2.patch
#
# Extend the --uuid option of sdptool browse, to additionally recognize uuid's
# by name instead of number.  The existing uuid16_names array is used for this
# purpose.  You don't have to specify the full name, as long as it matches
# unambiguously.  Also, by specifying "--uuid list", you can get a full list of
# available uuid names.
#
# Dimitry Andric <dimitry@andric.com>, 2005-04-07 21:05:35

Index: tools/sdptool.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/sdptool.c,v
retrieving revision 1.21
diff -u -d -r1.21 sdptool.c
--- tools/sdptool.c	7 Apr 2005 13:43:23 -0000	1.21
+++ tools/sdptool.c	7 Apr 2005 19:03:34 -0000
@@ -2103,7 +2103,8 @@
 
 static char *browse_help = 
 	"Usage:\n"
-	"\tbrowse [--tree] [--uuid uuid] [--l2cap] [bdaddr]\n";
+	"\tbrowse [--tree] [--uuid uuid] [--l2cap] [bdaddr]\n"
+	"Use --uuid list to get a list of possible UUIDs\n";
 
 /*
  * Browse the full SDP database (i.e. list all services starting from the
@@ -2112,7 +2113,7 @@
 static int cmd_browse(int argc, char **argv)
 {
 	struct search_context context;
-	int opt, num;
+	int opt, i;
 
 	/* Initialise context */
 	memset(&context, '\0', sizeof(struct search_context));
@@ -2125,11 +2126,34 @@
 			context.tree = 1;
 			break;
 		case 'u':
-			if (sscanf(optarg, "%i", &num) != 1 || num < 0 || num > 0xffff) {
-				printf("Invalid uuid %s\n", optarg);
+			if (!strcasecmp(optarg, "list")) {
+				for (i = 0; i < uuid16_max; ++i)
+					printf("0x%04x: %s\n", uuid16_names[i].num, uuid16_names[i].name);
 				return -1;
+			} else if (sscanf(optarg, "%i", &i) == 1) {
+				if (i < 0 || i > 0xffff) {
+					printf("Invalid uuid %s\n", optarg);
+					return -1;
+				}
+				sdp_uuid16_create(&context.group, i);
+			} else {
+				int len = strlen(optarg);
+				int match = -1;
+				for (i = 0; i < uuid16_max; ++i) {
+					if (!strncasecmp(optarg, uuid16_names[i].name, len)) {
+						if (match >= 0) {
+							printf("Ambiguous uuid %s\n", optarg);
+							return -1;
+						}
+						match = i;
+					}
+				}
+				if (match < 0) {
+					printf("Invalid uuid %s\n", optarg);
+					return -1;
+				}
+				sdp_uuid16_create(&context.group, uuid16_names[match].num);
 			}
-			sdp_uuid16_create(&context.group, num);
 			break;
 		case 'l':
 			sdp_uuid16_create(&context.group, L2CAP_UUID);

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

* Re: [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID
  2005-04-07 19:19       ` Dimitry Andric
@ 2005-04-11 16:22         ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2005-04-11 16:22 UTC (permalink / raw)
  To: bluez-devel

Hi Dimitry,

> > Maybe we should add somekind of short name to UUID translation function,
> > because the numeric values are hard to remember.
> 
> Here's an easy hack: I reused the existing uuid16_names array for
> looking up (partial) matches.  You can also get a list of recognized
> names.  If you think it would be nicer to add a separate name list
> (i.e. made from the names in sdp.h), let me know.

this is really a hack ;)

I think that we need a special table for this, where we add short names
(and I mean short) for some UUIDs. Maybe it is enough to look up the
core protocol names like L2CAP, RFCOMM and OBEX. This would then also
make the --l2cap option obsolete. You can use "--uuid l2cap" for it.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2005-04-11 16:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-04 15:16 [Bluez-devel] [PATCH] Add sdptool option for browsing with L2CAP_UUID Dimitry Andric
2005-04-05  8:20 ` Johan Hedberg
2005-04-05  8:40   ` Peter Wippich
2005-04-05 15:27 ` Marcel Holtmann
2005-04-07 12:08   ` Dimitry Andric
2005-04-07 13:44     ` Marcel Holtmann
2005-04-07 19:19       ` Dimitry Andric
2005-04-11 16:22         ` Marcel Holtmann

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.