All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Ospite <ospite@studenti.unina.it>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	linux-bluetooth@vger.kernel.org,
	Bastien Nocera <hadess@hadess.net>,
	linux-input@vger.kernel.org, Jim Paris <jim@jtan.com>,
	Ranulf Doswell <ralf@ranulf.net>,
	"Pascal A . Brisset" <pascal44973@pabr.org>,
	Marcin Tolysz <tolysz@gmail.com>,
	Christian Birchinger <joker@netswarm.net>,
	Filipe Lopes <falktx@gmail.com>, Alan Ott <alan@signal11.us>,
	Mikko Virkkila <virkkila@kapsi.fi>,
	Simon Wood <simon@mungewell.org>, Arc Riley <arcriley@gmail.com>
Subject: Re: [PATCH BlueZ 3/4] Link to udev only when needed
Date: Fri, 26 Aug 2011 14:49:25 +0200	[thread overview]
Message-ID: <20110826144925.7a769734ad9eda41b1206357@studenti.unina.it> (raw)
In-Reply-To: <20110825170621.GB27645@samus.indt.org>

[-- Attachment #1: Type: text/plain, Size: 3602 bytes --]

On Thu, 25 Aug 2011 14:06:21 -0300
Vinicius Costa Gomes <vinicius.gomes@openbossa.org> wrote:

[...]
> > > diff --git a/Makefile.am b/Makefile.am
> > > index 4bcff4d..ff33bf0 100644
> > > --- a/Makefile.am
> > > +++ b/Makefile.am
> > > @@ -230,8 +230,10 @@ builtin_sources += thermometer/main.c \
> > >  endif
> > >  
> > >  if SIXAXISPLUGIN
> > > -builtin_modules += sixaxis
> > > -builtin_sources += plugins/sixaxis.c
> > > +plugin_LTLIBRARIES += plugins/sixaxis.la
> > > +plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
> > > +plugins_sixaxis_la_LDFLAGS = -module -avoid-version -no-undefined @UDEV_LIBS@
> > > +plugins_sixaxis_la_CFLAGS = -fvisibility=hidden @DBUS_CFLAGS@ @GLIB_CFLAGS@ @UDEV_CFLAGS@
> > >  endif
> > > 
> > 
> > This is not enough, the external plugin can be compiled but I can be used
> > at runtime because it is using functions from src/storage.c and others,
> > which seem to be embedded inside bluetoothd only, so I get:
> > 
> > bluetoothd[23459]: Can't load plugin \
> >   /home/ao2/Proj/PS3/PS3_sixaxis/bluez/plugins/.libs/playstation-peripheral.so: \
> >   /home/ao2/Proj/PS3/PS3_sixaxis/bluez/plugins/.libs/playstation-peripheral.so: \
> >   undefined symbol: write_device_name
> > 
> > I could link the needed object files like storage.o and company into the
> > plugin binary, but definitely this doesn't look OK. Should a shared library
> > provide those "utility" functions to bluetoothd _and_ external plugins?
> > 
> > This plugin is the first non-trivial external plugin I can see in the tree,
> > so maybe this problem has never showed up before.
> 
> The problem is the visibility of the symbols, src/bluetooth.ver defines
> which symbols should[1] be visible to plugins. Every plugin should only
> depend on those methods from the "core".
>

Indeed, adding the needed symbols to the linker script makes the plugin
work:

diff --git a/src/bluetooth.ver b/src/bluetooth.ver
index b71c70d..11fcd33 100644
--- a/src/bluetooth.ver
+++ b/src/bluetooth.ver
@@ -5,6 +5,19 @@
                info;
                error;
                debug;
+               manager_get_default_adapter;
+               adapter_get_address;
+               write_device_name;
+               record_from_string;
+               store_record;
+               sdp_record_free;
+               store_device_id;
+               write_trust;
+               dbus_bus_get;
+               adapter_get_device;
+               device_set_temporary;
+               device_set_name;
+               dbus_connection_unref;
        local:
                *;
 };


> If we want to keep the sixaxis plugin external we need to make the
> symbols it need visible, but I wonder if that is right solution.
>

If there was a public API for plugins to use with well defined prefixes,
the linking scripts could use those, I am thinking to something like:
	sdp_*;
	storage_*;
	device_*;
	dbus_*;

But you bluez people have to tell me if this is the way to go and if
you are willing to do that, of if I'd better have the plugin builtin for
now.

> [1] Seems that with builtin plugins that visibility enforcement doesn't
> work, right?
>

This seems to be the case indeed, a bluiltin plugin can use any (non
static?) symbol linked in the bluetoothd binary.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-08-26 12:49 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 14:09 [PATCH BlueZ 0/4] Sixaxis Plugin, almost there? Antonio Ospite
2011-08-05 14:09 ` Antonio Ospite
2011-08-05 14:09 ` [PATCH BlueZ 1/4] Remove input/sixpair.c Antonio Ospite
2011-08-05 14:09   ` Antonio Ospite
2011-08-05 14:09 ` [PATCH BlueZ 2/4] Add sixaxis plugin: USB pairing and LEDs settings Antonio Ospite
2011-08-05 14:09   ` Antonio Ospite
2011-08-10  2:24   ` Alan Ott
2011-08-10  2:24     ` Alan Ott
2011-08-18 14:13     ` Antonio Ospite
2011-08-18 14:13       ` Antonio Ospite
2011-08-18 14:22       ` [PATCH 0/4 incremental 1/2] Generalize controller handling to support different devices Antonio Ospite
2011-08-18 14:22         ` Antonio Ospite
2011-08-18 15:26         ` Alan Ott
2011-08-18 15:26           ` Alan Ott
2011-08-19 19:14           ` Antonio Ospite
2011-08-19 20:57             ` Antonio Ospite
2011-08-20 10:11               ` Antonio Ospite
2011-08-18 14:22       ` [PATCH 2/2] Match controllers using vendor_id and product_id instead of HID_NAME Antonio Ospite
2011-08-19 19:57       ` [PATCH BlueZ 2/4] Add sixaxis plugin: USB pairing and LEDs settings Antonio Ospite
2011-08-19 19:57         ` Antonio Ospite
2011-08-22 20:08         ` Antonio Ospite
2011-08-05 14:09 ` [PATCH BlueZ 3/4] Link to udev only when needed Antonio Ospite
2011-08-05 14:09   ` Antonio Ospite
2011-08-18 10:44   ` Antonio Ospite
2011-08-18 10:44     ` Antonio Ospite
2011-08-18 23:18     ` Marcel Holtmann
2011-08-19  8:58       ` Antonio Ospite
2011-08-19 19:08         ` Antonio Ospite
2011-08-19 19:08           ` Antonio Ospite
2011-08-25 14:14           ` Antonio Ospite
2011-08-25 14:14             ` Antonio Ospite
2011-08-25 17:06             ` Vinicius Costa Gomes
2011-08-25 17:06               ` Vinicius Costa Gomes
2011-08-26 12:49               ` Antonio Ospite [this message]
2011-08-05 14:09 ` [PATCH BlueZ 4/4] plugins/sixaxis: Wait for the PS button before setting the LEDs Antonio Ospite
2011-08-05 14:09   ` Antonio Ospite
2011-08-05 14:26 ` [PATCH BlueZ 0/4] Sixaxis Plugin, almost there? Anderson Lizardo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110826144925.7a769734ad9eda41b1206357@studenti.unina.it \
    --to=ospite@studenti.unina.it \
    --cc=alan@signal11.us \
    --cc=arcriley@gmail.com \
    --cc=falktx@gmail.com \
    --cc=hadess@hadess.net \
    --cc=jim@jtan.com \
    --cc=joker@netswarm.net \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pascal44973@pabr.org \
    --cc=ralf@ranulf.net \
    --cc=simon@mungewell.org \
    --cc=tolysz@gmail.com \
    --cc=vinicius.gomes@openbossa.org \
    --cc=virkkila@kapsi.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.