Closed david-skalka closed 5 years ago
I tried 3.0.2-snapshot and realy I can exportObject with Filedescriptor. But bluetoothd Still write same log error. Maybee same connect flags?
I need more information, otherwise I'm unable to help. What do you try to do? Do you have some sample code to reproduce this problem? Which version of bluez are you using? Can you provide the output of debug/trace logging of dbus-java when trying to do what ever you wanted to do?
I try create rfcomm connection from raspberry(bluez) to remote speaker. This must be solved by connect profile and handle socket FileDescriptor's Profile1.NewConnection.
here is my code.
DBusConnection connection = DBusConnection.getConnection(DBusBusType.SYSTEM); connection.exportObject("/", new ProfileImpl()); ProfileManager1 profileManager = connection.getRemoteObject("org.bluez", "/org/bluez", ProfileManager1.class); Map<String, Variant<?>> props = new HashMap<String, Variant<?>>(); profileManager.RegisterProfile( new DBusPath("/"), "00001101-0000-1000-8000-00805F9B34FB", props); Device1 device= connection.getRemoteObject("org.bluez", "/org/bluez/hci0/dev_" + "28:11:A5:8E:CC:13".replace(':', '_'), Device1.class); device.ConnectProfile("00001101-0000-1000-8000-00805F9B34FB");
my version of bluez is 5.43
here is log:
08:15:14.390 [main] DEBUG o.f.dbus.connections.Transport - Connecting to UNIX: {path=/var/run/dbus/system_bus_socket} 08:15:14.636 [main] DEBUG o.f.dbus.messages.MethodCall - Creating message with serial 1 08:15:14.637 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: yyyy data: [66, 1, 0, 1] 08:15:14.639 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: ua(yv) data: [1, [[1, [o, /org/freedesktop/DBus]], [6, [s, org.freedesktop.DBus]], [2, [s, org.freedesktop.DBus]], [3, [s, Hello]]]] 08:15:14.640 [main] DEBUG o.f.dbus.messages.MethodCall - Appended body, type: null start: 128 end: 128 size: 0 08:15:14.641 [main] DEBUG o.f.dbus.messages.MethodCall - marshalled size ([0, 0, 0, 0]): 000000 00 00 00 00 ....
08:15:14.645 [DBus Sender Thread-1] DEBUG org.freedesktop.dbus.MessageWriter - <= MethodCall(0,1) { Path=>/org/freedesktop/DBus, Interface=>org.freedesktop.DBus, Member=>Hello, Destination=>org.freedesktop.DBus } { } 08:15:14.653 [DBusConnection] DEBUG org.freedesktop.dbus.MessageReader - => MethodReturn(1,1) { Reply Serial=>1, Destination=>:1.20, Sender=>org.freedesktop.DBus, Signature=>s } { :1.20 } 08:15:14.655 [DBusConnection] DEBUG o.f.d.c.impl.DBusConnection - Handling incoming method return: MethodReturn(1,1) { Reply Serial=>1, Destination=>:1.20, Sender=>org.freedesktop.DBus, Signature=>s } { :1.20 } 08:15:14.658 [DBusConnection] DEBUG org.freedesktop.dbus.MessageReader - => DBusSignal [clazz=null] 08:15:14.659 [DBusConnection] DEBUG o.f.d.c.impl.DBusConnection - Handling incoming signal: 08:15:14.662 [DBus Worker Thread-1] DEBUG o.f.dbus.messages.DBusSignal - Converting signal to type: class org.freedesktop.DBus$NameAcquired 08:15:14.664 [DBus Worker Thread-1] DEBUG o.f.dbus.messages.DBusSignal - Creating signal of type class org.freedesktop.DBus$NameAcquired with parameters [/org/freedesktop/DBus, :1.20] 08:15:14.664 [DBus Worker Thread-1] DEBUG org.freedesktop.DBus$NameAcquired - Creating message with serial 2 08:15:14.665 [DBus Worker Thread-1] DEBUG org.freedesktop.DBus$NameAcquired - Appending sig: yyyy data: [66, 4, 0, 1] 08:15:14.666 [DBus Worker Thread-1] DEBUG org.freedesktop.DBus$NameAcquired - Appending sig: ua(yv) data: [3, [[1, [o, /org/freedesktop/DBus]], [2, [s, org.freedesktop.DBus]], [3, [s, NameAcquired]], [8, [g, s]]]] 08:15:14.669 [main] DEBUG o.f.dbus.messages.ObjectTree - Adding / to object tree 08:15:14.680 [main] DEBUG o.f.dbus.messages.MethodCall - Creating message with serial 3 08:15:14.680 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: yyyy data: [66, 1, 0, 1] 08:15:14.681 [main] DEBUG o.f.dbus.messages.MethodCall - Appending arguments with signature: osa{sv} 08:15:14.681 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: ua(yv) data: [3, [[1, [o, /org/bluez]], [6, [s, org.bluez]], [2, [s, org.bluez.ProfileManager1]], [3, [s, RegisterProfile]], [8, [g, osa{sv}]]]] 08:15:14.682 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: osa{sv} data: [/, 00001101-0000-1000-8000-00805F9B34FB, {}] 08:15:14.683 [main] DEBUG o.f.dbus.messages.MethodCall - Appended body, type: osa{sv} start: 144 end: 200 size: 56 08:15:14.683 [main] DEBUG o.f.dbus.messages.MethodCall - marshalled size ([0, 0, 0, 56]): 000000 00 00 00 38 ...8
08:15:14.684 [DBus Sender Thread-1] DEBUG org.freedesktop.dbus.MessageWriter - <= MethodCall(0,3) { Path=>/org/bluez, Interface=>org.bluez.ProfileManager1, Member=>RegisterProfile, Destination=>org.bluez, Signature=>osa{sv} } { /, 00001101-0000-1000-8000-00805F9B34FB, {} } 08:15:14.687 [DBusConnection] DEBUG org.freedesktop.dbus.MessageReader - => MethodReturn(1,355) { Reply Serial=>3, Destination=>:1.20, Sender=>:1.4 } { } 08:15:14.688 [DBusConnection] DEBUG o.f.d.c.impl.DBusConnection - Handling incoming method return: MethodReturn(1,355) { Reply Serial=>3, Destination=>:1.20, Sender=>:1.4 } { } 08:15:14.703 [main] DEBUG o.f.dbus.messages.MethodCall - Creating message with serial 4 08:15:14.703 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: yyyy data: [66, 1, 0, 1] 08:15:14.704 [main] DEBUG o.f.dbus.messages.MethodCall - Appending arguments with signature: s 08:15:14.704 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: ua(yv) data: [4, [[1, [o, /org/bluez/hci0/dev_28_11_A5_8E_CC_13]], [6, [s, org.bluez]], [2, [s, org.bluez.Device1]], [3, [s, ConnectProfile]], [8, [g, s]]]] 08:15:14.705 [main] DEBUG o.f.dbus.messages.MethodCall - Appending sig: s data: [00001101-0000-1000-8000-00805F9B34FB] 08:15:14.705 [main] DEBUG o.f.dbus.messages.MethodCall - Appended body, type: s start: 152 end: 193 size: 41 08:15:14.706 [main] DEBUG o.f.dbus.messages.MethodCall - marshalled size ([0, 0, 0, 41]): 000000 00 00 00 29 ...)
08:15:14.706 [DBus Sender Thread-1] DEBUG org.freedesktop.dbus.MessageWriter - <= MethodCall(0,4) { Path=>/org/bluez/hci0/dev_28_11_A5_8E_CC_13, Interface=>org.bluez.Device1, Member=>ConnectProfile, Destination=>org.bluez, Signature=>s } { 00001101-0000-1000-8000-00805F9B34FB } 08:15:14.859 [DBusConnection] DEBUG org.freedesktop.dbus.MessageReader - => MethodReturn(1,358) { Reply Serial=>4, Destination=>:1.20, Sender=>:1.4 } { } 08:15:14.860 [DBusConnection] DEBUG o.f.d.c.impl.DBusConnection - Handling incoming method return: MethodReturn(1,358) { Reply Serial=>4, Destination=>:1.20, Sender=>:1.4 } { } ^Cpi@smarthome:~ $
I can't see any issue in the log you've posted.
Also I'm unable to reproduce the problem, as I don't have a bluetooth device which accepts the usage of the serial port profile. In my tests with my android smartphone, the operation will fail with "In progress" error.
Syslog reports:
"RFCOMM server failed for Serial Port: rfcomm_bind: Address already in use (98)"
This is a different kind of error, which has nothing to do with dbus-java but with the connected bluetooth device.
Anyways, I found a small bug in bluez-dbus where Profile1.NewConnection
used Object
instead of FileDescriptor
for parameter _fd
.
It's fixed in the latest commit on that project.
Issue is only in syslog: "bluetoothd[306]: Serial Port replied with an error: org.freedesktop.DBus.Error.NotSupported, Tried to send message with Unix file descriptorsto a client that doesn't support that."
You can try this https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_US for create rfcomm server
Bug in bluez-dbus I know, I replaced Object by Filedescriptor.
In syslog i see then bluetoothd tried fire NewConnection handler but it couse error and NewConnection desn't call.
Nope, this is not reproducible this way.. I still get 'Already in use' error, even when running this strange app.
Issue si only in syslog. bluetoothd[306]: Serial Port replied with an error: org.freedesktop.DBus.Error.NotSupported, Tried to send message with Unix file descriptorsto a client that doesn't support that.
Bug in profile1.java I know. I Replaced object
Important part filedescriptor is not implement. You can't handle many actions, for example org.bluez.Profile1.NewConnection
/var/log/syslog bluetoothd[306]: Serial Port replied with an error: org.freedesktop.DBus.Error.NotSupported, Tried to send message with Unix file descriptorsto a client that doesn't support that.