Skip to contentSkip to conversation

Sim Access profile server implementation

DISCUSSION suraj 3 participants 15 messages Jun 6, 2009 – Oct 8, 2010

Subsystems (2)
lore
Share & tools
lore

suraj

author
#0 lore raw

Hi,

Please find the Git tree for the Sim access profile server role implementation I have been working on at

git://gitorious.org/sap-server/sap-server.git

Not sure it could be directly used with Bluez. Nevertheless, it has the parser implementation of Bluetooth SAP packet. Someone could possibly reuse it in their implementation.

Regards
Suraj

maintainer
#1 lore raw

Hi Suraj,

Quoted 8 lines

Please find the Git tree for the Sim access profile server role implementation I have been working on at

git://gitorious.org/sap-server/sap-server.git

Not sure it could be directly used with Bluez. Nevertheless, it has the parser implementation of Bluetooth SAP packet. Someone could possibly reuse it in their implementation.

have you actually tested this with real SAP server capable hardware? I am still not convinced at all to push APDU over D-Bus. First, there is potential security issue here and second the latency that D-Bus introduces seems not be acceptable. So what I am getting it, can this be actually used in a product that seriously wants to support SAP server?

Regards

Marcel

#2 lore raw

Hi Marcel,

I understand you concerns about dbus reliability and I agree with you , but I guess we should find a compromise solution as ofono is not used widely in Linux mobile platforms nowadays.

I my view, combination of a bluez plugin for sap and a platform dependend sim driver is a reliable and most available solution so far. The SAP plugin implements BT SAP spec and require simple API (connect, disconnect, apdu, atr, status) which is implemented in SIM driver for a certain platform. This way it's relatively easy to support SAP in different platforms. Ofono can have its own driver as well.

What's you view on such design?
Can we also have a double solution one in ofono for ofono aware platforms and the second as a plugin for others?

BTW, I already have this implemented and tested with real hardware (STEricsson). Bluez SAP works fine with Nokia 616 carkit :)

Regards,
/Waldek

Quoted 38 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel Holtmann
Sent: Tuesday, October 05, 2010 10:02 AM
To: suraj
Cc: [email protected]; Jothikumar Mothilal
Subject: Re: Sim Access profile server implementation

Hi Suraj,

Quoted 8 lines

Please find the Git tree for the Sim access profile server role implementation I have been working on at

git://gitorious.org/sap-server/sap-server.git

Not sure it could be directly used with Bluez. Nevertheless, it has the parser implementation of Bluetooth SAP packet. Someone could possibly reuse it in their implementation.

have you actually tested this with real SAP server capable hardware? I am still not convinced at all to push APDU over D-Bus. First, there is potential security issue here and second the latency that D-Bus introduces seems not be acceptable. So what I am getting it, can this be actually used in a product that seriously wants to support SAP server?

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw

Hi Waldemar,

please no top posting on this mailing list.

Quoted 6 lines

I understand you concerns about dbus reliability and I agree with you , but I guess we should find a compromise solution as ofono is not used widely in Linux mobile platforms nowadays.

I my view, combination of a bluez plugin for sap and a platform dependend sim driver is a reliable and most available solution so far. The SAP plugin implements BT SAP spec and require simple API (connect, disconnect, apdu, atr, status) which is implemented in SIM driver for a certain platform. This way it's relatively easy to support SAP in different platforms. Ofono can have its own driver as well.

What's you view on such design?
Can we also have a double solution one in ofono for ofono aware platforms and the second as a plugin for others?

I am fine with starting this in BlueZ and see how far we get. And yes, plugin based is a must from my point of view. It is most likely similar to our different telephony drivers for Handsfree support.

We will move strongly in the direction of oFono being the main telephony stack. So I do care mostly that this work in conjunction with oFono. Everything else is just a nice benefit if it doesn't clutter the overhaul implementation and requires pointless abstraction everywhere.

Quoted 1 line

BTW, I already have this implemented and tested with real hardware (STEricsson). Bluez SAP works fine with Nokia 616 carkit :)

Can you share that code with us. And also hardware if you. We are still having hard time to find proper hardware to test this on.

Regards

Marcel

#4 lore raw

Marcel,

Quoted 3 lines

please no top posting on this mailing list.

Sorry, didn't know that. Thanks for pointing this out.

Quoted 14 lines
Quoted 1 line

I understand you concerns about dbus reliability and I agree=20

with you , but I guess we should find a compromise solution as=20 ofono is not used widely in Linux mobile platforms nowadays.

Quoted 2 lines

=20
I my view, combination of a bluez plugin for sap and a=20

platform dependend sim driver is a reliable and most available=20 solution so far. The SAP plugin implements BT SAP spec and=20 require simple API (connect, disconnect, apdu, atr, status)=20 which is implemented in SIM driver for a certain platform.=20 This way it's relatively easy to support SAP in different=20 platforms. Ofono can have its own driver as well.

Quoted 3 lines

=20
What's you view on such design?
Can we also have a double solution one in ofono for ofono=20

Quoted 6 lines

aware platforms and the second as a plugin for others?=20

I am fine with starting this in BlueZ and see how far we get.=20 And yes, plugin based is a must from my point of view. It is=20 most likely similar to our different telephony drivers for=20 Handsfree support.

It's nice to here that.

Quoted 11 lines

We will move strongly in the direction of oFono being the main=20 telephony stack. So I do care mostly that this work in=20 conjunction with oFono.
Everything else is just a nice benefit if it doesn't clutter=20 the overhaul implementation and requires pointless abstraction=20 everywhere.

Quoted 2 lines

BTW, I already have this implemented and tested with real hardware=20 (STEricsson). Bluez SAP works fine with Nokia 616 carkit :)

Can you share that code with us. And also hardware if you. We=20 are still having hard time to find proper hardware to test this on.

Will send a patch soon. I use http://www.stericsson.com/platforms/U8500.jsp=
hw, but need to check if I can share one with you.

Regards,
/Waldek=

#5 lore raw

Hi Marcel,

Quoted 9 lines
Quoted 2 lines

Can you share that code with us. And also hardware if you. We

are still

Quoted 1 line

having hard time to find proper hardware to test this on.

Will send a patch soon. I use
http://www.stericsson.com/platforms/U8500.jsp hw, but need to check if I can share one with you.

Here you are the patch. Just note that it is based on an old bluez 4.4x If you consider to accept the design I will update the patch upon the latest release.

Will appreciate any comments.

Thanks,
/Waldek

From 12f560c28fd3fe926d10639156e10d089dd26506 Mon Sep 17 00:00:00 2001
From: Waldemar Rymarkiewicz <[email protected]>
Date: Tue, 28 Sep 2010 17:24:19 +0200
Subject: [PATCH] Add Sim Access plugin

Sim Access plugin implements Sim Access Profile server role according to the Bluetooth Sim Access Profile v1.1 specification.

Change-Id: I55e86dda969ae18339a134686ebf0b31a74ff335

---
 Makefile.am     |    2 +-
 acinclude.m4    |   13 +
 configure.ac    |    1 +
 sap/Android.mk  |   33 ++
 sap/Makefile.am |   25 +
 sap/main.c      |   57 +++
 sap/manager.c   |   98 ++++
 sap/manager.h   |   23 +
 sap/sap-dummy.c |   76 +++
 sap/sap-ste.c   | 1309 +++++++++++++++++++++++++++++++++++++++++++++++++
 sap/sap.h       |  200 ++++++++
 sap/server.c    | 1459 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sap/server.h    |   25 +
 13 files changed, 3320 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 Makefile.am
 mode change 100644 => 100755 acinclude.m4
 mode change 100644 => 100755 configure.ac
 create mode 100644 sap/Android.mk
 create mode 100644 sap/Makefile.am
 create mode 100644 sap/main.c
 create mode 100644 sap/manager.c
 create mode 100644 sap/manager.h
 create mode 100644 sap/sap-dummy.c
 create mode 100644 sap/sap-ste.c
 create mode 100644 sap/sap.h
 create mode 100644 sap/server.c
 create mode 100644 sap/server.h
Makefile.am +1 -1
old mode 100644
new mode 100755
index c4c6322..acea6bb
@@ -1,6 +1,6 @@
 
 SUBDIRS = include lib sbc gdbus common plugins src client\
-			network serial input audio tools \
+			network serial input audio tools sap\
 			rfcomm compat cups test scripts doc
 
 EXTRA_DIST = bluez.m4
acinclude.m4 +13 -0
old mode 100644
new mode 100755
index 248fed3..68962bc
@@ -197,6 +197,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	input_enable=yes
 	serial_enable=yes
 	network_enable=yes
+	sap_enable=yes
 	service_enable=yes
 	tools_enable=yes
 	hidd_enable=no
@@ -212,6 +213,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	udevrules_enable=yes
 	configfiles_enable=yes
 	telephony_driver=dummy
+	sap_driver=dummy
 
 	AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable code optimization]), [
 		optimization_enable=${enableval}
@@ -241,6 +243,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 		audio_enable=${enableval}
 	])
 
+	AC_ARG_ENABLE(sap, AC_HELP_STRING([--disable-sap], [disable sap plugin]), [
+		sap_enable=${enableval}
+	])
+
 	AC_ARG_ENABLE(service, AC_HELP_STRING([--disable-service], [disable service plugin]), [
 		service_enable=${enableval}
 	])
@@ -323,6 +329,12 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 
 	AC_SUBST([TELEPHONY_DRIVER], [telephony-${telephony_driver}.c])
 
+	AC_ARG_WITH(sap, AC_HELP_STRING([--with-sap=DRIVER], [select SIM Access driver]), [
+		sap_driver=${withval}
+	])
+
+	AC_SUBST([SAP_DRIVER], [sap-${sap_driver}.c])
+
 	if (test "${fortify_enable}" = "yes"); then
 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 	fi
@@ -363,6 +375,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	AM_CONDITIONAL(INPUTPLUGIN, test "${input_enable}" = "yes")
 	AM_CONDITIONAL(SERIALPLUGIN, test "${serial_enable}" = "yes")
 	AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
+	AM_CONDITIONAL(SAPPLUGIN, test "${sap_enable}" = "yes")
 	AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes")
 	AM_CONDITIONAL(HIDD, test "${hidd_enable}" = "yes")
 	AM_CONDITIONAL(PAND, test "${pand_enable}" = "yes")
configure.ac +1 -0
old mode 100644
new mode 100755
index 85e1dae..512d032
@@ -71,4 +71,5 @@ AC_OUTPUT([
 	src/bluetoothd.8
 	src/hcid.conf.5
 	bluez.pc
+	sap/Makefile
 ])
sap/Android.mk new file +33 -0
new file mode 100644
index 0000000..d46837a
@@ -0,0 +1,33 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+	manager.c \
+	server.c \
+	main.c \
+	sap-ste.c
+
+LOCAL_CFLAGS:= \
+	-DVERSION=\"4.47\"
+
+LOCAL_C_INCLUDES:= \
+	$(LOCAL_PATH)/../include \
+	$(LOCAL_PATH)/../common \
+	$(LOCAL_PATH)/../gdbus \
+	$(LOCAL_PATH)/../src \
+	$(call include-path-for, glib) \
+	$(call include-path-for, dbus)
+
+LOCAL_SHARED_LIBRARIES := \
+	libbluetoothd \
+	libbluetooth \
+	libdbus
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/bluez-plugin
+LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/bluez-plugin
+LOCAL_MODULE := sap
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
sap/Makefile.am new file +25 -0
new file mode 100644
index 0000000..2166cfc
@@ -0,0 +1,25 @@
+if SAPPLUGIN
+plugindir = $(libdir)/bluetooth/plugins
+
+plugin_LTLIBRARIES = sap.la
+
+sap_la_SOURCES = server.c manager.h sap.c \
+		server.h manager.c \
+		sap.h main.c
+
+LDADD = $(top_builddir)/common/libhelper.a \
+		@GDBUS_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@
+endif
+
+AM_LDFLAGS = -module -avoid-version -no-undefined
+
+AM_CFLAGS = -fvisibility=hidden \
+		@BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@
+
+INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src
+
+MAINTAINERCLEANFILES = Makefile.in
+
+sap.c: @SAP_DRIVER@
+	@if [ ! -e $@ ] ; then $(LN_S) $< $@ ; fi
+
sap/main.c new file +57 -0

57 lines not on this page · raw message

sap/manager.c new file +98 -0

98 lines not on this page · raw message

sap/manager.h new file +23 -0
new file mode 100644
index 0000000..5c1c02a
@@ -0,0 +1,23 @@
+/*
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2010 ST-Ericsson SA
+ *  Copyright (C) 2010 Claudio Takahasi<[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+int sap_manager_init(DBusConnection *conn);
+void sap_manager_exit(void);
+
sap/sap-dummy.c new file +76 -0

76 lines not on this page · raw message

sap/sap-ste.c new file +1309 -0

1,309 lines not on this page · raw message

sap/sap.h new file +200 -0

200 lines not on this page · raw message

sap/server.c new file +1459 -0

1,124 lines not on this page · raw message

sap/server.h new file +25 -0
new file mode 100644
index 0000000..4dca525

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#6 lore raw

Hi Waldek,

Quoted 13 lines · On 10/6/2010 3:02 PM, [email protected] wrote:

Hi Marcel,

Quoted 9 lines
Quoted 2 lines

Can you share that code with us. And also hardware if you. We

are still

Quoted 1 line

having hard time to find proper hardware to test this on.

Will send a patch soon. I use
http://www.stericsson.com/platforms/U8500.jsp hw, but need to check if I can share one with you.

Quoted 7 lines

Here you are the patch. Just note that it is based on an old bluez 4.4x If you consider to accept the design I will update the patch upon the latest release.

Will appreciate any comments.

Thanks,
/Waldek

Which part of this is the driver and which is the agent here?

If I am not mistaken, you are sending the responses directly from code here, how can we extend this to another hardware/agent without source code change?

I don't see D-bus being used other than for set/get property.

Correct me if my understanding is wrong.

Regards
Suraj

#7 lore raw

Hi suraj,=20

Quoted 1 line

Which part of this is the driver and which is the agent here?

sap-ste.c is a driver for u8500 platform. The agent is not involved in this=
design.

Quoted 3 lines

If I am not mistaken, you are sending the responses directly=20 from code here, how can we extend this to another=20 hardware/agent without source code change?

You are right. You can add a new driver that implements interfaces in sap.h=
then configure with ./configure --enable-sap=3Dyes --with-sap=3DDRIVER
You don't have to modify the code, but you have to rebuild with your driver= . Usually, there will be one driver per platform so it shoudl not be a prob= lem.

Quoted 1 line

I don't see D-bus being used other than for set/get property.

We use D-bus only for enable/disable sap server. Data flow to sim is done o= ver unix sockets (for u8500) as I have doubts to dbus reliability. However,=
it's good option to do tests with dbus oriented design as discussed before=
.

Quoted 2 lines

Correct me if my understanding is wrong.

Regards,
/Waldek=

#8 lore raw

Hi Waldek,

Quoted 10 lines · On 10/6/2010 3:43 PM, [email protected] wrote:

Hi suraj,

Quoted 1 line

Which part of this is the driver and which is the agent here?

sap-ste.c is a driver for u8500 platform. The agent is not involved in this design.

Quoted 3 lines

If I am not mistaken, you are sending the responses directly from code here, how can we extend this to another hardware/agent without source code change?

Quoted 6 lines

You are right. You can add a new driver that implements interfaces in sap.h then configure with ./configure --enable-sap=yes --with-sap=DRIVER You don't have to modify the code, but you have to rebuild with your driver. Usually, there will be one driver per platform so it shoudl not be a problem.

Quoted 1 line

I don't see D-bus being used other than for set/get property.

We use D-bus only for enable/disable sap server. Data flow to sim is done over unix sockets (for u8500) as I have doubts to dbus reliability. However, it's good option to do tests with dbus oriented design as discussed before.

So basically your implementation does not use d-bus for basic SAP operations and the SIM access driver is compiled as part of bluetoothd right?

Quoted 6 lines
Quoted 3 lines

Correct me if my understanding is wrong.

Regards,
/Waldek

Regards
Suraj

#9 lore raw

Hi Suraj,
=20

Quoted 8 lines

So basically your implementation does not use d-bus for basic=20 SAP operations and the SIM access driver is compiled as part=20 of bluetoothd right?

Quoted 3 lines
Quoted 3 lines

Correct me if my understanding is wrong.

Exactly.

Regards,
/Waldek

#10 lore raw
In reply to [email protected]

Hi Waldek,

Quoted 13 lines · On 10/6/2010 3:02 PM, [email protected] wrote:

Hi Marcel,

Quoted 9 lines
Quoted 2 lines

Can you share that code with us. And also hardware if you. We

are still

Quoted 1 line

having hard time to find proper hardware to test this on.

Will send a patch soon. I use
http://www.stericsson.com/platforms/U8500.jsp hw, but need to check if I can share one with you.

Quoted 7 lines

Here you are the patch. Just note that it is based on an old bluez 4.4x If you consider to accept the design I will update the patch upon the latest release.

Will appreciate any comments.

Thanks,
/Waldek

Which part of this is the driver and which is the agent here?

If I am not mistaken, you are sending the responses directly from code here, how can we extend this to another hardware/agent without source code change?

I don't see D-bus being used other than for set/get property.

Correct me if my understanding is wrong.

Regards
Suraj

maintainer
#11 lore raw
In reply to [email protected]

Hi Waldemar,

Quoted 11 lines
Quoted 8 lines
Quoted 1 line

Can you share that code with us. And also hardware if you. We

are still

Quoted 1 line

having hard time to find proper hardware to test this on.

Will send a patch soon. I use
http://www.stericsson.com/platforms/U8500.jsp hw, but need to check if I can share one with you.

Here you are the patch. Just note that it is based on an old bluez 4.4x If you consider to accept the design I will update the patch upon the latest release.

in general I am fine if we do this similar to what we do with the different telephony backend. So yes, go ahead with this.

However, please clean this up. The patch needs a lot of work before it would be ready upstream. And of course it requires a dummy SAP plugin as well. Same as we do have for telephony.

Regards

Marcel

#12 lore raw

Hi Marcel,=20

Quoted 7 lines

in general I am fine if we do this similar to what we do with=20 the different telephony backend. So yes, go ahead with this.

However, please clean this up. The patch needs a lot of work=20 before it would be ready upstream. And of course it requires a=20 dummy SAP plugin as well. Same as we do have for telephony.

Then, I will prepare it for upstream.=20

Regards,
/Waldek

#13 lore raw
In reply to Marcel Holtmann

Hi Waldemar,

Quoted 20 lines · Marcel Holtmann

Hi Waldemar,

please no top posting on this mailing list.

Quoted 6 lines

I understand you concerns about dbus reliability and I agree with you , but I guess we should find a compromise solution as ofono is not used widely in Linux mobile platforms nowadays.

I my view, combination of a bluez plugin for sap and a platform dependend sim driver is a reliable and most available solution so far. The SAP plugin implements BT SAP spec and require simple API (connect, disconnect, apdu, atr, status) which is implemented in SIM driver for a certain platform. This way it's relatively easy to support SAP in different platforms. Ofono can have its own driver as well.

What's you view on such design?
Can we also have a double solution one in ofono for ofono aware platforms and the second as a plugin for others?

I am fine with starting this in BlueZ and see how far we get. And yes, plugin based is a must from my point of view. It is most likely similar to our different telephony drivers for Handsfree support.

We will move strongly in the direction of oFono being the main telephony stack. So I do care mostly that this work in conjunction with oFono. Everything else is just a nice benefit if it doesn't clutter the overhaul implementation and requires pointless abstraction everywhere.

Quoted 10 lines
Quoted 1 line

BTW, I already have this implemented and tested with real hardware (STEricsson). Bluez SAP works fine with Nokia 616 carkit :)

Can you share that code with us. And also hardware if you. We are still having hard time to find proper hardware to test this on.

Regards

Marcel

Do let me know if you had to make some changes in the SAP implementation for it to work.

It will be great if you can share the code in that case. I can update my implementation accordingly.

Regards
Suraj

#14 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 11 lines · Marcel Holtmann

Hi Suraj,

Quoted 8 lines

Please find the Git tree for the Sim access profile server role implementation I have been working on at

git://gitorious.org/sap-server/sap-server.git

Not sure it could be directly used with Bluez. Nevertheless, it has the parser implementation of Bluetooth SAP packet. Someone could possibly reuse it in their implementation.

Quoted 5 lines

have you actually tested this with real SAP server capable hardware? I am still not convinced at all to push APDU over D-Bus. First, there is potential security issue here and second the latency that D-Bus introduces seems not be acceptable. So what I am getting it, can this be actually used in a product that seriously wants to support SAP server?

No, This was tested with a dummy Agent and PTS. I am yet to get hold of a hardware.

The reason for sharing the source code was because any later SAP server implementation can re-use the SAP packet parser implementation I have already done.

I think we should be able to change the interface later depending on the actual hardware/system requirement. But, I believe the internal implementation could stay the same.

Quoted 6 lines

Regards

Marcel

Regards
Suraj