summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-09-08 10:30:05 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-09-08 10:30:05 +0300
commit17370895fde2d210bb50dfaa1c89fe6601de3467 (patch)
tree2797d5e061b7948a53f270f9ccfcc31b1c0ad6f5
parentfa141e676e82cd20082779c086d1fef6427fdc20 (diff)
parent393416b170d6e4b2b7406418d63c7be2aefda70f (diff)
Merge branch 'master' of ssh://master.kernel.org/pub/scm/bluetooth/bluez
-rw-r--r--ChangeLog11
-rw-r--r--audio/Makefile.am3
-rw-r--r--audio/audio-api.txt311
-rw-r--r--audio/control.h2
-rw-r--r--audio/device.h8
-rw-r--r--audio/gateway.h2
-rw-r--r--audio/headset.h2
-rw-r--r--audio/main.c14
-rw-r--r--audio/manager.h4
-rw-r--r--audio/sink.h2
-rw-r--r--audio/telephony-dummy.c14
-rwxr-xr-xaudio/test-audio27
-rwxr-xr-xbootstrap-configure2
-rw-r--r--configure.ac2
-rw-r--r--cups/Makefile.am3
-rw-r--r--cups/main.c7
-rw-r--r--doc/Makefile.am6
-rw-r--r--doc/audio-api.txt4
-rw-r--r--doc/input-api.txt2
-rw-r--r--doc/network-api.txt2
-rw-r--r--doc/serial-api.txt2
-rw-r--r--input/device.c2
-rw-r--r--input/main.c14
-rw-r--r--input/manager.c14
-rw-r--r--network/connection.c8
-rw-r--r--network/main.c14
-rw-r--r--network/manager.c5
-rw-r--r--network/server.c6
-rw-r--r--serial/Makefile.am2
-rw-r--r--serial/main.c16
-rw-r--r--serial/port.c2
-rw-r--r--serial/proxy.c4
-rw-r--r--src/device.c51
-rw-r--r--test/Makefile.am2
-rwxr-xr-xtest/simple-service8
-rwxr-xr-xtest/test-serial (renamed from serial/test-serial)19
36 files changed, 150 insertions, 447 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ff09e2c..5ba13db3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+ver 4.4:
+ Add temporary fix for the CUPS compile issue.
+ Add service-api.txt to distribution.
+ Mention the variable prefix of an object path
+
+ver 4.3:
+ Add dummy driver for telephony support.
+ Add support for discovery sessions.
+ Add service plugin for external services.
+ Various cleanups.
+
ver 4.2:
Avoid memory copies in A2DP write routine.
Fix broken logic with Simple Pairing check and old kernels.
diff --git a/audio/Makefile.am b/audio/Makefile.am
index 290633fb..543fa955 100644
--- a/audio/Makefile.am
+++ b/audio/Makefile.am
@@ -61,8 +61,7 @@ CLEANFILES = $(BUILT_SOURCES)
INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src
-EXTRA_DIST = audio.conf audio-api.txt test-audio asound.conf \
- telephony-dummy.c
+EXTRA_DIST = audio.conf asound.conf telephony-dummy.c
MAINTAINERCLEANFILES = Makefile.in
diff --git a/audio/audio-api.txt b/audio/audio-api.txt
deleted file mode 100644
index cba20699..00000000
--- a/audio/audio-api.txt
+++ /dev/null
@@ -1,311 +0,0 @@
-Bluetooth audio service API description
-***************************************
-
-Copyright (C) 2004-2007 Marcel Holtmann <marcel@holtmann.org>
-Copyright (C) 2005-2007 Johan Hedberg <johan.hedberg@nokia.com>
-Copyright (C) 2005-2006 Brad Midgley <bmidgley@xmission.com>
-
-
-org.bluez.audio.Manager interface
-=================================
-
-This interface is for managing remote audio devices. It provides methods for
-creating and removing D-Bus objects representing remote audio devices. These
-objects implement one or more of the other interfaces listed in this document.
-
-Object path /org/bluez/audio
-
-Methods
- string CreateDevice(string address) [experimental]
-
- Creates a new audio device object. If not yet done,
- this method will perform a SDP query on the remote
- device and return first when the query is complete,
- so be sure to call this method asynchronously.
-
- The return parameter is the object path of the newly
- created object.
-
- void RemoveDevice(string path) [experimental]
-
- Removes a device from the device tree. If there are
- any connections open to the device they will be closed.
-
- array{string} ListDevices() [experimental]
-
- Retuns an array of strings indicating the object paths
- of available devices.
-
- string DefaultDevice()
-
- Returns the object path for the default device.
-
- void ChangeDefaultDevice(string path)
-
- Changes the default device.
-
- array{string} ListHeadsets()
-
- Returns list of headset objects that are configured.
-
- string FindDeviceByAddress(string address) [experimental]
-
- Searches the list of available devices and returns the
- object path of the first device which matchess address.
- If no device is found returns a DoesNotExist error.
-
- string DefaultHeadset()
-
- Returns the object path for the default headset device.
-
- void ChangeDefaultHeadset(string path)
-
- Changes the default headset.
-
- string CreateHeadset(string address)
-
- Create a new headset device and returns its object path
- on return.
-
- void RemoveHeadset(string path)
-
- Removes a headset object and all information
- related to it.
-
-Signals
- void DeviceCreated(string path) [experimental]
-
- Sent when a new device object has been created.
-
- void DeviceRemoved(string path) [experimental]
-
- Sent when a device object has been removed.
-
- void HeadsetCreated(string path)
-
- Sent when a new headset object has been created.
-
- void HeadsetRemoved(string path)
-
- Sent when a headset object has been removed.
-
- void DefaultHeadsetChanged(string path)
-
- Sent when the default headset has changed.
-
-
-org.bluez.audio.Device interface
-================================
-
-This interface is implemented by all remote device objects.
-
-Object path(s) /org/bluez/audio/device*
-
-Methods string GetAddress() [experimental]
-
- Returns the Bluetooth address of the remote device.
-
- string GetAdapter() [experimental]
-
- Returns the address of the local adapter that the
- device is associated with.
-
- string GetName() [experimental]
-
- Returns a friendly name for the device.
-
- array{string} GetConnectedInterfaces() [experimental]
-
- Returns a string list of interfaces that are in a
- connected state.
-
-
-org.bluez.audio.Headset interface
-=================================
-
-This interface provides access to headsets that implement the HSP and/or HFP
-profiles.
-
-Object path(s) /org/bluez/audio/device*
-
-Methods void Connect()
-
- Connect to the HSP/HFP service on the remote device.
-
- void Disconnect()
-
- Disconnect from the HSP/HFP service on the remote
- device.
-
- boolean IsConnected()
-
- Returns TRUE if there is a active connection to the
- HSP/HFP connection on the remote device.
-
- void IndicateCall()
-
- Indicate an incoming call on the headset
- connected to the stream. Will continue to
- ring the headset about every 3 seconds.
-
- void CancelCall()
-
- Cancel the incoming call indication.
-
- void Play()
-
- Open the audio connection to the headset.
-
- void Stop()
-
- Close the audio connection.
-
- boolean IsPlaying()
-
- Returns true if an audio connection to the headset
- is active.
-
- uint16 GetSpeakerGain()
-
- Returns the current speaker gain if available,
- otherwise returns the error NotAvailable.
-
- uint16 GetMicrophoneGain()
-
- Returns the current microphone gain if available,
- otherwise returns the error NotAvailable.
-
- void SetSpeakerGain(uint16 gain)
-
- Changes the current speaker gain if possible.
-
- void SetMicrophoneGain(uint16 gain)
-
- Changes the current speaker gain if possible.
-
- void SetupCall(string value) [experimental]
-
- Sets up an call with the connected HFP. The value can
- be "incoming", "outgoing" or "remote" to indicate
- incoming call, outgoing call and remote party alerted
- respectively.
-
- void IdentifyCall(string phone_number, int32 type) [experimental]
-
- Enables a called subscriber to get the calling
- line identity (CLI) of the calling party when
- receiving a call. The value of type shud be
- the same as provided by the GSM stack.
-
-Signals void AnswerRequested()
-
- Sent when the answer button is pressed on the headset
-
- void Connected()
-
- Sent when the device has been connected to.
-
- void Disconnected()
-
- Sent when the device has been disconnected from.
-
- void Stopped()
-
- Sent when the audio connection is closed
-
- void Playing()
-
- Sent when the audio connection is opened
-
- void SpeakerGainChanged(uint16 gain)
-
- The speaker gain changed.
-
- void MicrophoneGainChanged(uint16 gain)
-
- The microphone gain changed.
-
- void CallTerminated()
-
- Sent when an ongoing call is terminated.
-
-
-org.bluez.audio.Gateway interface
-=================================
-
-[not yet implemented]
-
-This interface is available for remote devices which can function in the Audio
-Gateway role of the HSP and/or HFP profiles.
-
-Object path(s) /org/bluez/audio/device*
-
-
-org.bluez.audio.Sink interface
-==============================
-
-This interface is available for remote devices which contain a A2DP Sink.
-
-Object path(s) /org/bluez/audio/device*
-
-Methods void Connect()
-
- Connect and setup a stream to a A2DP sink on the
- remote device.
-
- void Disconnect()
-
- Disconnect from the remote device.
-
- boolean IsConnected()
-
- Returns TRUE if a stream is setup to a A2DP sink on
- the remote device.
-
-Signals void Connected()
-
- Sent when a successful connection has been made to the
- remote A2DP Sink
-
- void Disconnected()
-
- Sent when the device has been disconnected from.
-
- void Playing()
-
- Sent when a stream with remote device is started.
-
- void Stopped()
-
- Sent when a stream with remote device is suspended.
-
-
-org.bluez.audio.Source interface
-================================
-
-[not yet implemented]
-
-This interface is available for remote devices which implement a A2DP source.
-
-Object path(s) /org/bluez/audio/device*
-
-
-org.bluez.audio.Control interface
-=================================
-
-This interface is available for remote devices which implement support for a
-AVRCP controller.
-
-Object path(s) /org/bluez/audio/device*
-
-Methods boolean IsConnected()
-
- Returns TRUE if AVRCP is connected.
-
-Signals void Connected()
-
- Sent when a successful AVRCP connection has been made.
-
- void Disconnected()
-
- Sent when the AVRCP connection has been disconnected.
diff --git a/audio/control.h b/audio/control.h
index 4ebcb9a3..6475df51 100644
--- a/audio/control.h
+++ b/audio/control.h
@@ -22,7 +22,7 @@
*
*/
-#define AUDIO_CONTROL_INTERFACE "org.bluez.audio.Control"
+#define AUDIO_CONTROL_INTERFACE "org.bluez.Control"
int avrcp_init(DBusConnection *conn, GKeyFile *config);
void avrcp_exit(void);
diff --git a/audio/device.h b/audio/device.h
index 96bb0705..20bc4d99 100644
--- a/audio/device.h
+++ b/audio/device.h
@@ -22,8 +22,6 @@
*
*/
-#define AUDIO_DEVICE_INTERFACE "org.bluez.audio.Device"
-
#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805F9B34FB"
#define HSP_HS_UUID "00001108-0000-1000-8000-00805F9B34FB"
@@ -41,9 +39,9 @@
#define AVRCP_TARGET_UUID "0000110C-0000-1000-8000-00805F9B34FB"
/* Move these to respective .h files once they exist */
-#define AUDIO_SOURCE_INTERFACE "org.bluez.audio.Source"
-#define AUDIO_CONTROL_INTERFACE "org.bluez.audio.Control"
-#define AUDIO_TARGET_INTERFACE "org.bluez.audio.Target"
+#define AUDIO_SOURCE_INTERFACE "org.bluez.Source"
+#define AUDIO_CONTROL_INTERFACE "org.bluez.Control"
+#define AUDIO_TARGET_INTERFACE "org.bluez.Target"
struct source;
struct control;
diff --git a/audio/gateway.h b/audio/gateway.h
index 12e413fd..3e44937c 100644
--- a/audio/gateway.h
+++ b/audio/gateway.h
@@ -22,7 +22,7 @@
*
*/
-#define AUDIO_GATEWAY_INTERFACE "org.bluez.audio.Gateway"
+#define AUDIO_GATEWAY_INTERFACE "org.bluez.Gateway"
#define DEFAULT_HSP_HS_CHANNEL 6
#define DEFAULT_HFP_HS_CHANNEL 7
diff --git a/audio/headset.h b/audio/headset.h
index 4c928e54..65c3f411 100644
--- a/audio/headset.h
+++ b/audio/headset.h
@@ -22,7 +22,7 @@
*
*/
-#define AUDIO_HEADSET_INTERFACE "org.bluez.audio.Headset"
+#define AUDIO_HEADSET_INTERFACE "org.bluez.Headset"
#define DEFAULT_HS_AG_CHANNEL 12
#define DEFAULT_HF_AG_CHANNEL 13
diff --git a/audio/main.c b/audio/main.c
index 9afc61e6..4583ca81 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -29,7 +29,6 @@
#include <errno.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
-#include <bluetooth/sdp.h>
#include <glib.h>
#include <dbus/dbus.h>
@@ -57,13 +56,14 @@ static GKeyFile *load_config_file(const char *file)
return keyfile;
}
+static DBusConnection *connection;
+
static int audio_init(void)
{
- DBusConnection *conn;
GKeyFile *config;
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
config = load_config_file(CONFIGDIR "/audio.conf");
@@ -73,8 +73,8 @@ static int audio_init(void)
return -EIO;
}
- if (audio_manager_init(conn, config) < 0) {
- dbus_connection_unref(conn);
+ if (audio_manager_init(connection, config) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
}
@@ -86,6 +86,8 @@ static void audio_exit(void)
audio_manager_exit();
unix_exit();
+
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit)
diff --git a/audio/manager.h b/audio/manager.h
index 209488b0..708b52be 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -22,10 +22,6 @@
*
*/
-#define MAX_PATH_LENGTH 64 /* D-Bus path */
-#define AUDIO_MANAGER_PATH "/org/bluez/audio"
-#define AUDIO_MANAGER_INTERFACE "org.bluez.audio.Manager"
-
struct enabled_interfaces {
gboolean headset;
gboolean gateway;
diff --git a/audio/sink.h b/audio/sink.h
index b067e19c..f5d56fef 100644
--- a/audio/sink.h
+++ b/audio/sink.h
@@ -22,7 +22,7 @@
*
*/
-#define AUDIO_SINK_INTERFACE "org.bluez.audio.Sink"
+#define AUDIO_SINK_INTERFACE "org.bluez.Sink"
struct sink *sink_init(struct audio_device *dev);
void sink_unregister(struct audio_device *dev);
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index a161bc1e..701de220 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -130,7 +130,7 @@ static DBusMessage *outgoing_call(DBusConnection *conn, DBusMessage *msg,
telephony_update_indicator(dummy_indicators, "callsetup",
EV_CALLSETUP_ALERTING);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *incoming_call(DBusConnection *conn, DBusMessage *msg,
@@ -149,7 +149,7 @@ static DBusMessage *incoming_call(DBusConnection *conn, DBusMessage *msg,
telephony_calling_started_ind(number);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *cancel_call(DBusConnection *conn, DBusMessage *msg,
@@ -167,7 +167,7 @@ static DBusMessage *cancel_call(DBusConnection *conn, DBusMessage *msg,
telephony_update_indicator(dummy_indicators, "call",
EV_CALL_INACTIVE);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
@@ -187,7 +187,7 @@ static DBusMessage *signal_strength(DBusConnection *conn, DBusMessage *msg,
debug("telephony-dummy: signal strength set to %u", strength);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *battery_level(DBusConnection *conn, DBusMessage *msg,
@@ -206,7 +206,7 @@ static DBusMessage *battery_level(DBusConnection *conn, DBusMessage *msg,
debug("telephony-dummy: battery level set to %u", level);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *roaming_status(DBusConnection *conn, DBusMessage *msg,
@@ -225,7 +225,7 @@ static DBusMessage *roaming_status(DBusConnection *conn, DBusMessage *msg,
debug("telephony-dummy: roaming status set to %d", val);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *registration_status(DBusConnection *conn, DBusMessage *msg,
@@ -244,7 +244,7 @@ static DBusMessage *registration_status(DBusConnection *conn, DBusMessage *msg,
debug("telephony-dummy: registration status set to %d", val);
- return dbus_message_new_method_return(msg);;
+ return dbus_message_new_method_return(msg);
}
static GDBusMethodTable dummy_methods[] = {
diff --git a/audio/test-audio b/audio/test-audio
deleted file mode 100755
index 19ea6252..00000000
--- a/audio/test-audio
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/python
-
-import dbus
-
-bus = dbus.SystemBus()
-
-manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
- 'org.bluez.Manager')
-
-conn = manager.ActivateService('audio')
-
-audio = dbus.Interface(bus.get_object(conn, '/org/bluez/audio'),
- 'org.bluez.audio.Manager')
-
-try:
- headset = dbus.Interface(bus.get_object(conn, audio.DefaultHeadset()),
- 'org.bluez.audio.Headset')
-except:
- pass
-
-try:
- device = dbus.Interface(bus.get_object(conn, audio.DefaultDevice()),
- 'org.bluez.audio.Device')
- sink = dbus.Interface(bus.get_object(conn, audio.DefaultDevice()),
- 'org.bluez.audio.Sink')
-except:
- pass
diff --git a/bootstrap-configure b/bootstrap-configure
index 5ba74487..7b07fe1b 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -26,7 +26,7 @@ fi
--enable-pand \
--enable-dund \
--enable-test \
- --disable-cups \
+ --enable-cups \
--disable-manpages \
--disable-configfiles \
--disable-initscripts \
diff --git a/configure.ac b/configure.ac
index 9f809c4a..103ddb84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ(2.50)
AC_INIT()
-AM_INIT_AUTOMAKE(bluez, 4.2)
+AM_INIT_AUTOMAKE(bluez, 4.4)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
diff --git a/cups/Makefile.am b/cups/Makefile.am
index f01665ee..70a8ba82 100644
--- a/cups/Makefile.am
+++ b/cups/Makefile.am
@@ -6,8 +6,7 @@ cups_PROGRAMS = bluetooth
bluetooth_SOURCES = main.c cups.h sdp.c spp.c hcrp.c
-bluetooth_LDADD = $(top_builddir)/common/libhelper.a \
- @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@
+bluetooth_LDADD = @GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@
endif
AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@
diff --git a/cups/main.c b/cups/main.c
index 001d6788..15517f61 100644
--- a/cups/main.c
+++ b/cups/main.c
@@ -41,7 +41,6 @@
#include <gdbus.h>
#include "cups.h"
-#include "sdp-xml.h"
extern int sdp_search_spp(sdp_session_t *sdp, uint8_t *channel);
extern int sdp_search_hcrp(sdp_session_t *sdp, unsigned short *ctrl_psm, unsigned short *data_psm);
@@ -63,6 +62,11 @@ static DBusConnection *conn = NULL;
#define ATTRID_1284ID 0x0300
+static sdp_record_t *sdp_xml_parse_record(const char *data, int size)
+{
+ return NULL;
+}
+
static char *parse_xml_sdp(const char *xml)
{
sdp_record_t *sdp_record;
@@ -72,6 +76,7 @@ static char *parse_xml_sdp(const char *xml)
sdp_record = sdp_xml_parse_record(xml, strlen(xml));
if (sdp_record == NULL)
return NULL;
+
for (l = sdp_record->attrlist; l != NULL; l = l->next) {
sdp_data_t *data;
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 561741e7..190ea3fb 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -26,5 +26,7 @@ else
EXTRA_DIST = $(DOC_MAIN_SGML_FILE) $(content_files)
endif
-EXTRA_DIST += manager-api.txt adapter-api.txt device-api.txt agent-api.txt \
- serial-api.txt network-api.txt input-api.txt audio-api.txt
+EXTRA_DIST += manager-api.txt adapter-api.txt device-api.txt \
+ service-api.txt agent-api.txt \
+ serial-api.txt network-api.txt \
+ input-api.txt audio-api.txt
diff --git a/doc/audio-api.txt b/doc/audio-api.txt
index b9f0a920..59ef8354 100644
--- a/doc/audio-api.txt
+++ b/doc/audio-api.txt
@@ -11,7 +11,7 @@ Headset hierarchy
Service org.bluez
Interface org.bluez.Headset
-Object path /{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods void Connect()
@@ -102,7 +102,7 @@ Sink hierarchy
Service org.bluez
Interface org.bluez.Sink
-Object path /{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods void Connect()
diff --git a/doc/input-api.txt b/doc/input-api.txt
index c0816eec..46de8387 100644
--- a/doc/input-api.txt
+++ b/doc/input-api.txt
@@ -9,7 +9,7 @@ Input hierarchy
Service org.bluez
Interface org.bluez.Input
-Object path /{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods void Connect()
diff --git a/doc/network-api.txt b/doc/network-api.txt
index 85171711..72958dff 100644
--- a/doc/network-api.txt
+++ b/doc/network-api.txt
@@ -9,7 +9,7 @@ Network hierarchy
Service org.bluez
Interface org.bluez.Network
-Object path /{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods string Connect(string uuid)
diff --git a/doc/serial-api.txt b/doc/serial-api.txt
index 21c4f220..ce933b64 100644
--- a/doc/serial-api.txt
+++ b/doc/serial-api.txt
@@ -9,7 +9,7 @@ Serial hierarchy
Service org.bluez
Interface org.bluez.Serial
-Object path /{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
Methods string Connect(string uuid)
diff --git a/input/device.c b/input/device.c
index e5fe0c46..44bec0d6 100644
--- a/input/device.c
+++ b/input/device.c
@@ -52,7 +52,7 @@
#include "fakehid.h"
#include "glib-helper.h"
-#define INPUT_DEVICE_INTERFACE "org.bluez.input.Device"
+#define INPUT_DEVICE_INTERFACE "org.bluez.Input"
#define BUF_SIZE 16
diff --git a/input/main.c b/input/main.c
index d3d152e0..8df96891 100644
--- a/input/main.c
+++ b/input/main.c
@@ -28,7 +28,6 @@
#include <errno.h>
#include <bluetooth/bluetooth.h>
-#include <bluetooth/sdp.h>
#include <gdbus.h>
@@ -53,19 +52,20 @@ static GKeyFile *load_config_file(const char *file)
return keyfile;
}
+static DBusConnection *connection;
+
static int input_init(void)
{
GKeyFile *config;
- DBusConnection *conn;
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
config = load_config_file(CONFIGDIR "/input.conf");
- if (input_manager_init(conn, config) < 0) {
- dbus_connection_unref(conn);
+ if (input_manager_init(connection, config) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
}
@@ -78,6 +78,8 @@ static int input_init(void)
static void input_exit(void)
{
input_manager_exit();
+
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("input", input_init, input_exit)
diff --git a/input/manager.c b/input/manager.c
index a2a22762..d3829323 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -25,21 +25,14 @@
#include <config.h>
#endif
-#include <ctype.h>
-#include <dirent.h>
#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
#include <bluetooth/hidp.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
-#include <glib.h>
-#include <dbus/dbus.h>
#include <gdbus.h>
#include "logging.h"
@@ -49,10 +42,8 @@
#include "device.h"
#include "server.h"
-#include "error.h"
#include "manager.h"
#include "storage.h"
-#include "glib-helper.h"
static int idle_timeout = 0;
@@ -319,12 +310,11 @@ int input_manager_init(DBusConnection *conn, GKeyFile *config)
void input_manager_exit(void)
{
-
- btd_unregister_adapter_driver(&input_server_driver);
-
btd_unregister_device_driver(&input_hid_driver);
btd_unregister_device_driver(&input_headset_driver);
+ btd_unregister_adapter_driver(&input_server_driver);
+
dbus_connection_unref(connection);
connection = NULL;
diff --git a/network/connection.c b/network/connection.c
index 16d3e383..c17950bc 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -44,7 +44,7 @@
#include "error.h"
#include "common.h"
-#define NETWORK_PEER_INTERFACE "org.bluez.network.Peer"
+#define NETWORK_PEER_INTERFACE "org.bluez.Network"
typedef enum {
CONNECTED,
@@ -123,12 +123,6 @@ static inline DBusMessage *not_connected(DBusMessage *msg)
"Device not connected");
}
-static inline DBusMessage *no_pending_connect(DBusMessage *msg)
-{
- return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
- "Device has no pending connect");
-}
-
static inline DBusMessage *connection_attempt_failed(DBusMessage *msg, int err)
{
return g_dbus_create_error(msg, ERROR_INTERFACE ".ConnectionAttemptFailed",
diff --git a/network/main.c b/network/main.c
index 6efdb81d..b81c111b 100644
--- a/network/main.c
+++ b/network/main.c
@@ -32,16 +32,16 @@
#include "plugin.h"
#include "manager.h"
+static DBusConnection *connection;
+
static int network_init(void)
{
- DBusConnection *conn;
-
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
- if (network_manager_init(conn) < 0) {
- dbus_connection_unref(conn);
+ if (network_manager_init(connection) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
}
@@ -51,6 +51,8 @@ static int network_init(void)
static void network_exit(void)
{
network_manager_exit();
+
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("network", network_init, network_exit)
diff --git a/network/manager.c b/network/manager.c
index c9555285..cafb7442 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -368,7 +368,6 @@ int network_manager_init(DBusConnection *conn)
return -1;
/* Register PANU, GN and NAP servers if they don't exist */
- /* FIXME: server should be registered as adapter driver */
btd_register_adapter_driver(&network_panu_server_driver);
btd_register_adapter_driver(&network_gn_server_driver);
btd_register_adapter_driver(&network_nap_server_driver);
@@ -397,6 +396,10 @@ void network_manager_exit(void)
connection_exit();
}
+ btd_unregister_adapter_driver(&network_panu_server_driver);
+ btd_unregister_adapter_driver(&network_gn_server_driver);
+ btd_unregister_adapter_driver(&network_nap_server_driver);
+
dbus_connection_unref(connection);
connection = NULL;
diff --git a/network/server.c b/network/server.c
index 00e8f0aa..e283a994 100644
--- a/network/server.c
+++ b/network/server.c
@@ -52,9 +52,9 @@
#include "bridge.h"
#include "common.h"
-#define NETWORK_PEER_INTERFACE "org.bluez.network.Peer"
-#define NETWORK_HUB_INTERFACE "org.bluez.network.Hub"
-#define NETWORK_ROUTER_INTERFACE "org.bluez.network.Router"
+#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
/* Pending Authorization */
diff --git a/serial/Makefile.am b/serial/Makefile.am
index 01551889..7a0b34c2 100644
--- a/serial/Makefile.am
+++ b/serial/Makefile.am
@@ -19,6 +19,6 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@
INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src
-EXTRA_DIST = serial-api.txt test-serial
+EXTRA_DIST = serial-api.txt
MAINTAINERCLEANFILES = Makefile.in
diff --git a/serial/main.c b/serial/main.c
index 97b26925..39df1650 100644
--- a/serial/main.c
+++ b/serial/main.c
@@ -26,24 +26,24 @@
#endif
#include <errno.h>
-#include <sys/types.h>
#include <gdbus.h>
#include "plugin.h"
-#include "logging.h"
#include "manager.h"
+static DBusConnection *connection;
+
static int serial_init(void)
{
- DBusConnection *conn;
-
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (conn == NULL)
+ connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (connection == NULL)
return -EIO;
- if (serial_manager_init(conn) < 0)
+ if (serial_manager_init(connection) < 0) {
+ dbus_connection_unref(connection);
return -EIO;
+ }
return 0;
}
@@ -51,6 +51,8 @@ static int serial_init(void)
static void serial_exit(void)
{
serial_manager_exit();
+
+ dbus_connection_unref(connection);
}
BLUETOOTH_PLUGIN_DEFINE("serial", serial_init, serial_exit)
diff --git a/serial/port.c b/serial/port.c
index 0c70dc07..4abd954e 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -53,7 +53,7 @@
#include "manager.h"
#include "storage.h"
-#define SERIAL_PORT_INTERFACE "org.bluez.serial.Port"
+#define SERIAL_PORT_INTERFACE "org.bluez.Serial"
#define ERROR_INVALID_ARGS "org.bluez.Error.InvalidArguments"
#define ERROR_DOES_NOT_EXIST "org.bluez.Error.DoesNotExist"
diff --git a/serial/proxy.c b/serial/proxy.c
index d779d848..7128bdbc 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -67,8 +67,8 @@
#define DIALUP_NET_NAME "dun"
#define DIALUP_NET_UUID "00001103-0000-1000-8000-00805F9B34FB"
-#define SERIAL_PROXY_INTERFACE "org.bluez.serial.Proxy"
-#define SERIAL_MANAGER_INTERFACE "org.bluez.serial.ProxyManager"
+#define SERIAL_PROXY_INTERFACE "org.bluez.SerialProxy"
+#define SERIAL_MANAGER_INTERFACE "org.bluez.SerialProxyManager"
#define BUF_SIZE 1024
typedef enum {
diff --git a/src/device.c b/src/device.c
index 2bc50711..65b68e2f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -87,6 +87,7 @@ struct browse_req {
struct btd_device *device;
GSList *uuids_added;
GSList *uuids_removed;
+ sdp_list_t *records;
int search_uuid;
gboolean browse;
};
@@ -766,6 +767,14 @@ static void services_changed(struct browse_req *req)
g_free(uuids);
}
+static int rec_cmp(const void *a, const void *b)
+{
+ const sdp_record_t *r1 = a;
+ const sdp_record_t *r2 = b;
+
+ return r1->handle - r2->handle;
+}
+
static void update_services(struct browse_req *req, sdp_list_t *recs)
{
struct btd_device *device = req->device;
@@ -776,6 +785,7 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)
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 *uuid_str;
GSList *l;
@@ -785,13 +795,28 @@ static void update_services(struct browse_req *req, sdp_list_t *recs)
if (sdp_get_service_classes(rec, &svcclass) < 0)
continue;
- store_record(src, dst, rec);
/* Extract the first element and skip the remainning */
uuid_str = bt_uuid2string(svcclass->data);
if (!uuid_str)
continue;
+ /* Check for duplicates */
+ if (sdp_list_find(req->records, rec, rec_cmp))
+ continue;
+
+ store_record(src, dst, 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);
+ req->records = sdp_list_append(req->records, record);
+ }
+
l = g_slist_find_custom(device->uuids, uuid_str,
(GCompareFunc) strcmp);
if (!l)
@@ -837,8 +862,11 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
DBusMessage *reply;
const gchar *source = adapter_get_address(adapter);
- if (err < 0)
+ if (err < 0) {
+ error("%s: error updating services: %s (%d)",
+ device->path, strerror(-err), -err);
goto proceed;
+ }
update_services(req, recs);
@@ -856,27 +884,30 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
probe:
- if (!req->uuids_added && !req->uuids_removed)
+ if (!req->uuids_added && !req->uuids_removed) {
+ debug("%s: No service found", device->path);
goto proceed;
+ }
/* Probe matching drivers for services added */
if (req->uuids_added)
- device_probe_drivers(device, req->uuids_added, recs);
+ device_probe_drivers(device, req->uuids_added, req->records);
/* Remove drivers for services removed */
if (req->uuids_removed)
- device_remove_drivers(device, req->uuids_removed, recs);
-
- /* Store the device's profiles in the filesystem */
- store(device);
+ device_remove_drivers(device, req->uuids_removed, req->records);
/* Propagate services changes */
services_changed(req);
proceed:
+
+ /* Store the device's profiles in the filesystem */
+ store(device);
+
if (dbus_message_is_method_call(req->msg, DEVICE_INTERFACE,
"DiscoverServices")) {
- discover_device_reply(req, recs);
+ discover_device_reply(req, req->records);
goto cleanup;
}
@@ -910,6 +941,8 @@ cleanup:
dbus_connection_unref(req->conn);
g_slist_free(req->uuids_added);
g_slist_free(req->uuids_removed);
+ if (req->records)
+ sdp_list_free(req->records, (sdp_free_func_t) sdp_record_free);
g_free(req);
}
diff --git a/test/Makefile.am b/test/Makefile.am
index ba2bdc65..6f317c9d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,7 +41,7 @@ INCLUDES = -I$(top_srcdir)/common
EXTRA_DIST = apitest hsplay hsmicro bdaddr.8 dbusdef.py \
list-devices test-discovery test-manager test-adapter test-device \
- simple-service simple-agent service-record.dtd \
+ test-serial simple-service simple-agent service-record.dtd \
service-did.xml service-spp.xml service-opp.xml service-ftp.xml
MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/simple-service b/test/simple-service
index 5279a3a6..d03ec3db 100755
--- a/test/simple-service
+++ b/test/simple-service
@@ -109,10 +109,10 @@ if len(sys.argv) > 1:
else:
path = manager.DefaultAdapter()
-adapter = dbus.Interface(bus.get_object("org.bluez", path),
- "org.bluez.Adapter")
+service = dbus.Interface(bus.get_object("org.bluez", path),
+ "org.bluez.Service")
-handle = adapter.AddServiceRecord(xml)
+handle = service.AddRecord(xml)
print "Service record with handle 0x%04x added" % (handle)
@@ -124,4 +124,4 @@ try:
except:
pass
-adapter.RemoveServiceRecord(dbus.UInt32(handle))
+service.RemoveRecord(dbus.UInt32(handle))
diff --git a/serial/test-serial b/test/test-serial
index aec728d4..73561cc1 100755
--- a/serial/test-serial
+++ b/test/test-serial
@@ -6,13 +6,11 @@ import dbus
bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
- 'org.bluez.Manager')
+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.Manager")
-conn = manager.ActivateService('serial')
-
-serial = dbus.Interface(bus.get_object(conn, '/org/bluez/serial'),
- 'org.bluez.serial.Manager')
+adapter = dbus.Interface(bus.get_object("org.bluez", manager.DefaultAdapter()),
+ "org.bluez.Adapter")
if (len(sys.argv) < 2):
print "Usage: %s <address> [service]" % (sys.argv[0])
@@ -25,7 +23,12 @@ if (len(sys.argv) < 3):
else:
service = sys.argv[2]
-device = serial.ConnectService(address, service)
+path = adapter.FindDevice(address)
+
+serial = dbus.Interface(bus.get_object("org.bluez", path),
+ "org.bluez.Serial")
+
+node = serial.Connect(service)
print "Connected %s to %s" % (device, address)
@@ -37,4 +40,4 @@ try:
except:
pass
-serial.DisconnectService(device)
+serial.Disconnect(node)