Add sixaxis cable-pairing plugin
PATCH 1/1 Add sixaxis cable-pairing plugin
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
Cheers
Quoted 1 line
From
f23a9556acf6308e217b11e0a882e89d799f2517Mon Sep 17 00:00:00 2001
From: Bastien Nocera <[email protected]>
Date: Thu, 4 Jun 2009 10:23:58 +0100
Subject: [PATCH] Add sixaxis cable-pairing plugin
Implement the old "sixpair" using gudev (a GObject layer on top of udev's monitoring system), and libusb-1.0.
When a Sixaxis device is plugged in, events are filtered, and the device is selected, poked around to set the default Bluetooth address, and added to the database of the current default adapter.
--- acinclude.m4 | 16 +++ configure.ac | 1 + plugins/Makefile.am | 11 ++- plugins/cable.c | 361 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 388 insertions(+), 1 deletions(-) create mode 100644 plugins/cable.c
acinclude.m4 +16 -0
@@ -159,6 +159,12 @@ AC_DEFUN([AC_PATH_USB], [ [Define to 1 if you need the usb_interrupt_read() function.])) ]) +AC_DEFUN([AC_PATH_CABLE], [ + PKG_CHECK_MODULES(CABLE, gudev-1.0 libusb-1.0, cable_found=yes, cable_found=no) + AC_SUBST(CABLE_CFLAGS) + AC_SUBST(CABLE_LIBS) +]) + AC_DEFUN([AC_PATH_NETLINK], [ PKG_CHECK_MODULES(NETLINK, libnl-1, netlink_found=yes, netlink_found=no) AC_SUBST(NETLINK_CFLAGS)
@@ -179,6 +185,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [ netlink_enable=no hal_enable=${hal_found} usb_enable=${usb_found} + cable_enable=${cable_found} alsa_enable=${alsa_found} gstreamer_enable=${gstreamer_found} audio_enable=yes
@@ -241,6 +248,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ usb_enable=${enableval} ]) + AC_ARG_ENABLE(cable, AC_HELP_STRING([--enable-cable], [enable DeviceKit support]), [ + cable_enable=${enableval} + ]) + AC_ARG_ENABLE(netlink, AC_HELP_STRING([--enable-netlink], [enable NETLINK support]), [ netlink_enable=${enableval} ])
@@ -324,6 +335,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have USB library.]) fi + if (test "${cable_enable}" = "yes" && test "${cable_found}" = "yes"); then + AC_DEFINE(HAVE_CABLE, 1, [Define to 1 if you have libcable.]) + fi + AC_SUBST([BLUEZ_CFLAGS], ['-I$(top_builddir)/include']) AC_SUBST([BLUEZ_LIBS], ['$(top_builddir)/lib/libbluetooth.la'])
@@ -357,4 +372,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [ AM_CONDITIONAL(CONFIGFILES, test "${configfiles_enable}" = "yes") AM_CONDITIONAL(INITSCRIPTS, test "${initscripts_enable}" = "yes") AM_CONDITIONAL(PCMCIARULES, test "${pcmciarules_enable}" = "yes") + AM_CONDITIONAL(CABLE, test "${cable_enable}" = "yes" && test "${cable_found}" = "yes") ])
configure.ac +1 -0
@@ -36,6 +36,7 @@ AC_PATH_GLIB AC_PATH_ALSA AC_PATH_GSTREAMER AC_PATH_USB +AC_PATH_CABLE AC_PATH_NETLINK AC_PATH_SNDFILE
plugins/Makefile.am +10 -1
@@ -26,10 +26,16 @@ builtin_sources += hal.c builtin_modules += storage builtin_sources += storage.c +if CABLE +plugin_LTLIBRARIES += cable.la +cable_la_LIBADD = @CABLE_CFLAGS@ +endif + noinst_LTLIBRARIES = libbuiltin.la echo.la libbuiltin_la_SOURCES = $(builtin_sources) libbuiltin_la_LDFLAGS = +libbuiltin_la_LIBADD = @CABLE_LIBS@ libbuiltin_la_CFLAGS = $(AM_CFLAGS) \ $(builtin_cflags) -DBLUETOOTH_PLUGIN_BUILTIN
@@ -40,7 +46,7 @@ nodist_libbuiltin_la_SOURCES = $(BUILT_SOURCES) AM_LDFLAGS = -module -avoid-version -no-undefined AM_CFLAGS = -fvisibility=hidden @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ \ - @GLIB_CFLAGS@ @GDBUS_CFLAGS@ @NETLINK_CFLAGS@ + @GLIB_CFLAGS@ @GDBUS_CFLAGS@ @NETLINK_CFLAGS@ @CABLE_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src
@@ -49,6 +55,7 @@ CLEANFILES = $(BUILT_SOURCES) MAINTAINERCLEANFILES = Makefile.in builtin.h: + echo $(builtin_modules) echo "" > $@ list='$(builtin_modules)'; for i in $$list; \ do echo "extern struct bluetooth_plugin_desc __bluetooth_builtin_$$i;" >> $@; done
@@ -63,9 +70,11 @@ all-local: @$(LN_S) -f $(top_srcdir)/audio/.libs/audio.so @$(LN_S) -f $(top_srcdir)/serial/.libs/serial.so @$(LN_S) -f $(top_srcdir)/network/.libs/network.so + @$(LN_S) -f $(top_srcdir)/plugins/.libs/cable.so clean-local: @rm -f network.so @rm -f serial.so @rm -f audio.so @rm -f input.so + @rm -f cable.so
plugins/cable.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Marcel Holtmann
maintainerHi Bastien,
Quoted 3 lines
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
no way. Please use just plain libudev and spare use the GObject overhead. I have used libudev before and it is just fine. Not that I have actually looked at your patch at all.
Regards
Marcel
Quoted 9 lines · Marcel Holtmann
Hi Bastien,
Quoted 3 lines
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
no way. Please use just plain libudev and spare use the GObject overhead. I have used libudev before and it is just fine. Not that I have actually looked at your patch at all.
GObject overhead? Did you intend on building sixaxis support into a 5 year old phone that it would actually matter?
Anyway, that'll go way down my list of things to do, along with porting the rest of the apps to libusb1, which I guess will be a problem as well.
gudev lives in udev-extras, and udev-extras will most likely be merged into udev itself. And it saves me from reinventing the wheel, and doing my own mainloop integration (etc.).
Marcel Holtmann
maintainerHi Bastien,
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
no way. Please use just plain libudev and spare use the GObject overhead. I have used libudev before and it is just fine. Not that I have actually looked at your patch at all.
GObject overhead? Did you intend on building sixaxis support into a 5 year old phone that it would actually matter?
as I said, I am not adding a dependency on a GObject based library to it. We wanna be able to replace GLib with eglib or similar if we have to. Doing this for GObject based libraries is a pain in the ass. It is just bloat.
Quoted 3 lines
Anyway, that'll go way down my list of things to do, along with porting the rest of the apps to libusb1, which I guess will be a problem as well.
My biggest problem with libusb1 is that not all distros have it right now. However that might change in 2 or 3 month. So it should become easier.
Quoted 3 lines
gudev lives in udev-extras, and udev-extras will most likely be merged into udev itself. And it saves me from reinventing the wheel, and doing my own mainloop integration (etc.).
The whole point of udev and udev-extras is to keep the dependency chain small. So I don't think it gets merged.
The GLib mainloop integration for libudev is really simple. So that is not an excuse for being lazy and dragging GObject into the mix.
Regards
Marcel
Quoted 10 lines · Marcel Holtmann
Hi Bastien,
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
no way. Please use just plain libudev and spare use the GObject overhead. I have used libudev before and it is just fine. Not that I have actually looked at your patch at all.
Quoted 7 lines
Quoted 2 lines
GObject overhead? Did you intend on building sixaxis support into a 5 year old phone that it would actually matter?
as I said, I am not adding a dependency on a GObject based library to it. We wanna be able to replace GLib with eglib or similar if we have to. Doing this for GObject based libraries is a pain in the ass. It is just bloat.
Which is exactly why the cable pairing stuff is implemented as a plugin. You don't have to care about what's in it, or what its dependencies are if you don't ship the plugin.
Quoted 7 lines
Quoted 3 lines
Anyway, that'll go way down my list of things to do, along with porting the rest of the apps to libusb1, which I guess will be a problem as well.
My biggest problem with libusb1 is that not all distros have it right now. However that might change in 2 or 3 month. So it should become easier.
That's not what the mail archives or IRC will tell me. Your problem was that this would make bluez depend on 2 different libusb versions, which you didn't want. That hasn't changed.
Quoted 9 lines
Quoted 3 lines
gudev lives in udev-extras, and udev-extras will most likely be merged into udev itself. And it saves me from reinventing the wheel, and doing my own mainloop integration (etc.).
The whole point of udev and udev-extras is to keep the dependency chain small. So I don't think it gets merged.
The GLib mainloop integration for libudev is really simple. So that is not an excuse for being lazy and dragging GObject into the mix.
You can keep personal attacks out of that. I think I've shown enough patience trying to get this functionality into bluez proper.
I won't be updating this patch, but Luiz showed interested. My patch will show up in the Fedora packages shortly.
Cheers
Marcel Holtmann
maintainerHi Bastien,
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Works for me, comments welcome.
It uses gudev. See http://blog.fubar.dk/?p=106
no way. Please use just plain libudev and spare use the GObject overhead. I have used libudev before and it is just fine. Not that I have actually looked at your patch at all.
GObject overhead? Did you intend on building sixaxis support into a 5 year old phone that it would actually matter?
Quoted 8 lines
Quoted 4 lines
as I said, I am not adding a dependency on a GObject based library to it. We wanna be able to replace GLib with eglib or similar if we have to. Doing this for GObject based libraries is a pain in the ass. It is just bloat.
Which is exactly why the cable pairing stuff is implemented as a plugin. You don't have to care about what's in it, or what its dependencies are if you don't ship the plugin.
then make it an external plugin in its own repository, but I am not merging code that depends on anything GObject if it is just pointless dependency and bloat.
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
Anyway, that'll go way down my list of things to do, along with porting the rest of the apps to libusb1, which I guess will be a problem as well.
My biggest problem with libusb1 is that not all distros have it right now. However that might change in 2 or 3 month. So it should become easier.
That's not what the mail archives or IRC will tell me. Your problem was that this would make bluez depend on 2 different libusb versions, which you didn't want. That hasn't changed.
My answer might be misleading here. My view on this one hasn't changed. I want either libusb0 or libusb1. However libusb1 becomes only an option when all major distros did a refresh and have it available. So meaning BlueZ will be ported over to libusb1 completely at some point. The point is closer now than 6 month ago.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
gudev lives in udev-extras, and udev-extras will most likely be merged into udev itself. And it saves me from reinventing the wheel, and doing my own mainloop integration (etc.).
Quoted 8 lines
Quoted 5 lines
The whole point of udev and udev-extras is to keep the dependency chain small. So I don't think it gets merged.
The GLib mainloop integration for libudev is really simple. So that is not an excuse for being lazy and dragging GObject into the mix.
You can keep personal attacks out of that. I think I've shown enough patience trying to get this functionality into bluez proper.
This is not personal. I am keeping a watch on the dependencies of BlueZ and I don't see any need for adding GObject to the mix for the SixAxis support. Feel free to convince me that GObject based gudev is really necessary for this. Until then I declare this bloat.
Please remember that BlueZ will run on embedded devices with limited memory and space requirements. You might argue that these devices don't need SixAxis support, but I prefer to keep that option.
Quoted 2 lines
I won't be updating this patch, but Luiz showed interested. My patch will show up in the Fedora packages shortly.
That is your choice. Personally I really dislike if distros just go against upstream and start merging stuff, because it takes more effort to get it into upstream first.
On that point, you haven't merged the Socket fix upstream and also the Wacom and UTF-8 fix could be send upstream. I know you send some version of these at least once or twice, but besides me also Johan could merge these patches.
Regards
Marcel
Quoted 9 lines · Marcel Holtmann
Quoted 3 lines
You can keep personal attacks out of that. I think I've shown enough patience trying to get this functionality into bluez proper.
This is not personal. I am keeping a watch on the dependencies of BlueZ
and I don't see any need for adding GObject to the mix for the SixAxis support. Feel free to convince me that GObject based gudev is really necessary for this. Until then I declare this bloat.
No, it's not absolutely necessary, but somebody has to reinvent the wheel, and I'm not happy spending time doing that.
Quoted 4 lines
Please remember that BlueZ will run on embedded devices with limited memory and space requirements. You might argue that these devices don't
need SixAxis support, but I prefer to keep that option.
Yes. And if such uses exist, I'm sure they'd be happy putting some effort into bluez and do the port from gudev to libudev themselves.
Quoted 6 lines
Quoted 2 lines
I won't be updating this patch, but Luiz showed interested. My patch will show up in the Fedora packages shortly.
That is your choice. Personally I really dislike if distros just go against upstream and start merging stuff, because it takes more effort to get it into upstream first.
All my patches are sent upstream before they go into the packages, and I think I put quite a bit of work into this. But at the end of the day, I only have so much time, and rewriting bits of code because the upstream doesn't like GObject isn't what I call a good use of my time. So I'm leaving it to somebody else to go the last mile because I can't be bothered.
Quoted 1 line
On that point, you haven't merged the Socket fix upstream
It's not upstreamable, see the RH bugzilla. It depends on a kernel patch that can't go upstream.
Quoted 2 lines
and also the
Wacom and UTF-8 fix could be send upstream.
They already have, and you commented on them. I still believe the UTF-8 one could be merged as-is, but I don't have a good answer for the Wacom one, which would need more investigation.
Quoted 3 lines
I know you send some version
of these at least once or twice, but besides me also Johan could merge these patches.
Cheers
Marcel Holtmann
maintainerHi Bastien,
Quoted 27 lines
Quoted 8 lines
Quoted 2 lines
You can keep personal attacks out of that. I think I've shown enough patience trying to get this functionality into bluez proper.
This is not personal. I am keeping a watch on the dependencies of BlueZ
and I don't see any need for adding GObject to the mix for the SixAxis support. Feel free to convince me that GObject based gudev is really necessary for this. Until then I declare this bloat.No, it's not absolutely necessary, but somebody has to reinvent the wheel, and I'm not happy spending time doing that.
Quoted 4 lines
Please remember that BlueZ will run on embedded devices with limited memory and space requirements. You might argue that these devices don't
need SixAxis support, but I prefer to keep that option.Yes. And if such uses exist, I'm sure they'd be happy putting some effort into bluez and do the port from gudev to libudev themselves.
Quoted 6 lines
Quoted 2 lines
I won't be updating this patch, but Luiz showed interested. My patch will show up in the Fedora packages shortly.
That is your choice. Personally I really dislike if distros just go against upstream and start merging stuff, because it takes more effort to get it into upstream first.
Quoted 6 lines
All my patches are sent upstream before they go into the packages, and I think I put quite a bit of work into this. But at the end of the day, I only have so much time, and rewriting bits of code because the upstream doesn't like GObject isn't what I call a good use of my time. So I'm leaving it to somebody else to go the last mile because I can't be bothered.
fair enough and if Luiz takes care of this I am more than happy either way.
Quoted 4 lines
Quoted 1 line
On that point, you haven't merged the Socket fix upstream
It's not upstreamable, see the RH bugzilla. It depends on a kernel patch that can't go upstream.
Which bug is it. What is missing and why haven't I seen that kernel patch at least send to the mailing list for review.
Quoted 6 lines
Quoted 2 lines
and also the
Wacom and UTF-8 fix could be send upstream.They already have, and you commented on them. I still believe the UTF-8 one could be merged as-is, but I don't have a good answer for the Wacom one, which would need more investigation.
The UTF-8 might go in as is. As I said, Johan could review these and merge them as good as I can. So feel free to bug him about it.
Regards
Marcel
Quoted 8 lines · Marcel Holtmann
Quoted 4 lines
Quoted 2 lines
On that point, you haven't merged the Socket fix upstream
It's not upstreamable, see the RH bugzilla. It depends on a kernel
patch
Quoted 1 line
that can't go upstream.
Which bug is it.
It's listed in the spec file, in the same directory you found that patch:
https://bugzilla.redhat.com/show_bug.cgi?id=498756
Quoted 2 lines
What is missing and why haven't I seen that kernel
patch at least send to the mailing list for review.
It's a patch to serial core, not Bluetooth, and there's a 3-year old discussion on LKML, amongst other things.
Luiz Augusto von Dentz
maintainerHi,
First I would like to know if splitting the current code of gudev into udev-glib and udev-gobject would be a good idea to begin with. By looking at connmand code it seems quite simple to integrate glib mainloop with udev so if we were not adding any API to udev-glib it seems like an unnecessary step, I heard that udev has some race conditions so perhaps we could add some very basic watch registration like we have done to libgdus. That way udev-object API doesn't have to change much just depend on udev-glib.
On bluetoothd side, I would like to make udev code generic enough to detect any bluetooth device not only sixaxis so we can do different plugins to handle any device doing this cable association/cable pairing thing.
--=20
Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o
Marcel Holtmann
maintainerHi Luiz,
Quoted 9 lines
First I would like to know if splitting the current code of gudev into udev-glib and udev-gobject would be a good idea to begin with. By looking at connmand code it seems quite simple to integrate glib mainloop with udev so if we were not adding any API to udev-glib it seems like an unnecessary step, I heard that udev has some race conditions so perhaps we could add some very basic watch registration like we have done to libgdus. That way udev-object API doesn't have to change much just depend on udev-glib.
Quoted 4 lines
On bluetoothd side, I would like to make udev code generic enough to detect any bluetooth device not only sixaxis so we can do different plugins to handle any device doing this cable association/cable pairing thing.
don't bother with udev-glib here. The native libudev integration with mainloop is simple enough. If you need an example, look at ConnMan.
Regards
Marcel