From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Griffin Subject: Re: [PATCH] gnu: services: Add bluetooth-service. Date: Wed, 15 Jun 2016 22:49:35 -0500 Message-ID: <1466048975.4098042.639189041.452264CA@webmail.messagingengine.com> References: <1466004208-4251-1-git-send-email-iyzsong@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDOJV-0006ih-Aw for guix-devel@gnu.org; Wed, 15 Jun 2016 23:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDOJR-0006Gy-4P for guix-devel@gnu.org; Wed, 15 Jun 2016 23:49:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDOJO-0006GF-LP for guix-devel@gnu.org; Wed, 15 Jun 2016 23:49:49 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 001EC20726 for ; Wed, 15 Jun 2016 23:49:35 -0400 (EDT) In-Reply-To: <1466004208-4251-1-git-send-email-iyzsong@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Thanks for writing this, I've been wanting bluetooth support for a while! I added this to my system services and added my user to the "lp" group, but I still ran into a few issues. GNOME still didn't recognize my bluetooth adaptor, so I tried using bluetoothctl from the command line. Several actions completed successfully but I still couldn't use my bluetooth mouse. Here's what I tried (I omitted all output except the error): $ bluetoothctl [bluetooth]# scan on [bluetooth]# pair [bluetooth]# trust [bluetooth]# connect Failed to connect: org.bluez.Error.Failed I also couldn't find any bluez files in /var. Is it possible that it's failing because it can't save its state? I can look into it more this weekend if you can't reproduce any issues. --=20 Alex Griffin On Wed, Jun 15, 2016, at 10:23 AM, =E5=AE=8B=E6=96=87=E6=AD=A6 wrote: > * gnu/services/desktop.scm (bluetooth-shepherd-service) > (bluetooth-service): New Prodecures. > (bluetooth-service-type): New variable. > * doc/guix.text (Desktop Services): Document it. > --- > doc/guix.texi | 7 +++++++ > gnu/services/desktop.scm | 34 ++++++++++++++++++++++++++++++++++ > 2 files changed, 41 insertions(+) >=20 > diff --git a/doc/guix.texi b/doc/guix.texi > index e163f36..a6fd89a 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -7982,6 +7982,13 @@ location databases. See > web site} for more information. > @end deffn >=20=20 > +@deffn {Scheme Procedure} bluetooth-service [#:bluez @var{bluez}] > +Return a service that runs the @command{bluetoothd} daemon, which > manages > +all the Bluetooth devices and provides a number of D-Bus interfaces. > + > +Users need to be in the @code{lp} group to access the D-Bus service. > +@end deffn > + > @node Database Services > @subsubsection Database Services >=20=20 > diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm > index f427d35..80ac0ac 100644 > --- a/gnu/services/desktop.scm > +++ b/gnu/services/desktop.scm > @@ -2,6 +2,7 @@ > ;;; Copyright =C2=A9 2014, 2015, 2016 Ludovic Court=C3=A8s > ;;; Copyright =C2=A9 2015 Andy Wingo > ;;; Copyright =C2=A9 2015 Mark H Weaver > +;;; Copyright =C2=A9 2016 Sou Bunnbu > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -37,6 +38,7 @@ > #:use-module (gnu packages polkit) > #:use-module (gnu packages xdisorg) > #:use-module (gnu packages suckless) > + #:use-module (gnu packages linux) > #:use-module (guix records) > #:use-module (guix packages) > #:use-module (guix store) > @@ -49,6 +51,7 @@ > geoclue-application > %standard-geoclue-applications > geoclue-service > + bluetooth-service > polkit-service > elogind-configuration > elogind-service > @@ -346,6 +349,37 @@ site} for more information." >=20=20 > =0C > ;;; > +;;; Bluetooth. > +;;; > + > +(define (bluetooth-shepherd-service bluez) > + "Return a shepherd service for @command{bluetoothd}." > + (shepherd-service > + (provision '(bluetooth)) > + (requirement '(dbus-system udev)) > + (documentation "Run the bluetoothd daemon.") > + (start #~(make-forkexec-constructor > + (string-append #$bluez "/libexec/bluetooth/bluetoothd"))) > + (stop #~(make-kill-destructor)))) > + > +(define bluetooth-service-type > + (service-type > + (name 'bluetooth) > + (extensions > + (list (service-extension dbus-root-service-type list) > + (service-extension shepherd-root-service-type > + (compose list > bluetooth-shepherd-service)))))) > + > +(define* (bluetooth-service #:key (bluez bluez)) > + "Return a service that runs the @command{bluetoothd} daemon, which > manages > +all the Bluetooth devices and provides a number of D-Bus interfaces. > + > +Users need to be in the @code{lp} group to access the D-Bus service. > +" > + (service bluetooth-service-type bluez)) > + > +=0C > +;;; > ;;; Polkit privilege management service. > ;;; >=20=20 > --=20 > 2.6.3 >=20 >=20