summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--serial/port.c2
-rwxr-xr-xtest/test-serial43
2 files changed, 44 insertions, 1 deletions
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/test/test-serial b/test/test-serial
new file mode 100755
index 00000000..73561cc1
--- /dev/null
+++ b/test/test-serial
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+import sys
+import time
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+ "org.bluez.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])
+ sys.exit(1)
+
+address = sys.argv[1]
+
+if (len(sys.argv) < 3):
+ service = "spp"
+else:
+ service = sys.argv[2]
+
+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)
+
+print "Press CTRL-C to disconnect"
+
+try:
+ time.sleep(1000)
+ print "Terminating connection"
+except:
+ pass
+
+serial.Disconnect(node)