Bug 136386 - [bluetooth] [headers] [request] Can the following bluez macros be added to bluetooth.h
Summary: [bluetooth] [headers] [request] Can the following bluez macros be added to bl...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bluetooth (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-06 19:40 UTC by Monty Hall
Modified: 2010-09-29 19:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Monty Hall 2009-07-06 19:40:00 UTC
I'm porting some linux bluetooth software and have run into the macros, show below, several times.  Currently a few bluez macros are in bluetooth.h. I was wondering if the following can be added as well.

Fix: 

bluetooth.h

/* Byte order conversions */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htobs(d)  (d)
#define htobl(d)  (d)
#define btohs(d)  (d)
#define btohl(d)  (d)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define htobs(d)  bswap_16(d)
#define htobl(d)  bswap_32(d)
#define btohs(d)  bswap_16(d)
#define btohl(d)  bswap_32(d)
#else
#error "Unknown byte order"
#endif
Comment 1 Monty Hall 2009-07-08 14:42:52 UTC
Please use: kungfu_disciple@sbcglobal.net
Comment 2 Alexander Best freebsd_committer freebsd_triage 2010-09-23 00:06:44 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-bluetooth

Over to maintainer(s).
Comment 3 dfilter service freebsd_committer freebsd_triage 2010-09-23 00:41:07 UTC
Author: emax
Date: Wed Sep 22 23:41:02 2010
New Revision: 213042
URL: http://svn.freebsd.org/changeset/base/213042

Log:
  Add the following Linux BlueZ compatibility macros: htobs(), htobl(),
  btohs() and btohl()
  
  PR:		kern/136386
  Submitted by:	Monty Hall < kungfu_disciple at sbcglobal dot net >
  MFC after:	1 week

Modified:
  head/lib/libbluetooth/bluetooth.h

Modified: head/lib/libbluetooth/bluetooth.h
==============================================================================
--- head/lib/libbluetooth/bluetooth.h	Wed Sep 22 22:17:39 2010	(r213041)
+++ head/lib/libbluetooth/bluetooth.h	Wed Sep 22 23:41:02 2010	(r213042)
@@ -59,6 +59,10 @@ __BEGIN_DECLS
 #define	bacpy(dst, src)	memcpy((dst), (src), sizeof(bdaddr_t))
 #define ba2str(ba, str)	bt_ntoa((ba), (str))
 #define str2ba(str, ba)	(bt_aton((str), (ba)) == 1? 0 : -1)
+#define htobs(d)	htole16(d)
+#define htobl(d)	htole32(d)
+#define btohs(d)	le16toh(d)
+#define btohl(d)	le32toh(d)
 
 /*
  * Interface to the outside world
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 emax freebsd_committer freebsd_triage 2010-09-23 00:41:52 UTC
State Changed
From-To: open->patched

fix committed to head
Comment 5 dfilter service freebsd_committer freebsd_triage 2010-09-29 19:41:53 UTC
Author: emax
Date: Wed Sep 29 18:41:47 2010
New Revision: 213276
URL: http://svn.freebsd.org/changeset/base/213276

Log:
  MFC Revision: 213042
  
  Add the following Linux BlueZ compatibility macros: htobs(), htobl(),
  btohs() and btohl()
  
  PR:		kern/136386
  Submitted by:	Monty Hall < kungfu_disciple at sbcglobal dot net >

Modified:
  stable/8/lib/libbluetooth/bluetooth.h
Directory Properties:
  stable/8/lib/libbluetooth/   (props changed)

Modified: stable/8/lib/libbluetooth/bluetooth.h
==============================================================================
--- stable/8/lib/libbluetooth/bluetooth.h	Wed Sep 29 14:46:57 2010	(r213275)
+++ stable/8/lib/libbluetooth/bluetooth.h	Wed Sep 29 18:41:47 2010	(r213276)
@@ -59,6 +59,10 @@ __BEGIN_DECLS
 #define	bacpy(dst, src)	memcpy((dst), (src), sizeof(bdaddr_t))
 #define ba2str(ba, str)	bt_ntoa((ba), (str))
 #define str2ba(str, ba)	(bt_aton((str), (ba)) == 1? 0 : -1)
+#define htobs(d)	htole16(d)
+#define htobl(d)	htole32(d)
+#define btohs(d)	le16toh(d)
+#define btohl(d)	le32toh(d)
 
 /*
  * Interface to the outside world
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 6 emax freebsd_committer freebsd_triage 2010-09-29 19:42:32 UTC
State Changed
From-To: patched->closed

Fixed in CURRENT and RELENG_8