From c695c758923e988242b6f3517699ce2d1853ef42 Mon Sep 17 00:00:00 2001 From: xtraeme Date: Sun, 9 Jul 2006 16:35:31 +0000 Subject: Clean up previous patches for NetBSD bluetooth support. IMHO I can send them to the author now. --- comms/obexapp/Makefile | 6 +- comms/obexapp/distinfo | 11 ++-- comms/obexapp/patches/patch-aa | 29 ++++++---- comms/obexapp/patches/patch-ab | 116 +++---------------------------------- comms/obexapp/patches/patch-ac | 25 ++++---- comms/obexapp/patches/patch-ad | 127 ++++------------------------------------- comms/obexapp/patches/patch-ae | 13 ----- 7 files changed, 55 insertions(+), 272 deletions(-) delete mode 100644 comms/obexapp/patches/patch-ae (limited to 'comms/obexapp') diff --git a/comms/obexapp/Makefile b/comms/obexapp/Makefile index d9ebb8f0ffa..d178339a119 100644 --- a/comms/obexapp/Makefile +++ b/comms/obexapp/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2006/07/02 18:24:18 xtraeme Exp $ +# $NetBSD: Makefile,v 1.3 2006/07/09 16:35:31 xtraeme Exp $ # DISTNAME= obexapp-1.4.4 @@ -24,13 +24,9 @@ SUBST_SED.mk+= -e "s|CFLAGS=|CFLAGS+=|" # Sigh, this needs the GNU libiconv. USE_GNU_ICONV= yes -# Version that contains support for NetBSD/bluetooth. -BUILDLINK_ABI_DEPENDS.openobex+= openobex>=1.0.1nb3 - # Sigh... too many warnings with GCC 4.x, disable them for now. CFLAGS+= -w - .include "../../comms/openobex/buildlink3.mk" .include "../../converters/libiconv/buildlink3.mk" .include "../../devel/readline/buildlink3.mk" diff --git a/comms/obexapp/distinfo b/comms/obexapp/distinfo index 027591fde77..a0091d895ce 100644 --- a/comms/obexapp/distinfo +++ b/comms/obexapp/distinfo @@ -1,10 +1,9 @@ -$NetBSD: distinfo,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ +$NetBSD: distinfo,v 1.2 2006/07/09 16:35:31 xtraeme Exp $ SHA1 (obexapp-1.4.4.tar.gz) = 4d99ff1e636109dd8013d1c4bc5b2852103e4071 RMD160 (obexapp-1.4.4.tar.gz) = d4ca4229e8e63158366bef72e39323b249aca614 Size (obexapp-1.4.4.tar.gz) = 245156 bytes -SHA1 (patch-aa) = 72d58a720378787f2083f55a46dc62a146a10f95 -SHA1 (patch-ab) = 8b6f6f84ba815bc3416822cfbe1fa76ae751b909 -SHA1 (patch-ac) = 0ea10dd4847237fbc8dcb0bfce7e20248d2867b1 -SHA1 (patch-ad) = 02c68786f9621ad4ff4c68653973a549e82de0f7 -SHA1 (patch-ae) = d9a09e9ca0118ebb489507e2fe9965fbded4552b +SHA1 (patch-aa) = 28d245c716a6d8fd57607dd74f239f165da9f4ac +SHA1 (patch-ab) = a0355450e8af326a24d6db5af436851e67d4d395 +SHA1 (patch-ac) = d9a09e9ca0118ebb489507e2fe9965fbded4552b +SHA1 (patch-ad) = cad2be971aa84774f3c4788886860e5982eb0d15 diff --git a/comms/obexapp/patches/patch-aa b/comms/obexapp/patches/patch-aa index 5fcd5c57f3f..1063f94862c 100644 --- a/comms/obexapp/patches/patch-aa +++ b/comms/obexapp/patches/patch-aa @@ -1,16 +1,21 @@ -$NetBSD: patch-aa,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ +$NetBSD: patch-aa,v 1.2 2006/07/09 16:35:31 xtraeme Exp $ ---- obexapp.h.orig 2006-07-02 19:32:51.000000000 +0200 -+++ obexapp.h 2006-07-02 19:33:45.000000000 +0200 -@@ -71,7 +71,11 @@ +--- obexapp.h.orig 2004-12-29 22:49:05.000000000 +0100 ++++ obexapp.h 2006-07-09 18:23:44.000000000 +0200 +@@ -32,6 +32,16 @@ + #ifndef _OBEXAPP_H_ + #define _OBEXAPP_H_ - struct context - { +#ifdef __NetBSD__ -+ struct sockaddr_bt addr; /* remote address */ -+#else - struct sockaddr_rfcomm addr; /* remote address */ ++#define BLUETOOTH_PROTO_RFCOMM BTPROTO_RFCOMM ++#define NG_HCI_BDADDR_ANY BDADDR_ANY ++#define sockaddr_rfcomm sockaddr_bt ++#define rfcomm_bdaddr bt_bdaddr ++#define rfcomm_channel bt_channel ++#define rfcomm_len bt_len ++#define rfcomm_family bt_family +#endif - bdaddr_t saddr; /* local address */ - char *root; /* root path */ - char *user; /* user */ ++ + /* + * Defines + */ diff --git a/comms/obexapp/patches/patch-ab b/comms/obexapp/patches/patch-ab index 36b79c26102..27f44ecd85b 100644 --- a/comms/obexapp/patches/patch-ab +++ b/comms/obexapp/patches/patch-ab @@ -1,113 +1,15 @@ -$NetBSD: patch-ab,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ +$NetBSD: patch-ab,v 1.2 2006/07/09 16:35:31 xtraeme Exp $ ---- main.c.orig 2004-12-24 00:09:48.000000000 +0100 -+++ main.c 2006-07-02 19:48:19.000000000 +0200 -@@ -90,8 +90,13 @@ +--- sdp.c.orig 2003-09-07 21:00:55.000000000 +0200 ++++ sdp.c 2006-07-09 18:27:44.000000000 +0200 +@@ -34,6 +34,10 @@ + #include + #include - /* Prepare context */ - memset(&context, 0, sizeof(context)); +#ifdef __NetBSD__ -+ context.addr.bt_len = sizeof(context.addr.bt_len); -+ context.addr.bt_family = AF_BLUETOOTH; -+#else - context.addr.rfcomm_len = sizeof(context.addr.rfcomm_len); - context.addr.rfcomm_family = AF_BLUETOOTH; ++#define NG_HCI_BDADDR_ANY BDADDR_ANY +#endif - context.tfd = context.sfd = -1; - context.detach = 1; - -@@ -148,15 +153,23 @@ - while ((n = getopt(argc, argv, "a:A:cC:dDfhnr:Ssu:")) != -1) { - switch (n) { - case 'a': -+#ifdef __NetBSD__ -+ if (!bt_aton(optarg, &context.addr.bt_bdaddr)) { -+#else - if (!bt_aton(optarg, &context.addr.rfcomm_bdaddr)) { -+#endif - struct hostent *he = bt_gethostbyname(optarg); - - if (he == NULL) - errx(1, "%s: %s", optarg, - hstrerror(h_errno)); -- -+#ifdef __NetBSD__ -+ memcpy(&context.addr.bt_bdaddr, he->h_addr, -+ sizeof(context.addr.bt_bdaddr)); -+#else - memcpy(&context.addr.rfcomm_bdaddr, he->h_addr, - sizeof(context.addr.rfcomm_bdaddr)); -+#endif - } - break; - -@@ -178,11 +191,19 @@ - break; - - case 'C': /* channel to listen on or connect to */ -+#ifdef __NetBSD__ -+ context.addr.bt_channel = strtoul(optarg, &ep, 10); -+#else - context.addr.rfcomm_channel = strtoul(optarg, &ep, 10); -+#endif - if (*ep != '\0') { -+#ifdef __NetBSD__ -+ context.addr.bt_channel = 0; -+#else - context.addr.rfcomm_channel = 0; -+#endif - -- switch (tolower(optarg[0])) { -+ switch (tolower((unsigned char)optarg[0])) { - case 'i': /* IrMC */ - service = SDP_SERVICE_CLASS_IR_MC_SYNC; - break; -@@ -254,10 +275,25 @@ - argv += optind; - - if (!context.server) { -+#ifdef __NetBSD__ -+ if (memcmp(&context.addr.bt_bdaddr, -+ BDADDR_ANY, sizeof(context.addr.bt_bdaddr)) == 0) -+ errx(1, "Must specify server BD_ADDR"); -+ -+ /* Check channel, if was not set then obtain it via SDP */ -+ if (context.addr.bt_channel == 0 && service != 0) { -+ int channel; -+ -+ if (rfcomm_channel_lookup(NULL, -+ &context.addr.bt_bdaddr, -+ service, &channel, &n) != 0) -+ errx(1, "Could not obtain RFCOMM channel"); + -+ context.addr.bt_channel = (u_int8_t) channel; -+#else - if (memcmp(&context.addr.rfcomm_bdaddr, - NG_HCI_BDADDR_ANY, sizeof(context.addr.rfcomm_bdaddr)) == 0) - errx(1, "Must specify server BD_ADDR"); -- - /* Check channel, if was not set then obtain it via SDP */ - if (context.addr.rfcomm_channel == 0 && service != 0) { - int channel; -@@ -268,13 +304,21 @@ - errc(1, n, "Could not obtain RFCOMM channel"); - - context.addr.rfcomm_channel = (u_int8_t) channel; -+#endif - } - } - -+#ifdef __NetBSD__ -+ if (context.addr.bt_channel <= 0 || -+ context.addr.bt_channel > 30) -+ errx(1, "Invalid RFCOMM channel %d", -+ context.addr.bt_channel); -+#else - if (context.addr.rfcomm_channel <= 0 || - context.addr.rfcomm_channel > 30) - errx(1, "Invalid RFCOMM channel %d", - context.addr.rfcomm_channel); -+#endif + #undef PROTOCOL_DESCRIPTOR_LIST_BUFFER_SIZE + #define PROTOCOL_DESCRIPTOR_LIST_BUFFER_SIZE 256 - /* Detach server (if required) */ - if (context.server && context.detach) { diff --git a/comms/obexapp/patches/patch-ac b/comms/obexapp/patches/patch-ac index 3a9cff99ff6..e2937a95a38 100644 --- a/comms/obexapp/patches/patch-ac +++ b/comms/obexapp/patches/patch-ac @@ -1,16 +1,13 @@ -$NetBSD: patch-ac,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ +$NetBSD: patch-ac,v 1.2 2006/07/09 16:35:31 xtraeme Exp $ ---- sdp.c.orig 2006-07-02 19:51:38.000000000 +0200 -+++ sdp.c 2006-07-02 19:52:05.000000000 +0200 -@@ -72,7 +72,11 @@ - u_int32_t type, len; - - if (local == NULL) -+#ifdef __NetBSD__ -+ local = BDADDR_ANY; -+#else - local = NG_HCI_BDADDR_ANY; -+#endif - if (remote == NULL || channel == NULL) - rfcomm_channel_lookup_exit(EINVAL); +--- util.c.orig 2006-07-02 20:07:59.000000000 +0200 ++++ util.c 2006-07-02 20:08:07.000000000 +0200 +@@ -30,7 +30,7 @@ + */ + #include +-#include ++#include + #include + #include + #include diff --git a/comms/obexapp/patches/patch-ad b/comms/obexapp/patches/patch-ad index ef99c28cf20..e69d3ee8f99 100644 --- a/comms/obexapp/patches/patch-ad +++ b/comms/obexapp/patches/patch-ad @@ -1,116 +1,13 @@ -$NetBSD: patch-ad,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ +$NetBSD: patch-ad,v 1.2 2006/07/09 16:35:31 xtraeme Exp $ ---- transport.c.orig 2006-07-02 19:52:50.000000000 +0200 -+++ transport.c 2006-07-02 19:59:19.000000000 +0200 -@@ -53,7 +53,11 @@ - obexapp_transport_connect(obex_t *handle, void *userdata) - { - context_p context = (context_p) userdata; -- struct sockaddr_rfcomm addr; -+#ifdef __NetBSD__ -+ struct sockaddr_bt addr; -+#else -+ struct sockaddr_rfcomm addr -+#endif - - syslog(LOG_DEBUG, "%s()", __func__); - -@@ -63,21 +67,36 @@ - return (-1); - } - -+#ifdef __NetBSD__ -+ syslog(LOG_INFO, "%s(): Connecting to %s/%d, pid=%d", -+ __func__, bt_ntoa(&context->addr.bt_bdaddr, NULL), -+ context->addr.bt_channel, getpid()); -+ -+ context->tfd = socket(PF_BLUETOOTH,SOCK_STREAM,BTPROTO_RFCOMM); -+#else - syslog(LOG_INFO, "%s(): Connecting to %s/%d, pid=%d", - __func__, bt_ntoa(&context->addr.rfcomm_bdaddr, NULL), - context->addr.rfcomm_channel, getpid()); - - context->tfd = socket(PF_BLUETOOTH,SOCK_STREAM,BLUETOOTH_PROTO_RFCOMM); -+#endif - if (context->tfd < 0) { - syslog(LOG_ERR, "%s(): Could not create socket. %s (%d)", - __func__, strerror(errno), errno); - return (-1); - } - -+#ifdef __NetBSD__ -+ addr.bt_len = sizeof(addr); -+ addr.bt_family = AF_BLUETOOTH; -+ memcpy(&addr.bt_bdaddr, &context->saddr, sizeof(addr.bt_bdaddr)); -+ addr.bt_channel = 0; -+#else - addr.rfcomm_len = sizeof(addr); - addr.rfcomm_family = AF_BLUETOOTH; - memcpy(&addr.rfcomm_bdaddr, &context->saddr, sizeof(addr.rfcomm_bdaddr)); - addr.rfcomm_channel = 0; -+#endif - - if (bind(context->tfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - syslog(LOG_ERR, "%s(): Could not bind socket. %s (%d)", -@@ -157,7 +176,11 @@ - obexapp_transport_listen(obex_t *handle, void *userdata) - { - context_p context = (context_p) userdata; -+#ifdef __NetBSD__ -+ struct sockaddr_bt addr; -+#else - struct sockaddr_rfcomm addr; -+#endif - socklen_t addrlen; - pid_t pid; - int s; -@@ -171,7 +194,11 @@ - return (1); - } - -+#ifdef __NetBSD__ -+ s = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); -+#else - s = socket(PF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM); -+#endif - if (s < 0) { - syslog(LOG_ERR, "%s(): Could not create socket. %s (%d)", - __func__, strerror(errno), errno); -@@ -192,7 +219,11 @@ - } - - memset(&opush, 0, sizeof(opush)); -+#ifdef __NetBSD__ -+ opush.server_channel = context->addr.bt_channel; -+#else - opush.server_channel = context->addr.rfcomm_channel; -+#endif - opush.supported_formats_size = 7; - opush.supported_formats[0] = 0x1; - opush.supported_formats[1] = 0x2; -@@ -204,7 +235,11 @@ - - if (sdp_register_service(context->ss, - SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH, -+#ifdef __NetBSD__ -+ &context->addr.bt_bdaddr, -+#else - &context->addr.rfcomm_bdaddr, -+#endif - (void *) &opush, sizeof(opush), NULL) != 0) { - syslog(LOG_ERR, "%s(): Could to register OPUSH service with " \ - "local SDP daemon. %s (%d)", -@@ -239,8 +274,13 @@ - - syslog(LOG_INFO, "%s(): Accepted new connection from " \ - "%s/%d, pid=%d", __func__, -+#ifdef __NetBSD__ -+ bt_ntoa(&addr.bt_bdaddr, NULL), -+ addr.bt_channel, getpid()); -+#else - bt_ntoa(&addr.rfcomm_bdaddr, NULL), - addr.rfcomm_channel, getpid()); -+#endif - - if (daemon(1, 0) < 0) { - syslog(LOG_ERR, "%s(): Could not daemon. %s (%d)", +--- main.c.orig 2006-07-09 18:28:27.000000000 +0200 ++++ main.c 2006-07-09 18:28:37.000000000 +0200 +@@ -265,7 +265,7 @@ + if (rfcomm_channel_lookup(NULL, + &context.addr.rfcomm_bdaddr, + service, &channel, &n) != 0) +- errc(1, n, "Could not obtain RFCOMM channel"); ++ errx(1, "Could not obtain RFCOMM channel"); + + context.addr.rfcomm_channel = (u_int8_t) channel; + } diff --git a/comms/obexapp/patches/patch-ae b/comms/obexapp/patches/patch-ae deleted file mode 100644 index 608d748ec7f..00000000000 --- a/comms/obexapp/patches/patch-ae +++ /dev/null @@ -1,13 +0,0 @@ -$NetBSD: patch-ae,v 1.1.1.1 2006/07/02 18:18:34 xtraeme Exp $ - ---- util.c.orig 2006-07-02 20:07:59.000000000 +0200 -+++ util.c 2006-07-02 20:08:07.000000000 +0200 -@@ -30,7 +30,7 @@ - */ - - #include --#include -+#include - #include - #include - #include -- cgit v1.2.3