Hello community,
here is the log from the commit of package bluez
checked in at Sun Nov 23 08:29:04 CET 2008.
--------
--- bluez/bluez.changes 2008-11-11 09:28:49.000000000 +0100
+++ /mounts/work_src_done/STABLE/bluez/bluez.changes 2008-11-23 02:08:13.000000000 +0100
@@ -1,0 +2,10 @@
+Sun Nov 23 01:10:59 CET 2008 - seife@suse.de
+
+- update to bluez-4.19:
+ - Fix D-Bus signal emmissions for CreateDevice.
+ - Fix issues with UUID probing.
+ - Fix +BSRF syntax issue.
+ - Add Pairable adapter property.
+ - Add sdp_copy_record() library function.
+
+-------------------------------------------------------------------
bluez-gstreamer.changes: same change
calling whatdependson for head-i586
Old:
----
bluez-4.18.tar.bz2
New:
----
bluez-4.19.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ bluez-gstreamer.spec ++++++
--- /var/tmp/diff_new_pack.uS1252/_old 2008-11-23 08:28:39.000000000 +0100
+++ /var/tmp/diff_new_pack.uS1252/_new 2008-11-23 08:28:39.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package bluez-gstreamer (Version 4.18)
+# spec file for package bluez-gstreamer (Version 4.19)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -24,7 +24,7 @@
BuildRequires: alsa-devel libsndfile-devel
BuildRequires: gstreamer-0_10-devel gstreamer-0_10-plugins-base-devel
Url: http://www.bluez.org
-Version: 4.18
+Version: 4.19
Release: 1
Summary: Bluetooth Sound Support
Group: Productivity/Multimedia/Sound/Utilities
@@ -109,6 +109,13 @@
%{_libdir}/gstreamer-*/*.so
%changelog
+* Sun Nov 23 2008 seife@suse.de
+- update to bluez-4.19:
+ - Fix D-Bus signal emmissions for CreateDevice.
+ - Fix issues with UUID probing.
+ - Fix +BSRF syntax issue.
+ - Add Pairable adapter property.
+ - Add sdp_copy_record() library function.
* Tue Nov 11 2008 seife@suse.de
- add bluez-compat package, containing pand and dund (bnc#435591)
* Mon Nov 10 2008 seife@suse.de
++++++ bluez.spec ++++++
--- /var/tmp/diff_new_pack.uS1252/_old 2008-11-23 08:28:39.000000000 +0100
+++ /var/tmp/diff_new_pack.uS1252/_new 2008-11-23 08:28:39.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package bluez (Version 4.18)
+# spec file for package bluez (Version 4.19)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -23,7 +23,7 @@
BuildRequires: glib2-devel libnl-devel libusb-devel
BuildRequires: alsa-devel libsndfile-devel
Url: http://www.bluez.org
-Version: 4.18
+Version: 4.19
Release: 1
Summary: Bluetooth Stack for Linux
Group: Hardware/Mobile
@@ -349,6 +349,13 @@
%doc %{_mandir}/man1/dund.1.gz
%changelog
+* Sun Nov 23 2008 seife@suse.de
+- update to bluez-4.19:
+ - Fix D-Bus signal emmissions for CreateDevice.
+ - Fix issues with UUID probing.
+ - Fix +BSRF syntax issue.
+ - Add Pairable adapter property.
+ - Add sdp_copy_record() library function.
* Tue Nov 11 2008 seife@suse.de
- add bluez-compat package, containing pand and dund (bnc#435591)
* Mon Nov 10 2008 seife@suse.de
++++++ bluez-4.18.tar.bz2 -> bluez-4.19.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/audio/a2dp.c new/bluez-4.19/audio/a2dp.c
--- old/bluez-4.18/audio/a2dp.c 2008-10-26 07:40:34.000000000 +0100
+++ new/bluez-4.19/audio/a2dp.c 2008-11-21 11:15:40.000000000 +0100
@@ -46,7 +46,7 @@
/* The duration that streams without users are allowed to stay in
* STREAMING state. */
-#define SUSPEND_TIMEOUT 5000
+#define SUSPEND_TIMEOUT 5
#define RECONFIGURE_TIMEOUT 500
#ifndef MIN
@@ -610,7 +610,7 @@
if (!a2dp_sep->locked) {
a2dp_sep->session = avdtp_ref(session);
- a2dp_sep->suspend_timer = g_timeout_add(SUSPEND_TIMEOUT,
+ a2dp_sep->suspend_timer = g_timeout_add_seconds(SUSPEND_TIMEOUT,
(GSourceFunc) suspend_timeout,
a2dp_sep);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/audio/avdtp.c new/bluez-4.19/audio/avdtp.c
--- old/bluez-4.18/audio/avdtp.c 2008-10-26 07:40:34.000000000 +0100
+++ new/bluez-4.19/audio/avdtp.c 2008-11-21 11:15:40.000000000 +0100
@@ -79,9 +79,9 @@
#define AVDTP_MSG_TYPE_ACCEPT 0x02
#define AVDTP_MSG_TYPE_REJECT 0x03
-#define REQ_TIMEOUT 4000
-#define DISCONNECT_TIMEOUT 5000
-#define STREAM_TIMEOUT 20000
+#define REQ_TIMEOUT 4
+#define DISCONNECT_TIMEOUT 5
+#define STREAM_TIMEOUT 20
typedef enum {
AVDTP_SESSION_STATE_DISCONNECTED,
@@ -508,8 +508,9 @@
if (session->dc_timer)
remove_disconnect_timer(session);
- session->dc_timer = g_timeout_add(DISCONNECT_TIMEOUT,
- disconnect_timeout, session);
+ session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT,
+ disconnect_timeout,
+ session);
}
void avdtp_error_init(struct avdtp_error *err, uint8_t type, int id)
@@ -703,7 +704,7 @@
switch (state) {
case AVDTP_STATE_OPEN:
if (old_state > AVDTP_STATE_OPEN)
- stream->idle_timer = g_timeout_add(STREAM_TIMEOUT,
+ stream->idle_timer = g_timeout_add_seconds(STREAM_TIMEOUT,
stream_timeout,
stream);
break;
@@ -1176,7 +1177,8 @@
stream->open_acp = TRUE;
session->pending_open = stream;
- stream->timer = g_timeout_add(REQ_TIMEOUT, stream_open_timeout,
+ stream->timer = g_timeout_add_seconds(REQ_TIMEOUT,
+ stream_open_timeout,
stream);
return TRUE;
@@ -1286,7 +1288,8 @@
if (!avdtp_send(session, rsp, sizeof(struct gen_resp)))
return FALSE;
- stream->timer = g_timeout_add(REQ_TIMEOUT, stream_close_timeout,
+ stream->timer = g_timeout_add_seconds(REQ_TIMEOUT,
+ stream_close_timeout,
stream);
return TRUE;
@@ -1775,7 +1778,8 @@
session->req = req;
- req->timeout = g_timeout_add(REQ_TIMEOUT, request_timeout,
+ req->timeout = g_timeout_add_seconds(REQ_TIMEOUT,
+ request_timeout,
session);
return 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/audio/headset.c new/bluez-4.19/audio/headset.c
--- old/bluez-4.18/audio/headset.c 2008-10-26 07:40:34.000000000 +0100
+++ new/bluez-4.19/audio/headset.c 2008-11-21 11:15:40.000000000 +0100
@@ -62,9 +62,9 @@
#include "../src/adapter.h"
#include "../src/device.h"
-#define DC_TIMEOUT 3000
+#define DC_TIMEOUT 3
-#define RING_INTERVAL 3000
+#define RING_INTERVAL 3
#define BUF_SIZE 1024
@@ -313,7 +313,7 @@
print_hf_features(hs->hf_features);
- err = headset_send(hs, "\r\n+BRSF=%u\r\n", ag.features);
+ err = headset_send(hs, "\r\n+BRSF:%u\r\n", ag.features);
if (err < 0)
return err;
@@ -551,7 +551,8 @@
if (hs->pending_ring) {
ring_timer_cb(NULL);
- ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb,
+ ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL,
+ ring_timer_cb,
NULL);
hs->pending_ring = FALSE;
}
@@ -1529,7 +1530,8 @@
}
ring_timer_cb(NULL);
- ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, NULL);
+ ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, ring_timer_cb,
+ NULL);
done:
return reply;
@@ -2087,7 +2089,7 @@
if (hs->auto_dc) {
if (hs->rfcomm)
- hs->dc_timer = g_timeout_add(DC_TIMEOUT,
+ hs->dc_timer = g_timeout_add_seconds(DC_TIMEOUT,
(GSourceFunc) hs_dc_timeout,
dev);
else
@@ -2171,7 +2173,8 @@
if (hs->pending_ring) {
ring_timer_cb(NULL);
- ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb,
+ ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL,
+ ring_timer_cb,
NULL);
hs->pending_ring = FALSE;
}
@@ -2354,7 +2357,7 @@
if (hs->auto_dc) {
if (hs->state == HEADSET_STATE_CONNECTED)
- hs->dc_timer = g_timeout_add(DC_TIMEOUT,
+ hs->dc_timer = g_timeout_add_seconds(DC_TIMEOUT,
(GSourceFunc) hs_dc_timeout,
dev);
else
@@ -2455,7 +2458,8 @@
}
ring_timer_cb(NULL);
- ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, NULL);
+ ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, ring_timer_cb,
+ NULL);
return 0;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/audio/sink.c new/bluez-4.19/audio/sink.c
--- old/bluez-4.18/audio/sink.c 2008-10-26 07:40:34.000000000 +0100
+++ new/bluez-4.19/audio/sink.c 2008-11-21 11:15:40.000000000 +0100
@@ -44,7 +44,7 @@
#include "sink.h"
#include "dbus-common.h"
-#define STREAM_SETUP_RETRY_TIMER 2000
+#define STREAM_SETUP_RETRY_TIMER 2
struct pending_request {
DBusConnection *conn;
@@ -201,7 +201,7 @@
if (avdtp_error_type(err) == AVDTP_ERROR_ERRNO
&& avdtp_error_posix_errno(err) != EHOSTDOWN) {
debug("connect:connect XCASE detected");
- g_timeout_add(STREAM_SETUP_RETRY_TIMER,
+ g_timeout_add_seconds(STREAM_SETUP_RETRY_TIMER,
stream_setup_retry, sink);
} else {
sink->connect = NULL;
@@ -366,7 +366,7 @@
if (avdtp_error_type(err) == AVDTP_ERROR_ERRNO
&& avdtp_error_posix_errno(err) != EHOSTDOWN) {
debug("connect:connect XCASE detected");
- g_timeout_add(STREAM_SETUP_RETRY_TIMER,
+ g_timeout_add_seconds(STREAM_SETUP_RETRY_TIMER,
stream_setup_retry, sink);
} else
goto failed;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/ChangeLog new/bluez-4.19/ChangeLog
--- old/bluez-4.18/ChangeLog 2008-11-09 13:45:22.000000000 +0100
+++ new/bluez-4.19/ChangeLog 2008-11-21 11:15:40.000000000 +0100
@@ -1,3 +1,11 @@
+ver 4.19:
+ Fix installation of manual pages for old daemons.
+ Fix D-Bus signal emmissions for CreateDevice.
+ Fix issues with UUID probing.
+ Fix +BSRF syntax issue.
+ Add Pairable adapter property.
+ Add sdp_copy_record() library function.
+
ver 4.18:
Fix release before close issue with RFCOMM TTYs.
Fix Connected property on input interface.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/common/glib-helper.c new/bluez-4.19/common/glib-helper.c
--- old/bluez-4.18/common/glib-helper.c 2008-11-09 13:45:22.000000000 +0100
+++ new/bluez-4.19/common/glib-helper.c 2008-11-21 11:15:40.000000000 +0100
@@ -25,6 +25,7 @@
#include
#endif
+#include
#include
#include
#include
@@ -498,15 +499,40 @@
return 0;
}
+static inline gboolean is_uuid128(const char *string)
+{
+ return (strlen(string) == 36 &&
+ string[8] == '-' &&
+ string[13] == '-' &&
+ string[18] == '-' &&
+ string[23] == '-');
+}
+
char *bt_name2string(const char *pattern)
{
uuid_t uuid;
uint16_t uuid16;
+ int i;
+
+ /* UUID 128 string format */
+ if (is_uuid128(pattern))
+ return g_strdup(pattern);
+ /* Friendly service name format */
uuid16 = bt_name2class(pattern);
- if (!uuid16)
- return NULL;
+ if (uuid16)
+ goto proceed;
+
+ /* HEX format */
+ uuid16 = strtol(pattern, NULL, 16);
+ for (i = 0; bt_services[i].class; i++) {
+ if (bt_services[i].class == uuid16)
+ goto proceed;
+ }
+
+ return NULL;
+proceed:
sdp_uuid16_create(&uuid, uuid16);
return bt_uuid2string(&uuid);
@@ -517,11 +543,7 @@
uint32_t data0, data4;
uint16_t data1, data2, data3, data5;
- if (strlen(string) == 36 &&
- string[8] == '-' &&
- string[13] == '-' &&
- string[18] == '-' &&
- string[23] == '-' &&
+ if (is_uuid128(string) &&
sscanf(string, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
&data0, &data1, &data2, &data3, &data4, &data5) == 6) {
uint8_t val[16];
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/common/sdp-xml.c new/bluez-4.19/common/sdp-xml.c
--- old/bluez-4.18/common/sdp-xml.c 2008-08-05 23:14:56.000000000 +0200
+++ new/bluez-4.19/common/sdp-xml.c 2008-11-21 11:15:40.000000000 +0100
@@ -235,10 +235,10 @@
hex = 0;
int num_chars_to_escape = 0;
+ int length = value->unitSize - 1;
- for (i = 0; i < value->unitSize; i++) {
- if (i == (value->unitSize - 1)
- && value->val.str[i] == '\0')
+ for (i = 0; i < length; i++) {
+ if (value->val.str[i] == '\0')
break;
if (!isprint(value->val.str[i])) {
hex = 1;
@@ -281,7 +281,7 @@
strBuf = (char *)
malloc(sizeof(char) *
(value->unitSize + 1 + num_chars_to_escape * 4));
- for (i = 0, j = 0; i < value->unitSize; i++) {
+ for (i = 0, j = 0; i < length; i++) {
if (value->val.str[i] == '&') {
strBuf[j++] = '&';
strBuf[j++] = 'a';
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/compat/Makefile.am new/bluez-4.19/compat/Makefile.am
--- old/bluez-4.18/compat/Makefile.am 2008-08-08 19:21:24.000000000 +0200
+++ new/bluez-4.19/compat/Makefile.am 2008-11-21 11:15:40.000000000 +0100
@@ -20,11 +20,11 @@
pand_SOURCES = pand.c pand.h bnep.c sdp.h sdp.c
pand_LDADD = $(top_builddir)/common/libhelper.a @BLUEZ_LIBS@
-endif
if MANPAGES
man_MANS += pand.1
endif
+endif
if DUND
bin_PROGRAMS += dund
@@ -32,11 +32,11 @@
dund_SOURCES = dund.c dund.h lib.h sdp.h sdp.c dun.c msdun.c
dund_LDADD = $(top_builddir)/common/libhelper.a @BLUEZ_LIBS@
-endif
if MANPAGES
man_MANS += dund.1
endif
+endif
AM_CFLAGS = @BLUEZ_CFLAGS@
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/compat/Makefile.in new/bluez-4.19/compat/Makefile.in
--- old/bluez-4.18/compat/Makefile.in 2008-11-09 13:45:54.000000000 +0100
+++ new/bluez-4.19/compat/Makefile.in 2008-11-21 11:16:02.000000000 +0100
@@ -36,8 +36,9 @@
@HIDD_TRUE@am__append_1 = hidd
@HIDD_TRUE@@MANPAGES_TRUE@am__append_2 = hidd.1
@PAND_TRUE@am__append_3 = pand
-@MANPAGES_TRUE@am__append_4 = pand.1 dund.1
+@MANPAGES_TRUE@@PAND_TRUE@am__append_4 = pand.1
@DUND_TRUE@am__append_5 = dund
+@DUND_TRUE@@MANPAGES_TRUE@am__append_6 = dund.1
subdir = compat
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -219,7 +220,7 @@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-man_MANS = $(am__append_2) $(am__append_4)
+man_MANS = $(am__append_2) $(am__append_4) $(am__append_6)
@HIDD_TRUE@hidd_SOURCES = hidd.c hidd.h sdp.h sdp.c fakehid.c
@HIDD_TRUE@hidd_LDADD = $(top_builddir)/common/libhelper.a @BLUEZ_LIBS@ -lm
@PAND_TRUE@pand_SOURCES = pand.c pand.h bnep.c sdp.h sdp.c
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/configure new/bluez-4.19/configure
--- old/bluez-4.18/configure 2008-11-09 13:46:00.000000000 +0100
+++ new/bluez-4.19/configure 2008-11-21 11:16:09.000000000 +0100
@@ -2387,7 +2387,7 @@
# Define the identity of the package.
PACKAGE=bluez
- VERSION=4.18
+ VERSION=4.19
cat >>confdefs.h <<_ACEOF
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/configure.ac new/bluez-4.19/configure.ac
--- old/bluez-4.18/configure.ac 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/configure.ac 2008-11-21 11:15:40.000000000 +0100
@@ -1,7 +1,7 @@
AC_PREREQ(2.50)
AC_INIT()
-AM_INIT_AUTOMAKE(bluez, 4.18)
+AM_INIT_AUTOMAKE(bluez, 4.19)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/doc/adapter-api.txt new/bluez-4.19/doc/adapter-api.txt
--- old/bluez-4.18/doc/adapter-api.txt 2008-09-26 07:39:55.000000000 +0200
+++ new/bluez-4.19/doc/adapter-api.txt 2008-11-21 11:15:40.000000000 +0100
@@ -139,6 +139,12 @@
to use CreateDevice first and the if needed use
CreatePairedDevice to initiate pairing.
+ The agent object path is assumed to reside within the
+ process (D-Bus connection instance) that calls this
+ method. No separate registration procedure is needed
+ for it and it gets automatically released once the
+ pairing operation is complete.
+
The capability parameter is the same as for the
RegisterAgent method.
@@ -260,6 +266,15 @@
this property will be updated via a PropertyChanged
signal.
+ boolean Pairable [readwrite]
+
+ Switch an adapter to pairable or non-pairable. This is
+ a global setting and should only be used by the
+ settings application.
+
+ Note that this property only affects incoming pairing
+ requests.
+
uint32 DiscoverableTimeout [readwrite]
The discoverable timeout in seconds. A value of zero
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/include/sdp_lib.h new/bluez-4.19/include/sdp_lib.h
--- old/bluez-4.18/include/sdp_lib.h 2008-08-05 23:14:56.000000000 +0200
+++ new/bluez-4.19/include/sdp_lib.h 2008-11-21 11:15:40.000000000 +0100
@@ -585,6 +585,7 @@
}
sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int bufsize, int *scanned);
+sdp_record_t *sdp_copy_record(sdp_record_t *rec);
void sdp_data_print(sdp_data_t *data);
void sdp_print_service_attr(sdp_list_t *alist);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/lib/Makefile.am new/bluez-4.19/lib/Makefile.am
--- old/bluez-4.18/lib/Makefile.am 2008-10-19 23:46:12.000000000 +0200
+++ new/bluez-4.19/lib/Makefile.am 2008-11-21 11:15:40.000000000 +0100
@@ -2,7 +2,7 @@
lib_LTLIBRARIES = libbluetooth.la
libbluetooth_la_SOURCES = bluetooth.c hci.c sdp.c
-libbluetooth_la_LDFLAGS = -version-info 3:3:0
+libbluetooth_la_LDFLAGS = -version-info 4:0:1
INCLUDES = -I$(top_builddir)/include
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/lib/Makefile.in new/bluez-4.19/lib/Makefile.in
--- old/bluez-4.18/lib/Makefile.in 2008-11-09 13:45:55.000000000 +0100
+++ new/bluez-4.19/lib/Makefile.in 2008-11-21 11:16:04.000000000 +0100
@@ -205,7 +205,7 @@
top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libbluetooth.la
libbluetooth_la_SOURCES = bluetooth.c hci.c sdp.c
-libbluetooth_la_LDFLAGS = -version-info 3:3:0
+libbluetooth_la_LDFLAGS = -version-info 4:0:1
INCLUDES = -I$(top_builddir)/include
MAINTAINERCLEANFILES = Makefile.in
all: all-am
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/lib/sdp.c new/bluez-4.19/lib/sdp.c
--- old/bluez-4.18/lib/sdp.c 2008-10-19 23:46:12.000000000 +0200
+++ new/bluez-4.19/lib/sdp.c 2008-11-21 11:15:40.000000000 +0100
@@ -96,6 +96,8 @@
#define SDP_MAX_ATTR_LEN 65535
+static sdp_data_t *sdp_copy_seq(sdp_data_t *data);
+
/* Message structure. */
struct tupla {
int index;
@@ -1365,6 +1367,128 @@
return rec;
}
+static void sdp_copy_pattern(void *value, void *udata)
+{
+ uuid_t *uuid = value;
+ sdp_record_t *rec = udata;
+
+ sdp_pattern_add_uuid(rec, uuid);
+}
+
+static void *sdp_data_value(sdp_data_t *data)
+{
+ void *val = NULL;
+
+ switch (data->dtd) {
+ case SDP_DATA_NIL:
+ break;
+ case SDP_UINT8:
+ val = &data->val.uint8;
+ break;
+ case SDP_INT8:
+ case SDP_BOOL:
+ val = &data->val.int8;
+ break;
+ case SDP_UINT16:
+ val = &data->val.uint16;
+ break;
+ case SDP_INT16:
+ val = &data->val.int16;
+ break;
+ case SDP_UINT32:
+ val = &data->val.uint32;
+ break;
+ case SDP_INT32:
+ val = &data->val.int32;
+ break;
+ case SDP_INT64:
+ val = &data->val.int64;
+ break;
+ case SDP_UINT64:
+ val = &data->val.uint64;
+ break;
+ case SDP_UINT128:
+ val = &data->val.uint128;
+ break;
+ case SDP_INT128:
+ val = &data->val.int128;
+ break;
+ case SDP_UUID16:
+ case SDP_UUID32:
+ case SDP_UUID128:
+ val = &data->val.uuid;
+ break;
+ case SDP_URL_STR8:
+ case SDP_URL_STR16:
+ case SDP_TEXT_STR8:
+ case SDP_TEXT_STR16:
+ case SDP_URL_STR32:
+ case SDP_TEXT_STR32:
+ val = data->val.str;
+ break;
+ case SDP_ALT8:
+ case SDP_ALT16:
+ case SDP_ALT32:
+ case SDP_SEQ8:
+ case SDP_SEQ16:
+ case SDP_SEQ32:
+ val = sdp_copy_seq(data->val.dataseq);
+ break;
+ }
+
+ return val;
+}
+
+static sdp_data_t *sdp_copy_seq(sdp_data_t *data)
+{
+ sdp_data_t *tmp, *seq = NULL, *cur = NULL;
+
+ for (tmp = data; tmp; tmp = tmp->next) {
+ sdp_data_t *datatmp;
+ void *value;
+
+ value = sdp_data_value(tmp);
+ datatmp = sdp_data_alloc_with_length(tmp->dtd, value,
+ tmp->unitSize);
+
+ if (cur)
+ cur->next = datatmp;
+ else
+ seq = datatmp;
+
+ cur = datatmp;
+ }
+
+ return seq;
+}
+
+static void sdp_copy_attrlist(void *value, void *udata)
+{
+ sdp_data_t *data = value;
+ sdp_record_t *rec = udata;
+ void *val;
+
+ val = sdp_data_value(data);
+
+ sdp_attr_add_new(rec, data->attrId, data->dtd, val);
+}
+
+sdp_record_t *sdp_copy_record(sdp_record_t *rec)
+{
+ sdp_record_t *cpy;
+
+ cpy = sdp_record_alloc();
+
+ cpy->handle = rec->handle;
+
+ sdp_list_foreach(rec->pattern, sdp_copy_pattern, cpy);
+ sdp_list_foreach(rec->attrlist, sdp_copy_attrlist, cpy);
+
+ cpy->svclass = rec->svclass;
+
+ return cpy;
+}
+
#ifdef SDP_DEBUG
static void print_dataseq(sdp_data_t *p)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/network/server.c new/bluez-4.19/network/server.c
--- old/bluez-4.18/network/server.c 2008-10-16 23:11:39.000000000 +0200
+++ new/bluez-4.19/network/server.c 2008-11-21 11:15:40.000000000 +0100
@@ -55,7 +55,7 @@
#define NETWORK_PEER_INTERFACE "org.bluez.NetworkPeer"
#define NETWORK_HUB_INTERFACE "org.bluez.NetworkHub"
#define NETWORK_ROUTER_INTERFACE "org.bluez.NetworkRouter"
-#define SETUP_TIMEOUT 1000
+#define SETUP_TIMEOUT 1
/* Pending Authorization */
struct setup_session {
@@ -555,7 +555,7 @@
* the time expires.
*/
na->to = g_malloc0(sizeof(struct timeout));
- na->to->id = g_timeout_add(SETUP_TIMEOUT, timeout_cb, na->to);
+ na->to->id = g_timeout_add_seconds(SETUP_TIMEOUT, timeout_cb, na->to);
na->to->watch = g_io_add_watch_full(chan, G_PRIORITY_DEFAULT,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
bnep_setup, na, setup_destroy);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/plugins/service.c new/bluez-4.19/plugins/service.c
--- old/bluez-4.18/plugins/service.c 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/plugins/service.c 2008-11-21 11:15:40.000000000 +0100
@@ -577,7 +577,6 @@
}
if (derr) {
- adapter_get_address(serv_adapter->adapter, &src);
error("Access denied: %s", derr->message);
reply = not_authorized(auth->msg);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/adapter.c new/bluez-4.19/src/adapter.c
--- old/bluez-4.18/src/adapter.c 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/src/adapter.c 2008-11-21 11:15:40.000000000 +0100
@@ -114,6 +114,7 @@
guint scheduler_id; /* Scheduler handle */
struct hci_dev dev; /* hci info */
+ gboolean pairable; /* pairable state */
};
static inline DBusMessage *invalid_args(DBusMessage *msg)
@@ -449,6 +450,44 @@
return bonding;
}
+static int set_limited_discoverable(int dd, const uint8_t *cls, gboolean limited)
+{
+ uint32_t dev_class;
+ int num = (limited ? 2 : 1);
+ uint8_t lap[] = { 0x33, 0x8b, 0x9e, 0x00, 0x8b, 0x9e };
+ /*
+ * 1: giac
+ * 2: giac + liac
+ */
+ if (hci_write_current_iac_lap(dd, num, lap, HCI_REQ_TIMEOUT) < 0) {
+ int err = errno;
+ error("Can't write current IAC LAP: %s(%d)",
+ strerror(err), err);
+ return -err;
+ }
+
+ if (limited) {
+ if (cls[1] & 0x20)
+ return 0; /* Already limited */
+
+ dev_class = (cls[2] << 16) | ((cls[1] | 0x20) << 8) | cls[0];
+ } else {
+ if (!(cls[1] & 0x20))
+ return 0; /* Already clear */
+
+ dev_class = (cls[2] << 16) | ((cls[1] & 0xdf) << 8) | cls[0];
+ }
+
+ if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
+ int err = errno;
+ error("Can't write class of device: %s (%d)",
+ strerror(err), err);
+ return -err;
+ }
+
+ return 0;
+}
+
static const char *mode2str(uint8_t mode)
{
switch(mode) {
@@ -589,7 +628,7 @@
adapter->discov_timeout_id = 0;
}
- if (!adapter->mode_sessions && !adapter->discov_timeout)
+ if (!adapter->mode_sessions && adapter->discov_timeout)
adapter_set_discov_timeout(adapter,
adapter->discov_timeout * 1000);
}
@@ -628,12 +667,40 @@
strmode = discoverable ? "discoverable" : "connectable";
mode = get_mode(&adapter->bdaddr, strmode);
+ if (mode == MODE_DISCOVERABLE && adapter->pairable)
+ mode = MODE_LIMITED;
+
if (mode == adapter->mode)
return dbus_message_new_method_return(msg);
return set_mode(conn, msg, mode, data);
}
+static DBusMessage *set_pairable(DBusConnection *conn, DBusMessage *msg,
+ gboolean pairable, void *data)
+{
+ struct btd_adapter *adapter = data;
+
+ if (pairable == adapter->pairable)
+ goto done;
+
+ adapter->pairable = pairable;
+
+ write_device_pairable(&adapter->bdaddr, pairable);
+
+ emit_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "Pairable",
+ DBUS_TYPE_BOOLEAN, &pairable);
+
+ if (adapter->scan_mode & SCAN_INQUIRY) {
+ uint8_t mode = pairable ? MODE_LIMITED : MODE_DISCOVERABLE;
+ return set_mode(conn, msg, mode, data);
+ }
+
+done:
+ return dbus_message_new_method_return(msg);
+}
+
static struct session_req *find_session(GSList *list, DBusMessage *msg)
{
GSList *l;
@@ -953,6 +1020,7 @@
struct btd_adapter *adapter, const char *address)
{
struct btd_device *device;
+ const char *path;
debug("adapter_create_device(%s)", address);
@@ -964,6 +1032,14 @@
adapter->devices = g_slist_append(adapter->devices, device);
+ path = device_get_path(device);
+ g_dbus_emit_signal(conn, adapter->path,
+ ADAPTER_INTERFACE, "DeviceCreated",
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);
+
+ adapter_update_devices(adapter);
+
return device;
}
@@ -1068,17 +1144,15 @@
delete_entry(&adapter->bdaddr, "profiles", dstaddr);
adapter->devices = g_slist_remove(adapter->devices, device);
- if (!device_is_temporary(device)) {
+ if (!device_is_temporary(device))
remove_bonding(conn, NULL, dstaddr, adapter);
- g_dbus_emit_signal(conn, adapter->path,
- ADAPTER_INTERFACE,
- "DeviceRemoved",
- DBUS_TYPE_OBJECT_PATH, &dev_path,
- DBUS_TYPE_INVALID);
+ g_dbus_emit_signal(conn, adapter->path,
+ ADAPTER_INTERFACE, "DeviceRemoved",
+ DBUS_TYPE_OBJECT_PATH, &dev_path,
+ DBUS_TYPE_INVALID);
- adapter_update_devices(adapter);
- }
+ adapter_update_devices(adapter);
agent = device_get_agent(device);
@@ -1612,6 +1686,10 @@
value = adapter->scan_mode & SCAN_INQUIRY ? TRUE : FALSE;
dict_append_entry(&dict, "Discoverable", DBUS_TYPE_BOOLEAN, &value);
+ /* Pairable */
+ dict_append_entry(&dict, "Pairable", DBUS_TYPE_BOOLEAN,
+ &adapter->pairable);
+
/* DiscoverableTimeout */
dict_append_entry(&dict, "DiscoverableTimeout",
DBUS_TYPE_UINT32, &adapter->discov_timeout);
@@ -1715,6 +1793,15 @@
dbus_message_iter_get_basic(&sub, &timeout);
return set_discoverable_timeout(conn, msg, timeout, data);
+ } else if (g_str_equal("Pairable", property)) {
+ gboolean pairable;
+
+ if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_BOOLEAN)
+ return invalid_args(msg);
+
+ dbus_message_iter_get_basic(&sub, &pairable);
+
+ return set_pairable(conn, msg, pairable, data);
}
return invalid_args(msg);
@@ -1893,7 +1980,7 @@
debug("create_device(%s)", address);
- device = device_create(conn, adapter, address);
+ device = adapter_create_device(conn, adapter, address);
if (!device)
return NULL;
@@ -1901,8 +1988,6 @@
device_browse(device, conn, msg, NULL, FALSE);
- adapter->devices = g_slist_append(adapter->devices, device);
-
return NULL;
}
@@ -2366,6 +2451,10 @@
adapter->discov_timeout = get_discoverable_timeout(srcaddr);
adapter->state = DISCOVER_TYPE_NONE;
+ /* Set pairable mode */
+ if (read_device_pairable(&adapter->bdaddr, &adapter->pairable) < 0)
+ adapter->pairable = TRUE;
+
/* Set scan mode */
if (read_device_mode(srcaddr, mode, sizeof(mode)) == 0) {
if (!strcmp(mode, "off")) {
@@ -2394,7 +2483,8 @@
} else if (!strcmp(mode, "discoverable")) {
/* Set discoverable only if timeout is 0 */
if (adapter->discov_timeout == 0) {
- adapter->mode = MODE_DISCOVERABLE;
+ adapter->mode = adapter->pairable ?
+ MODE_LIMITED : MODE_DISCOVERABLE;
adapter->scan_mode = SCAN_PAGE | SCAN_INQUIRY;
} else {
adapter->mode = MODE_CONNECTABLE;
@@ -2454,6 +2544,10 @@
ADAPTER_INTERFACE, "Discoverable",
DBUS_TYPE_BOOLEAN, &discoverable);
+ emit_property_changed(connection, adapter->path,
+ ADAPTER_INTERFACE, "Pairable",
+ DBUS_TYPE_BOOLEAN, &adapter->pairable);
+
load_drivers(adapter);
load_devices(adapter);
}
@@ -2940,7 +3034,7 @@
if (state & PERIODIC_INQUIRY || state & STD_INQUIRY)
discov_active = TRUE;
else if (adapter->disc_sessions && main_opts.inqmode)
- adapter->scheduler_id = g_timeout_add(main_opts.inqmode * 1000,
+ adapter->scheduler_id = g_timeout_add_seconds(main_opts.inqmode,
(GSourceFunc) start_inquiry, adapter);
if (!discov_active && adapter->found_devices) {
@@ -3453,3 +3547,16 @@
g_free(adapter_any_path);
adapter_any_path = NULL;
}
+
+gboolean adapter_is_pairable(struct btd_adapter *adapter)
+{
+ return adapter->pairable;
+}
+
+gboolean adapter_pairing_initiator(struct btd_adapter *adapter, bdaddr_t *bda)
+{
+ if (!adapter->bonding)
+ return FALSE;
+
+ return (bacmp(&adapter->bonding->bdaddr, bda) == 0);
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/adapter.h new/bluez-4.19/src/adapter.h
--- old/bluez-4.18/src/adapter.h 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/src/adapter.h 2008-11-21 11:15:40.000000000 +0100
@@ -184,3 +184,5 @@
const char *btd_adapter_any_request_path(void);
void btd_adapter_any_release_path(void);
+gboolean adapter_is_pairable(struct btd_adapter *adapter);
+gboolean adapter_pairing_initiator(struct btd_adapter *adapter, bdaddr_t *bda);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/dbus-hci.c new/bluez-4.19/src/dbus-hci.c
--- old/bluez-4.18/src/dbus-hci.c 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/src/dbus-hci.c 2008-11-21 11:15:40.000000000 +0100
@@ -239,6 +239,10 @@
return -1;
}
+ if (!adapter_pairing_initiator(adapter, &ci->bdaddr) &&
+ !adapter_is_pairable(adapter))
+ return -EPERM;
+
ba2str(&ci->bdaddr, addr);
device = adapter_find_device(adapter, addr);
@@ -1244,44 +1248,6 @@
}
}
-int set_limited_discoverable(int dd, const uint8_t *cls, gboolean limited)
-{
- uint32_t dev_class;
- int num = (limited ? 2 : 1);
- uint8_t lap[] = { 0x33, 0x8b, 0x9e, 0x00, 0x8b, 0x9e };
- /*
- * 1: giac
- * 2: giac + liac
- */
- if (hci_write_current_iac_lap(dd, num, lap, HCI_REQ_TIMEOUT) < 0) {
- int err = errno;
- error("Can't write current IAC LAP: %s(%d)",
- strerror(err), err);
- return -err;
- }
-
- if (limited) {
- if (cls[1] & 0x20)
- return 0; /* Already limited */
-
- dev_class = (cls[2] << 16) | ((cls[1] | 0x20) << 8) | cls[0];
- } else {
- if (!(cls[1] & 0x20))
- return 0; /* Already clear */
-
- dev_class = (cls[2] << 16) | ((cls[1] & 0xdf) << 8) | cls[0];
- }
-
- if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
- int err = errno;
- error("Can't write class of device: %s (%d)",
- strerror(err), err);
- return -err;
- }
-
- return 0;
-}
-
int set_service_classes(int dd, const uint8_t *cls, uint8_t value)
{
uint32_t dev_class;
@@ -1301,39 +1267,6 @@
return 0;
}
-int set_major_class(int dd, const uint8_t *cls, uint8_t major)
-{
- uint32_t dev_class;
-
- dev_class = (cls[2] << 16) | ((cls[1] & 0x20) << 8) |
- ((major & 0xdf) << 8) | 0x00;
-
- if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
- int err = errno;
- error("Can't write class of device: %s (%d)",
- strerror(err), err);
- return -err;
- }
-
- return 0;
-}
-
-int set_minor_class(int dd, const uint8_t *cls, uint8_t minor)
-{
- uint32_t dev_class;
-
- dev_class = (cls[2] << 16) | (cls[1] << 8) | minor;
-
- if (hci_write_class_of_dev(dd, dev_class, HCI_REQ_TIMEOUT) < 0) {
- int err = errno;
- error("Can't write class of device: %s (%d)",
- strerror(err), err);
- return -err;
- }
-
- return 0;
-}
-
int set_major_and_minor_class(int dd, const uint8_t *cls,
uint8_t major, uint8_t minor)
{
@@ -1537,6 +1470,10 @@
if (get_auth_requirements(local, remote, auth) < 0)
return -1;
+ if (!adapter_pairing_initiator(adapter, remote) &&
+ !adapter_is_pairable(adapter))
+ return -EPERM;
+
ba2str(remote, addr);
/* For CreatePairedDevice use dedicated bonding */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/dbus-hci.h new/bluez-4.19/src/dbus-hci.h
--- old/bluez-4.18/src/dbus-hci.h 2008-09-29 11:40:07.000000000 +0200
+++ new/bluez-4.19/src/dbus-hci.h 2008-11-21 11:15:40.000000000 +0100
@@ -47,17 +47,12 @@
int hcid_dbus_user_notify(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey);
void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer);
-int unregister_adapter_path(const char *path);
-
DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status);
int cancel_discovery(struct btd_adapter *adapter);
int cancel_periodic_discovery(struct btd_adapter *adapter);
-int set_limited_discoverable(int dd, const uint8_t *cls, gboolean limited);
int set_service_classes(int dd, const uint8_t *cls, uint8_t value);
-int set_major_class(int dd, const uint8_t *cls, uint8_t major);
-int set_minor_class(int dd, const uint8_t *cls, uint8_t minor);
int set_major_and_minor_class(int dd, const uint8_t *cls,
uint8_t major, uint8_t minor);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/device.c new/bluez-4.19/src/device.c
--- old/bluez-4.18/src/device.c 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/src/device.c 2008-11-21 11:15:40.000000000 +0100
@@ -58,7 +58,7 @@
#define DEFAULT_XML_BUF_SIZE 1024
#define DISCONNECT_TIMER 2
-#define DISCOVERY_TIMER 2000
+#define DISCOVERY_TIMER 2
struct btd_driver_data {
struct btd_device_driver *driver;
@@ -656,6 +656,11 @@
for (uuid = driver->uuids; *uuid; uuid++) {
GSList *match;
+ /* skip duplicated uuids */
+ if (g_slist_find_custom(uuids, *uuid,
+ (GCompareFunc) strcasecmp))
+ continue;
+
/* match profile driver */
match = g_slist_find_custom(profiles, *uuid,
(GCompareFunc) strcasecmp);
@@ -755,23 +760,23 @@
(GCompareFunc) strcasecmp))
continue;
- debug("UUID %s was removed from device %s", dstaddr);
+ debug("UUID %s was removed from device %s", *uuid, dstaddr);
driver->remove(device);
device->drivers = g_slist_remove(device->drivers,
driver_data);
-
g_free(driver_data);
-
rec = find_record_in_list(records, *uuid);
if (!rec)
- continue;
+ break;
delete_record(srcaddr, dstaddr, rec->handle);
records = sdp_list_remove(records, rec);
sdp_record_free(rec);
+
+ break;
}
}
@@ -912,7 +917,6 @@
for (seq = recs; seq; seq = seq->next) {
sdp_record_t *rec = (sdp_record_t *) seq->data;
- sdp_buf_t pdu;
sdp_list_t *svcclass = NULL;
gchar *profile_uuid;
GSList *l;
@@ -961,15 +965,7 @@
store_record(srcaddr, dstaddr, rec);
/* Copy record */
- if (sdp_gen_record_pdu(rec, &pdu) == 0) {
- sdp_record_t *record;
- int scanned;
-
- record = sdp_extract_pdu(pdu.data, pdu.data_size,
- &scanned);
- free(pdu.data);
- req->records = sdp_list_append(req->records, record);
- }
+ req->records = sdp_list_append(req->records, sdp_copy_record(rec));
l = g_slist_find_custom(device->uuids, profile_uuid,
(GCompareFunc) strcmp);
@@ -1071,25 +1067,15 @@
/* Store the device's profiles in the filesystem */
store_profiles(device);
- if (req->msg) {
- if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE,
- "DiscoverServices")) {
- discover_device_reply(req, req->records);
- goto cleanup;
- }
-
- g_dbus_emit_signal(req->conn, dbus_message_get_path(req->msg),
- ADAPTER_INTERFACE, "DeviceCreated",
- DBUS_TYPE_OBJECT_PATH, &device->path,
- DBUS_TYPE_INVALID);
- }
-
- /* Update device list */
- adapter_update_devices(device->adapter);
-
if (!req->msg)
goto cleanup;
+ if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE,
+ "DiscoverServices")) {
+ discover_device_reply(req, req->records);
+ goto cleanup;
+ }
+
/* Reply create device request */
reply = dbus_message_new_method_return(req->msg);
if (!reply)
@@ -1165,10 +1151,9 @@
adapter_get_address(adapter, &src);
req = g_new0(struct browse_req, 1);
- if (conn && msg) {
- req->conn = dbus_connection_ref(conn);
- req->msg = dbus_message_ref(msg);
- }
+
+ req->conn = conn ? dbus_connection_ref(conn) : get_dbus_connection();
+
req->device = device;
if (search) {
@@ -1183,6 +1168,7 @@
device->discov_active = 1;
if (msg) {
+ req->msg = dbus_message_ref(msg);
device->discov_requestor = g_strdup(dbus_message_get_sender(msg));
/* Track the request owner to cancel it
* automatically if the owner exits */
@@ -1316,7 +1302,7 @@
/* If we are not initiators and there is no currently active discovery
* or discovery timer, set the discovery timer */
if (!device->discov_active && !device->discov_timer)
- device->discov_timer = g_timeout_add(DISCOVERY_TIMER,
+ device->discov_timer = g_timeout_add_seconds(DISCOVERY_TIMER,
start_discovery,
device);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/storage.c new/bluez-4.19/src/storage.c
--- old/bluez-4.18/src/storage.c 2008-10-16 23:11:39.000000000 +0200
+++ new/bluez-4.19/src/storage.c 2008-11-21 11:15:40.000000000 +0100
@@ -1028,3 +1028,33 @@
return 0;
}
+
+int write_device_pairable(bdaddr_t *bdaddr, gboolean mode)
+{
+ char filename[PATH_MAX + 1];
+
+ create_filename(filename, PATH_MAX, bdaddr, "config");
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ return textfile_put(filename, "pairable", mode ? "yes" : "no");
+}
+
+int read_device_pairable(bdaddr_t *bdaddr, gboolean *mode)
+{
+ char filename[PATH_MAX + 1], *str;
+
+ create_filename(filename, PATH_MAX, bdaddr, "config");
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ str = textfile_get(filename, "pairable");
+ if (!str)
+ return -ENOENT;
+
+ *mode = strcmp(str, "yes") == 0 ? TRUE : FALSE;
+
+ free(str);
+
+ return 0;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/src/storage.h new/bluez-4.19/src/storage.h
--- old/bluez-4.18/src/storage.h 2008-10-16 23:11:39.000000000 +0200
+++ new/bluez-4.19/src/storage.h 2008-11-21 11:15:40.000000000 +0100
@@ -68,6 +68,8 @@
int read_device_id(const gchar *src, const gchar *dst,
uint16_t *source, uint16_t *vendor,
uint16_t *product, uint16_t *version);
+int write_device_pairable(bdaddr_t *local, gboolean mode);
+int read_device_pairable(bdaddr_t *local, gboolean *mode);
#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/bluez-4.18/test/test-adapter new/bluez-4.19/test/test-adapter
--- old/bluez-4.18/test/test-adapter 2008-11-09 13:45:23.000000000 +0100
+++ new/bluez-4.19/test/test-adapter 2008-11-21 11:15:40.000000000 +0100
@@ -18,6 +18,8 @@
print " name [name]"
print " mode [mode]"
print " requestmode <mode>"
+ print " pairable [on/off]"
+ print " discoverable [on/off]"
print " discoverabletimeout [timeout]"
print " periodicdiscovery [on/off]"
sys.exit(1)
@@ -50,6 +52,34 @@
adapter.RequestMode(sys.argv[2])
sys.exit(0)
+if (sys.argv[1] == "pairable"):
+ if (len(sys.argv) < 3):
+ properties = adapter.GetProperties()
+ print properties["Pairable"]
+ else:
+ if (sys.argv[2] == "on"):
+ value = dbus.Boolean(1)
+ elif (sys.argv[2] == "off"):
+ value = dbus.Boolean(0)
+ else:
+ value = dbus.Boolean(sys.argv[2])
+ adapter.SetProperty("Pairable", value)
+ sys.exit(0)
+
+if (sys.argv[1] == "discoverable"):
+ if (len(sys.argv) < 3):
+ properties = adapter.GetProperties()
+ print properties["Discoverable"]
+ else:
+ if (sys.argv[2] == "on"):
+ value = dbus.Boolean(1)
+ elif (sys.argv[2] == "off"):
+ value = dbus.Boolean(0)
+ else:
+ value = dbus.Boolean(sys.argv[2])
+ adapter.SetProperty("Discoverable", value)
+ sys.exit(0)
+
if (sys.argv[1] == "discoverabletimeout"):
if (len(sys.argv) < 3):
properties = adapter.GetProperties()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org