MCAP implementation for BlueZ
Subsystems (2)
PATCH 1/1 MCAP implementation for BlueZ
This patch enables MCAP in BlueZ.
Current implementation provides support for standard op. codes. Clock Synchronization protocol is not yet supported.
--- Makefile.am | 11 +- acinclude.m4 | 6 + mcap/mcap.c | 2146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ mcap/mcap.h | 176 +++++ mcap/mcap_lib.h | 162 +++++ 5 files changed, 2500 insertions(+), 1 deletions(-) create mode 100644 mcap/mcap.c create mode 100644 mcap/mcap.h create mode 100644 mcap/mcap_lib.h
Makefile.am +10 -1
@@ -101,6 +101,7 @@ gdbus_sources = gdbus/gdbus.h gdbus/mainloop.c gdbus/object.c gdbus/watch.c builtin_modules = builtin_sources = builtin_nodist = +mcap_sources = if PNATPLUGIN builtin_modules += pnat
@@ -168,6 +169,10 @@ builtin_modules += service builtin_sources += plugins/service.c endif +if MCAP +mcap_sources += mcap/mcap_lib.h mcap/mcap.h mcap/mcap.c +endif + builtin_modules += hciops builtin_sources += plugins/hciops.c
@@ -196,7 +201,8 @@ src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \ src/adapter.h src/adapter.c \ src/device.h src/device.c \ src/dbus-common.c src/dbus-common.h \ - src/dbus-hci.h src/dbus-hci.c + src/dbus-hci.h src/dbus-hci.c \ + $(mcap_sources) src_bluetoothd_LDADD = lib/libbluetooth.la @GLIB_LIBS@ @DBUS_LIBS@ \ @CAPNG_LIBS@ -ldl src_bluetoothd_LDFLAGS = -Wl,--export-dynamic \
@@ -318,6 +324,9 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ \ INCLUDES = -I$(builddir)/lib -I$(builddir)/src -I$(srcdir)/src \ -I$(srcdir)/audio -I$(srcdir)/sbc -I$(srcdir)/gdbus +if MCAP +INCLUDES += -I$(builddir)/mcap +endif pkgconfigdir = $(libdir)/pkgconfig
acinclude.m4 +6 -0
@@ -167,6 +167,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [ serial_enable=yes network_enable=yes service_enable=yes + mcap_enable=no pnat_enable=no tracer_enable=no tools_enable=yes
@@ -215,6 +216,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ service_enable=${enableval} ]) + AC_ARG_ENABLE(mcap, AC_HELP_STRING([--enable-mcap], [enable mcap support]), [ + mcap_enable=${enableval} + ]) + AC_ARG_ENABLE(pnat, AC_HELP_STRING([--enable-pnat], [enable pnat plugin]), [ pnat_enable=${enableval} ])
@@ -325,6 +330,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AM_CONDITIONAL(SERIALPLUGIN, test "${serial_enable}" = "yes") AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes") AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes") + AM_CONDITIONAL(MCAP, test "${mcap_enable}" = "yes") AM_CONDITIONAL(ECHOPLUGIN, test "no" = "yes") AM_CONDITIONAL(PNATPLUGIN, test "${pnat_enable}" = "yes") AM_CONDITIONAL(TRACER, test "${tracer_enable}" = "yes")
mcap/mcap.c new file +2146 -0
2,146 lines not on this page · raw message
mcap/mcap.h new file +176 -0
176 lines not on this page · raw message
mcap/mcap_lib.h new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Hi Santiago,
Quoted 13 lines · Santiago Carot-Nemesio
This patch enables MCAP in BlueZ.
Current implementation provides support for standard op. codes. Clock Synchronization protocol is not yet supported.--- Makefile.am | 11 +- acinclude.m4 | 6 + mcap/mcap.c | 2146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ mcap/mcap.h | 176 +++++ mcap/mcap_lib.h | 162 +++++ 5 files changed, 2500 insertions(+), 1 deletions(-) create mode 100644 mcap/mcap.c create mode 100644 mcap/mcap.h create mode 100644 mcap/mcap_lib.h
2500+ lines is too big for review. MCAP is way complicated to understand completely. I suggest you to split this patch and send smaller ones for each feature of MCAP you implement, then we can review each piece and not at once.
Also a MCAP test tool would be interesting to help on the review/merge/qualification process. Do you guys have one? Or are you planning to do one?
Signature · 2 lines
Gustavo F. Padovan http://padovan.org
Hi,
Quoted 18 lines · Gustavo F. Padovan
Hi Santiago,
Quoted 13 lines · Santiago Carot-Nemesio
This patch enables MCAP in BlueZ.
Current implementation provides support for standard op. codes. Clock Synchronization protocol is not yet supported.--- Makefile.am | 11 +- acinclude.m4 | 6 + mcap/mcap.c | 2146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ mcap/mcap.h | 176 +++++ mcap/mcap_lib.h | 162 +++++ 5 files changed, 2500 insertions(+), 1 deletions(-) create mode 100644 mcap/mcap.c create mode 100644 mcap/mcap.h create mode 100644 mcap/mcap_lib.h
Quoted 4 lines
2500+ lines is too big for review. MCAP is way complicated to understand completely. I suggest you to split this patch and send smaller ones for each feature of MCAP you implement, then we can review each piece and not at once.
You are rigth, I know it, but please, remember that it is a new specification implemented from scratch, there were not any similar profile in BlueZ wich i could take as reference point. I have done a lot of changes in the architecture, interfaces, etc. until I found what IMHO is a presentable implementation.
Sending patches with a non definitive implementation could have full of noise the mailing list, I think that its better to have a base implementation to discuss about.
I'm thinking that it may be interesting put my git in public to everybody can see all development process, commit-by-commit. I have not problem in doing that.
Quoted 4 lines
Also a MCAP test tool would be interesting to help on the review/merge/qualification process. Do you guys have one? Or are you planning to do one?
We have some home-made tools and scripts for testing MCAP, if you are interested i'll put them in plubic git too.
Thanks in advance for your feedback.
Best regards.
Quoted 3 lines
We have some home-made tools and scripts for testing MCAP, if you are interested i'll put them in plubic git too.
Yes, this is important, because we are about to write some MCAP tools too, and would be nice not to do the same thing again :)
Hi,
Quoted 5 lines · Elvis Pfützenreuter
Quoted 3 lines
We have some home-made tools and scripts for testing MCAP, if you are interested i'll put them in plubic git too.
Yes, this is important, because we are about to write some MCAP tools too, and would be nice not to do the same thing again :)--
We have already set up a public git with all code that we have generated until now. MCAP and tools are included too. There you can find a beta implementation of HDP, but please don't consider it as definitive implementation, it's simply for testing purpose.
We expect that thanks to this git we can work together in development task. If you are interested in having an account, please contact with us ;)
As we suggested yesterday in IRC, at current moment we believe that fix HDP API and testing MCAP are the more priority task wich we have to focus our current effort.
There is the git url:git://193.147.51.48/git/mcap.git
Please, feel free to get the code and submit bugs and patches.
There you can see next branches:
mcap: This branch has the latest code for MCAP.
mcap_dbus: Here you can find an stupid dbus interface to play with MCAP, note that MCAP code in this branch is older than mcap branch, it may be interested update it if you want play with last MCAP code.
If you have some questions, please, you don't hesitate in contact with us.
Best regards.
PATCH 1/1 MCAP: Added default abort callback
In reply to Santiago Carot-NemesioAlso check if mcl was closed during a callback
--- mcap/mcap.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-)
mcap/mcap.c +12 -7
@@ -183,6 +183,10 @@ static void default_mdl_deleted_cb(struct mcap_mdl *mdl, gpointer data) {debug ("MCAP Unmanaged mdl deleted" ); } +static void default_mdl_aborted_cb (struct mcap_mdl *mdl,gpointer data) +{ +debug ("MCAP Unmanaged mdl aborted" ); +}static uint8_t default_mdl_conn_req_cb (struct mcap_mcl *mcl,uint8_t mdepid,uint16_t mdlid,uint8_t *conf,gpointer data)
@@ -207,6 +211,7 @@ static void set_default_cb(struct mcap_mcl *mcl) mcl->cb->mdl_connected = default_mdl_connected_cb; mcl->cb->mdl_closed = default_mdl_closed_cb; mcl->cb->mdl_deleted = default_mdl_deleted_cb; + mcl->cb->mdl_aborted = default_mdl_aborted_cb; mcl->cb->mdl_conn_req = default_mdl_conn_req_cb; mcl->cb->mdl_reconn_req = default_mdl_reconn_req_cb; }
@@ -1045,11 +1050,13 @@ static void process_md_create_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd, uint32/* Callback to upper layer */ rsp = mcl->cb->mdl_conn_req (mcl, mdep_id, mdl_id, &conf, mcl->cb->user_data); +if (mcl->state ==MCL_IDLE ) +return ;if ((cfga !=0 ) && (cfga != conf)) {/* Remote device set default configuration but upper profile */ /* has changed it. Protocol Error: force closing the MCL by */ -/* using remote device using UNESPECIFIED_ERROR response */ +/* remote device using UNESPECIFIED_ERROR response */ send4B_cmd (mcl,MCAP_MD_CREATE_MDL_RSP ,MCAP_UNESPECIFIED_ERROR , mdl_id);return ;
@@ -1102,6 +1109,9 @@ static void process_md_reconnect_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,/* Callback to upper layer */ rsp = mcl->cb->mdl_reconn_req (mdl, mcl->cb->user_data); +if (mcl->state ==MCL_IDLE ) +return ; +if (rsp !=MCAP_SUCCESS ) {send4B_cmd (mcl,MCAP_MD_CREATE_MDL_RSP , rsp, mdl_id);return ;
@@ -1734,12 +1744,7 @@ static gboolean mcl_control_cb(GIOChannel *chan, GIOCondition cond, gpointer datint sk, len;uint8_t buf[MCAP_CC_MTU ]; -if (cond &G_IO_NVAL ) { -error ("Revise G_IO_NVAL" ); - goto fail; - } - -if (cond & (G_IO_ERR |G_IO_HUP )) +if (cond & (G_IO_ERR |G_IO_HUP |G_IO_NVAL )) goto fail; sk =g_io_channel_unix_get_fd (chan);
Signature · 1 line
1.7.0.4