Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order
@ 2011-09-14 15:46 Antonio Ospite
  2011-09-14 17:53 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Antonio Ospite @ 2011-09-14 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Antonio Ospite

lib/bluetooth.c::batostr() is returning the bdaddr reversed, fix this
and put more arguments on the same line to look more like ba2str().
---
 lib/bluetooth.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/bluetooth.c b/lib/bluetooth.c
index db7bbe1..8509620 100644
--- a/lib/bluetooth.c
+++ b/lib/bluetooth.c
@@ -55,8 +55,7 @@ char *batostr(const bdaddr_t *ba)
 		return NULL;
 
 	sprintf(str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
-		ba->b[0], ba->b[1], ba->b[2],
-		ba->b[3], ba->b[4], ba->b[5]);
+		ba->b[5], ba->b[4], ba->b[3], ba->b[2], ba->b[1], ba->b[0]);
 
 	return str;
 }
-- 
1.7.5.4


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

* Re: [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order
  2011-09-14 15:46 [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order Antonio Ospite
@ 2011-09-14 17:53 ` Marcel Holtmann
  2011-09-14 19:08   ` Antonio Ospite
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2011-09-14 17:53 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: linux-bluetooth

Hi Antonio,

> lib/bluetooth.c::batostr() is returning the bdaddr reversed, fix this
> and put more arguments on the same line to look more like ba2str().

this would be breaking existing API. So NAK.

Regards

Marcel



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

* Re: [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order
  2011-09-14 17:53 ` Marcel Holtmann
@ 2011-09-14 19:08   ` Antonio Ospite
  2011-09-19 11:02     ` Antonio Ospite
  0 siblings, 1 reply; 5+ messages in thread
From: Antonio Ospite @ 2011-09-14 19:08 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

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

On Wed, 14 Sep 2011 19:53:45 +0200
Marcel Holtmann <marcel@holtmann.org> wrote:

> Hi Antonio,
> 
> > lib/bluetooth.c::batostr() is returning the bdaddr reversed, fix this
> > and put more arguments on the same line to look more like ba2str().
> 
> this would be breaking existing API. So NAK.
> 

OK, but it is still weird that batostr() and ba2str() work differently.
batostr() has no in-tree user AFAICS, just FYI.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order
  2011-09-14 19:08   ` Antonio Ospite
@ 2011-09-19 11:02     ` Antonio Ospite
  2011-09-19 11:14       ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Antonio Ospite @ 2011-09-19 11:02 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

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

On Wed, 14 Sep 2011 21:08:12 +0200
Antonio Ospite <ospite@studenti.unina.it> wrote:

> On Wed, 14 Sep 2011 19:53:45 +0200
> Marcel Holtmann <marcel@holtmann.org> wrote:
> 
> > Hi Antonio,
> > 
> > > lib/bluetooth.c::batostr() is returning the bdaddr reversed, fix this
> > > and put more arguments on the same line to look more like ba2str().
> > 
> > this would be breaking existing API. So NAK.
> > 
> 
> OK, but it is still weird that batostr() and ba2str() work differently.
> batostr() has no in-tree user AFAICS, just FYI.
> 

Would a batostr_bis() which behaves more like ba2str() wrt. bdaddr
ordering be accepted, or do I just duplicate the code in my function?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order
  2011-09-19 11:02     ` Antonio Ospite
@ 2011-09-19 11:14       ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-09-19 11:14 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: linux-bluetooth

Hi Antonio,

> > > > lib/bluetooth.c::batostr() is returning the bdaddr reversed, fix this
> > > > and put more arguments on the same line to look more like ba2str().
> > > 
> > > this would be breaking existing API. So NAK.
> > > 
> > 
> > OK, but it is still weird that batostr() and ba2str() work differently.
> > batostr() has no in-tree user AFAICS, just FYI.
> > 
> 
> Would a batostr_bis() which behaves more like ba2str() wrt. bdaddr
> ordering be accepted, or do I just duplicate the code in my function?

just simply use ba2str. With batostr you have potential side effects
with the lifetime of the return memory anyway. That is also the reason
why none of the official BlueZ utilities or the daemon uses it.

Regards

Marcel



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

end of thread, other threads:[~2011-09-19 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 15:46 [PATCH BlueZ] Fix batostr(): return the bdaddr in the right order Antonio Ospite
2011-09-14 17:53 ` Marcel Holtmann
2011-09-14 19:08   ` Antonio Ospite
2011-09-19 11:02     ` Antonio Ospite
2011-09-19 11:14       ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox