* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
@ 2021-12-13 19:20 Demis Balbach
2021-12-13 19:36 ` Demis Balbach
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-13 19:20 UTC (permalink / raw)
To: 52470; +Cc: Demis Balbach
---
gnu/services/desktop.scm | 332 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 328 insertions(+), 4 deletions(-)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 64d0e85301..23b730d7d4 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -402,14 +402,338 @@ (define-record-type* <bluetooth-configuration>
bluetooth-configuration make-bluetooth-configuration
bluetooth-configuration?
(bluez bluetooth-configuration-bluez (default bluez))
- (auto-enable? bluetooth-configuration-auto-enable? (default #f)))
+
+ ;;; [General]
+ (name bluetooth-configuration-name (default "BlueZ"))
+ (class bluetooth-configuration-class (default "0x000000"))
+ (discoverable-timeout
+ bluetooth-configuration-discoverable-timeout (default 180))
+ (always-pairable? bluetooth-configuration-always-pairable? (default #f))
+ (pairable-timeout bluetooth-configuration-pairable-timeout (default 0))
+ (device-id bluetooth-configuration-device-id (default ""))
+ (reverse-service-discovery?
+ bluetooth-configuration-reverse-service-discovery (default #t))
+ (name-resolving? bluetooth-configuration-name-resolving? (default #t))
+ (debug-keys? bluetooth-configuration-debug-keys? (default #f))
+
+ ;;; Possible values:
+ ;;; 'dual, 'bredr, 'le
+ (controller-mode bluetooth-configuration-controller-mode (default 'dual))
+
+ ;;; Possible values:
+ ;;; 'off, 'single, 'multiple
+ (multi-profile bluetooth-configuration-multi-profile (default 'off))
+ (fast-connectable? bluetooth-configuration-fast-connectable? (default #f))
+
+ ;;; Possible values:
+ ;;; for LE mode: 'off, 'network/on, 'device
+ ;;; for Dual mode: 'off, 'network/on', 'device, 'limited-network, 'limited-device
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n68
+ (privacy bluetooth-configuration-privacy (default 'off))
+
+ ;;; Possible values:
+ ;;; 'never, 'confirm, 'always
+ (just-works-repairing
+ bluetooth-configuration-just-works-repairing (default 'never))
+ (temporary-timeout bluetooth-configuration-temporary-timeout (default 30))
+ (refresh-discovery? bluetooth-configuration-refresh-discovery (default #t))
+
+ ;;; Possible values: 'true, 'false, <UUID>
+ ;;; Possible UUIDs:
+ ;;; d4992530-b9ec-469f-ab01-6c481c47da1c (BlueZ Experimental Debug)
+ ;;; 671b10b5-42c0-4696-9227-eb28d1b049d6 (BlueZ Experimental Simultaneous Central and Peripheral)
+ ;;; 15c0a148-c273-11ea-b3de-0242ac130004 (BlueZ Experimental LL privacy)
+ ;;; 330859bc-7506-492d-9370-9a6f0614037f (BlueZ Experimental Bluetooth Quality Report)
+ ;;; a6695ace-ee7f-4fb9-881a-5fac66c629af (BlueZ Experimental Offload Codecs)
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n110
+ (experimental bluetooth-configuration-experimental (default 'false))
+ (remote-name-request-retry-delay
+ bluetooth-configuration-remote-name-request-retry-delay (default 300))
+
+ ;;; [BR]
+ (page-scan-type bluetooth-configuration-page-scan-type (default -1))
+ (page-scan-interval bluetooth-configuration-page-scan-interval (default -1))
+ (page-scan-window bluetooth-configuration-page-scan-window (default 'nil))
+ (inquiry-scan-type bluetooth-configuration-inquiry-scan-type (default 'nil))
+ (inquiry-scan-interval bluetooth-configuration-inquiry-scan-interval (default -1))
+ (inquiry-scan-window bluetooth-configuration-inquiry-scan-window (default 'nil))
+ (link-supervision-timeout bluetooth-configuration-link-supervision-timeout (default -1))
+ (page-timeout bluetooth-configuration-page-timeout (default -1))
+ (min-sniff-interval bluetooth-configuration-min-sniff-interval (default -1))
+ (max-sniff-interval bluetooth-configuration-max-sniff-interval (default -1))
+
+ ;;; [LE]
+ (min-advertisement-interval
+ bluetooth-configuration-min-advertisement-interval (default -1))
+ (max-advertisement-interval
+ bluetooth-configuration-max-advertisement-interval (default -1))
+ (multi-advertisement-rotation-interval
+ bluetooth-configuration-multi-advertisement-rotation-interval (default -1))
+ (scan-interval-auto-connect
+ bluetooth-configuration-scan-interval-auto-connect (default 'nil))
+ (scan-window-auto-connect
+ bluetooth-configuration-scan-window-auto-connect (default 'nil))
+ (scan-interval-suspend
+ bluetooth-configuration-scan-interval-suspend (default 'nil))
+ (scan-window-suspend
+ bluetooth-configuration-scan-window-suspend (default 'nil))
+ (scan-interval-discovery
+ bluetooth-configuration-scan-interval-discovery (default 'nil))
+ (scan-window-discovery
+ bluetooth-configuration-scan-window-discovery (default 'nil))
+ (scan-interval-adv-monitor
+ bluetooth-configuration-scan-interval-adv-monitor (default 'nil))
+ (scan-window-adv-monitor
+ bluetooth-configuration-scan-window-adv-monitor (default 'nil))
+ (scan-interval-connect
+ bluetooth-configuration-scan-interval-connect (default 'nil))
+ (scan-window-connect
+ bluetooth-configuration-scan-window-connect (default 'nil))
+ (min-connection-interval
+ bluetooth-configuration-min-connection-interval (default -1))
+ (max-connection-interval
+ bluetooth-configuration-max-connection-interval (default -1))
+ (connection-latency
+ bluetooth-configuration-connection-latency (default -1))
+ (connection-supervision-timeout
+ bluetooth-configuration-connection-supervision-timeout (default -1))
+ (autoconnect-timeout
+ bluetooth-configuration-autoconnect-timeout (default -1))
+ (adv-mon-allowlist-scan-duration
+ bluetooth-configuration-adv-mon-allowlist-scan-duration (default 300))
+ (adv-mon-no-filter-scan-duration
+ bluetooth-configuration-adv-mon-no-filter-scan-duration (default 500))
+ (enable-adv-mon-interleave-scan
+ bluetooth-configuration-enable-adv-mon-interleave-scan (default 1))
+
+ ;;; [GATT]
+ ;;; Possible values: 'yes, 'no, 'always
+ (cache bluetooth-configuration-cache (default 'always))
+
+ ;;; Possible values: 7 ... 16, 0 (don't care)
+ (key-size bluetooth-configuration-key-size (default 0))
+
+ ;;; Possible values: 23 ... 517
+ (exchange-mtu bluetooth-configuration-exchange-mtu (default 517))
+
+ ;;; Possible values: 1 ... 5
+ (att-channels bluetooth-configuration-att-channels (default 3))
+
+ ;;; [AVDTP]
+ ;;; Possible values: 'basic, 'ertm
+ (session-mode bluetooth-configuration-session-mode (default 'basic))
+
+ ;;; Possible values: 'basic, 'streaming
+ (stream-mode bluetooth-configuration-stream-mode (default 'basic))
+
+ ;;; [Policy]
+ (reconnect-uuids bluetooth-configuration-reconnect-uuids (default '()))
+ (reconnect-attempts bluetooth-configuration-reconnect-attempts (default 7))
+ (reconnect-intervals bluetooth-configuration-reconnect-intervals
+ (default (list 1 2 4 8 16 32 64)))
+ (auto-enable? bluetooth-configuration-auto-enable? (default #f))
+ (resume-delay bluetooth-configuration-resume-delay (default 2))
+
+ ;;; [AdvMon]
+ ;;; Possible values:
+ ;;; "0x00", "0xFF",
+ ;;; "N = 0x00" ... "N = 0xFF"
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n286
+ (rssi-sampling-period bluetooth-configuration-rssi-sampling-period
+ (default "0xFF")))
(define (bluetooth-configuration-file config)
"Return a configuration file for the systemd bluetooth service, as a string."
(string-append
- "[Policy]\n"
- "AutoEnable=" (bool (bluetooth-configuration-auto-enable?
- config))))
+ "[General]"
+ "\nName = " (bluetooth-configuration-name config)
+ "\nClass = " (bluetooth-configuration-class config)
+ "\nDiscoverableTimeout = " (number->string
+ (bluetooth-configuration-discoverable-timeout
+ config))
+ "\nAlwaysPairable = " (bool (bluetooth-configuration-always-pairable?
+ config))
+ "\nPairableTimeout = " (number->string
+ (bluetooth-configuration-pairable-timeout
+ config))
+ (if (not (string-null? (bluetooth-configuration-device-id config)))
+ (string-append "\nDeviceID = " (bluetooth-configuration-device-id config))
+ "")
+ "\nReverseServiceDiscovery = " (bool
+ (bluetooth-configuration-reverse-service-discovery
+ config))
+ "\nNameResolving = " (bool (bluetooth-configuration-name-resolving? config))
+ "\nDebugKeys = " (bool (bluetooth-configuration-debug-keys? config))
+ "\nControllerMode = " (symbol->string
+ (bluetooth-configuration-controller-mode config))
+ "\nMultiProfile = " (symbol->string (bluetooth-configuration-multi-profile
+ config))
+ "\nFastConnectable = " (bool (bluetooth-configuration-fast-connectable? config))
+ "\nPrivacy = " (symbol->string (bluetooth-configuration-privacy config))
+ "\nJustWorksRepairing = " (symbol->string
+ (bluetooth-configuration-just-works-repairing config))
+ "\nTemporaryTimeout = " (number->string
+ (bluetooth-configuration-temporary-timeout config))
+ "\nRefreshDiscovery = " (bool (bluetooth-configuration-refresh-discovery config))
+ "\nExperimental = " (symbol->string (bluetooth-configuration-experimental config))
+ "\nRemoteNameRequestRetryDelay = " (number->string
+ (bluetooth-configuration-remote-name-request-retry-delay
+ config))
+ "\n[BR]"
+ (if (not (eq? -1 (bluetooth-configuration-page-scan-type config)))
+ (string-append
+ "\nPageScanType = "
+ (number->string (bluetooth-configuration-page-scan-type config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-page-scan-interval config)))
+ (string-append
+ "\nPageScanInterval = "
+ (number->string (bluetooth-configuration-page-scan-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-page-scan-window config)))
+ (string-append
+ "\nPageScanWindow = "
+ (number->string (bluetooth-configuration-page-scan-window config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-inquiry-scan-type config)))
+ (string-append
+ "\nInquiryScanType = "
+ (number->string (bluetooth-configuration-inquiry-scan-type config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-inquiry-scan-interval config)))
+ (string-append
+ "\nInquiryScanInterval = "
+ (number->string (bluetooth-configuration-inquiry-scan-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-inquiry-scan-window config)))
+ (string-append
+ "\nInquiryScanWindow = "
+ (number->string (bluetooth-configuration-inquiry-scan-window config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-link-supervision-timeout config)))
+ (string-append
+ "\nLinkSupervisionTimeout = "
+ (number->string (bluetooth-configuration-link-supervision-timeout config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-page-timeout config)))
+ (string-append
+ "\nPageTimeout = "
+ (number->string (bluetooth-configuration-page-timeout config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-min-sniff-interval config)))
+ (string-append
+ "\nMinSniffInterval = "
+ (number->string (bluetooth-configuration-min-sniff-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-max-sniff-interval config)))
+ (string-append
+ "\nMaxSniffInterval = "
+ (number->string (bluetooth-configuration-max-sniff-interval config))) "")
+
+ "\n[LE]"
+ (if (not (eq? -1 (bluetooth-configuration-min-advertisement-interval config)))
+ (string-append
+ "\nMinAdvertisementInterval = "
+ (number->string (bluetooth-configuration-min-advertisement-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-max-advertisement-interval config)))
+ (string-append
+ "\nMaxAdvertisementInterval = "
+ (number->string (bluetooth-configuration-max-advertisement-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-multi-advertisement-rotation-interval config)))
+ (string-append
+ "\nMultiAdvertisementRotationInterval = "
+ (number->string
+ (bluetooth-configuration-multi-advertisement-rotation-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-interval-auto-connect config)))
+ (string-append
+ "\nScanIntervalAutoConnect = "
+ (number->string (bluetooth-configuration-scan-interval-auto-connect config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-window-auto-connect config)))
+ (string-append
+ "\nScanWindowAutoConnect = "
+ (number->string (bluetooth-configuration-scan-window-auto-connect config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-interval-suspend config)))
+ (string-append
+ "\nScanIntervalSuspend = "
+ (number->string (bluetooth-configuration-scan-interval-suspend config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-window-suspend config)))
+ (string-append
+ "\nScanWindowSuspend = "
+ (number->string (bluetooth-configuration-scan-window-suspend config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-interval-discovery config)))
+ (string-append
+ "\nScanIntervalDiscovery = "
+ (number->string (bluetooth-configuration-scan-interval-discovery config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-window-discovery config)))
+ (string-append
+ "\nScanWindowDiscovery = "
+ (number->string (bluetooth-configuration-scan-window-discovery config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-interval-adv-monitor config)))
+ (string-append
+ "\nScanIntervalAdvMonitor = "
+ (number->string (bluetooth-configuration-scan-interval-adv-monitor config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-window-adv-monitor config)))
+ (string-append
+ "\nScanWindowAdvMonitor = "
+ (number->string (bluetooth-configuration-scan-window-adv-monitor config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-interval-connect config)))
+ (string-append
+ "\nScanIntervalConnect = "
+ (number->string (bluetooth-configuration-scan-interval-connect config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-scan-window-connect config)))
+ (string-append
+ "\nScanWindowConnect = "
+ (number->string (bluetooth-configuration-scan-window-connect config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-min-connection-interval config)))
+ (string-append
+ "\nMinConnectionInterval = "
+ (number->string (bluetooth-configuration-min-connection-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-max-connection-interval config)))
+ (string-append
+ "\nMaxConnectionInterval = "
+ (number->string (bluetooth-configuration-max-connection-interval config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-connection-latency config)))
+ (string-append
+ "\nConnectionLatency = "
+ (number->string (bluetooth-configuration-connection-latency config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-connection-supervision-timeout config)))
+ (string-append
+ "\nConnectionSupervisionTimeout = "
+ (number->string (bluetooth-configuration-connection-supervision-timeout config))) "")
+ (if (not (eq? -1 (bluetooth-configuration-autoconnect-timeout config)))
+ (string-append
+ "\nAutoconnecttimeout = "
+ (number->string (bluetooth-configuration-autoconnect-timeout config))) "")
+
+ "\nAdvMonAllowlistScanDuration = " (number->string
+ (bluetooth-configuration-adv-mon-allowlist-scan-duration
+ config))
+ "\nAdvMonNoFilterScanDuration = " (number->string
+ (bluetooth-configuration-adv-mon-no-filter-scan-duration
+ config))
+ "\nEnableAdvMonInterleaveScan = " (number->string
+ (bluetooth-configuration-enable-adv-mon-interleave-scan
+ config))
+
+ "\n[GATT]"
+ "\nCache = " (symbol->string (bluetooth-configuration-cache config))
+ "\nKeySize = " (number->string (bluetooth-configuration-key-size config))
+ "\nExchangeMTU = " (number->string (bluetooth-configuration-exchange-mtu config))
+ "\nChannels = " (number->string (bluetooth-configuration-att-channels config))
+
+ "\n[AVDTP]"
+ "\nSessionMode = " (symbol->string (bluetooth-configuration-session-mode config))
+ "\nStreamMode = " (symbol->string (bluetooth-configuration-stream-mode config))
+
+ "\n[Policy]"
+ (if (not (eq? '() (bluetooth-configuration-reconnect-uuids config)))
+ (string-append
+ "\nReconnectUUIDs = "
+ (string-join (bluetooth-configuration-reconnect-uuids config) ",")) "")
+ "\nReconnectAttempts = " (number->string
+ (bluetooth-configuration-reconnect-attempts config))
+ "\nReconnectIntervals = " (string-join
+ (map number->string
+ (bluetooth-configuration-reconnect-intervals
+ config))
+ ",")
+ "\nAutoEnable = " (bool (bluetooth-configuration-auto-enable?
+ config))
+ "\nResumeDelay = " (number->string (bluetooth-configuration-resume-delay config))
+
+ "\n[AdvMon]"
+ "\nRSSISamplingPeriod = " (bluetooth-configuration-rssi-sampling-period config)))
(define (bluetooth-directory config)
(computed-file "etc-bluetooth"
--
2.34.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-13 19:20 [bug#52470] [PATCH] services: bluetooth: Add missing config parameters Demis Balbach
@ 2021-12-13 19:36 ` Demis Balbach
2021-12-14 13:03 ` Josselin Poiret via Guix-patches via
2021-12-19 13:11 ` Demis Balbach
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Demis Balbach @ 2021-12-13 19:36 UTC (permalink / raw)
To: 52470
[-- Attachment #1: Type: text/plain, Size: 7670 bytes --]
Hello,
this patch adds all (as far as I know) missing config parameters to the
bluetooth-service.
I added all config parameters (that were missing) that are defined in
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf
If a default value was given, e.g.:
--8<---------------cut here---------------start------------->8---
# Specify the policy to the JUST-WORKS repairing initiated by peer
# Possible values: "never", "confirm", "always"
# Defaults to "never" <------------------------------------------
#JustWorksRepairing = never
--8<---------------cut here---------------end--------------->8---
I used that default value. However, there are other paramaters
(everthing under `[BR]' and almost everything under `[LE]') that don't
specify default values. They are always integers as one can see here:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/btd.h#n39
So I took a nonsensical value like `-1' and only printed the in question
with the user provided line if it did not equal -1.
This approach isn't pretty, but it worked for me, however please give
feedback regarding that.
My guile-fu is bad so I'm sure there's plenty room for improvement.
Here is the config I tested it with:
--8<---------------cut here---------------start------------->8---
(define-module (base-system)
#:use-module (gnu)
#:use-module (gnu services desktop)
#:use-module (srfi srfi-1))
(define base-operating-system
(operating-system
;; Machine settings
(host-name "geekcave")
(timezone "Europe/Berlin")
(locale "en_US.utf8")
(keyboard-layout (keyboard-layout "us" "altgr-intl"))
;; Services
(services (append (list
(service bluetooth-service-type (bluetooth-configuration
(name "test")
(class "0x123")
(discoverable-timeout 60)
(always-pairable? #f)
(pairable-timeout 20)
(device-id "bluetooth:123")
(reverse-service-discovery? #f)
(name-resolving? #f)
(debug-keys? #t)
(controller-mode 'le)
(multi-profile 'multiple)
(fast-connectable? #t)
(privacy 'network/on)
(just-works-repairing 'confirm)
(temporary-timeout 10)
(refresh-discovery? #f)
(experimental 'd4992530-b9ec-469f-ab01-6c481c47da1c)
(remote-name-request-retry-delay 20)
(page-scan-type #xFFF)
(page-scan-interval #x0)
(page-scan-window #x1)
(inquiry-scan-type #xFFFF)
(inquiry-scan-interval #x123)
(inquiry-scan-window 23890)
(link-supervision-timeout 13)
(page-timeout 9)
(min-sniff-interval 0)
(max-sniff-interval 2)
(min-advertisement-interval 0)
(max-advertisement-interval 2)
(multi-advertisement-rotation-interval 3)
(scan-interval-auto-connect 0)
(scan-window-auto-connect 0)
(scan-interval-suspend 0)
(scan-window-suspend 0)
(scan-interval-discovery 0)
(scan-window-discovery 0)
(scan-interval-adv-monitor 0)
(scan-window-adv-monitor 0)
(scan-interval-connect 0)
(scan-window-connect 0)
(min-connection-interval 0)
(max-connection-interval 1)
(connection-latency 10)
(connection-supervision-timeout 34)
(autoconnect-timeout 4)
(adv-mon-allowlist-scan-duration 20)
(adv-mon-no-filter-scan-duration 30)
(enable-adv-mon-interleave-scan 0)
(cache 'yes)
(key-size 15)
(exchange-mtu 23)
(att-channels 1)
(session-mode 'ertm)
(stream-mode 'streaming)
(reconnect-uuids (list ""))
(reconnect-attempts 3)
(reconnect-intervals (list 2 4 49))
(auto-enable? #t)
(resume-delay 29)
(rssi-sampling-period "0x10"))))
%base-services))
;; Boot loader
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(target "/boot/efi")
(timeout 3)))
;; File systems
(file-systems (cons* (file-system ;; System partition
(device (file-system-label "GUIX"))
(mount-point "/")
(type "btrfs"))
(file-system ;; Boot partition
(device (file-system-label "BOOT"))
(mount-point "/boot/efi")
(type "vfat"))
%base-file-systems))))
base-operating-system
--8<---------------cut here---------------end--------------->8---
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-13 19:36 ` Demis Balbach
@ 2021-12-14 13:03 ` Josselin Poiret via Guix-patches via
2021-12-14 14:51 ` Demis Balbach
2021-12-14 20:50 ` Demis Balbach
0 siblings, 2 replies; 10+ messages in thread
From: Josselin Poiret via Guix-patches via @ 2021-12-14 13:03 UTC (permalink / raw)
To: Demis Balbach, 52470; +Cc: dev
Hello,
Demis Balbach <db@minikn.xyz> writes:
> Hello,
>
> this patch adds all (as far as I know) missing config parameters to
> the bluetooth-service.
Nice work!
> I used that default value. However, there are other paramaters
> (everthing under `[BR]' and almost everything under `[LE]') that don't
> specify default values. They are always integers as one can see here:
>
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/btd.h#n39
>
> So I took a nonsensical value like `-1' and only printed the in
> question with the user provided line if it did not equal -1.
Since Guile isn't typed, the usual approach is to use `#f` for default
values, and then use `(if (bluetooth-configuration-inquiry-scan-window
config) ...)` for example. Any value other than #f will be considered
as truthful for conditionals (see "(guile)Booleans").
> + (if (not (eq? -1 (bluetooth-configuration-page-scan-type config)))
> + (string-append
> + "\nPageScanType = "
> + (number->string (bluetooth-configuration-page-scan-type config))) "")
Small nitpick, I'd rather have `""`, the else part of this if syntax, on
its own line, aligned with `(string-append`.
Could you also document the `bluetooth-service-type` Scheme value in
doc/guix.texi, as well as `bluetooth-configuration`, if that's not too
much to ask? I only see one for `bluetooth-service` right now. I'm not
sure if all configuration values should be documented there though,
since there are a lot.
By the way, shouldn't `bluetooth-service` be deprecated, given how
simple it is to use the `-type` version?
What do others think?
Best,
Josselin Poiret
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-14 13:03 ` Josselin Poiret via Guix-patches via
@ 2021-12-14 14:51 ` Demis Balbach
2021-12-14 20:50 ` Demis Balbach
1 sibling, 0 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-14 14:51 UTC (permalink / raw)
To: Josselin Poiret, 52470; +Cc: dev
[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]
On 2021-12-14 14:03, Josselin Poiret wrote:
Hello,
> Since Guile isn't typed, the usual approach is to use `#f` for default
> values, and then use `(if (bluetooth-configuration-inquiry-scan-window
> config) ...)` for example. Any value other than #f will be considered
> as truthful for conditionals (see "(guile)Booleans").
I tried that, and I could have sworn I got an error regarding the
type. I was under the impression that the default values' type set the
type for the whole field. But I was wrong of course because I tested
your suggestion and it worked.
> Small nitpick, I'd rather have `""`, the else part of this if syntax, on
> its own line, aligned with `(string-append`.
Please do nitpick. I appreciate it. I think the `[General]` part looks
pretty messy indentation-wise, but I don't really know what layout to
settle on.
> Could you also document the `bluetooth-service-type` Scheme value in
> doc/guix.texi, as well as `bluetooth-configuration`, if that's not too
> much to ask? I only see one for `bluetooth-service` right now. I'm not
> sure if all configuration values should be documented there though,
> since there are a lot.
Sure. How can I test the changes to the documentation? Like generating a
pdf or something along those lines.
> By the way, shouldn't `bluetooth-service` be deprecated, given how
> simple it is to use the `-type` version?
I'm not the one to answer that :)
> What do others think?
>
> Best,
> Josselin Poiret
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-14 13:03 ` Josselin Poiret via Guix-patches via
2021-12-14 14:51 ` Demis Balbach
@ 2021-12-14 20:50 ` Demis Balbach
1 sibling, 0 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-14 20:50 UTC (permalink / raw)
To: Josselin Poiret, 52470; +Cc: dev
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
On 2021-12-14 14:03, Josselin Poiret wrote:
I've added a new patch. ID: 52489.
Please check for spelling mistakes/typos.
This kind of work is very repetitive and thus prone to errors.
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-13 19:20 [bug#52470] [PATCH] services: bluetooth: Add missing config parameters Demis Balbach
2021-12-13 19:36 ` Demis Balbach
@ 2021-12-19 13:11 ` Demis Balbach
2021-12-19 13:19 ` Demis Balbach
2021-12-19 16:41 ` Demis Balbach
3 siblings, 0 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-19 13:11 UTC (permalink / raw)
To: 52470
[-- Attachment #1: Type: text/plain, Size: 3655 bytes --]
Hello Liliana,
thanks for your input on https://issues.guix.gnu.org/52575.
I will continue the discussion about it here.
You prepend most of your comments with "Why not do ...". I have an
universal answer for that: I don't know :) I did what I did with the
limited Guile knowledge at my disposal. I'm still learning everyday and
therefore am thankful for your recommendations.
> Is it really a good idea to use a string-encoded number here? Why not
> a number? Why not two? A pair or list of symbols mayhaps?
It should be a number, you are correct.
> You maybe want to have a <device-id> record here, but fair enough, a
> string works too.
I can see the benefit of that, but maybe that's something for another
patch. I can add a `;;; MAYBE: ` comment to the implementation however
if that's desired.
> Why have a key network/on? Why not use 'on and 'network and document,
> that they function the same due to (insert implementation detail).
I think this point we need to discuss. I tried to implement things as
close as possible to the "original" keys/values in
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf
Specifically for the `privacy` key, you can see the implementation here
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n68,
in particular
--8<---------------cut here---------------start------------->8---
# Possible values for LE mode: "off", "network/on", "device"
# Possible values for Dual mode: "off", "network/on", "device",
# "limited-network", "limited-device"
--8<---------------cut here---------------end--------------->8---
Now, I don't think it's a good idea to introduce arbitrary values for
Guix, meaning split `network/on` in `'network` and `'on`. In my opinion
(which may very well be wrong) the config values applicable in Guix
should match those in the resulting config file as close as possible.
For a user coming to Guix who already worked with the bluetooth configuration on
another distro, seeing `'network` and/or `'on` (but not `'network/on`)
as possible config values, is confusing, at least I think it is.
> Why a list of UUIDs? Wouldn't it make more sense to use symbols like
> 'debug, 'll-privacy, 'quality-report, etc.?
> On that note, we have a UUID type, so use it.
I actually didn't know there's a UUID type. This makes more sense. But
not a list as only one value can be applied. Also I would advise
introducing symbol like `'ll-privacy` and the like because of what I
said earlier.
> Should be a boolean.
Same point here. I used boolean types whereever the config value need
was `true`/`false`. In this particular case (I don't know why) the
bluetooth implementations expects `0`/`1` instead of the former. This is
why I kept it a number. However, in this case I think it's okay to
deviate from the original implementation because `0` and false / `1` and
`true` are universally understood as being equivalent (By this of course
I mean the user would set `#f`/`#t`, the written value however would
still be `0`/`1`).
> Might want to rename/alias 'yes to 'paired.
Again, same point here. `'paired` would be an arbitrary value only Guix
have.
> You probably want to write that as "an integer 7 <= N <= 16".
...
>As above.
Yes, absolutely.
> Again, make sure that your code works with UUIDs here if it doesn't
> already.
Will do.
> Use numbers, not strings.
Will do.
I'll create a new patch with all the things altered I agree about. I'll
leave the rest until we have talked about the points I made.
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-13 19:20 [bug#52470] [PATCH] services: bluetooth: Add missing config parameters Demis Balbach
2021-12-13 19:36 ` Demis Balbach
2021-12-19 13:11 ` Demis Balbach
@ 2021-12-19 13:19 ` Demis Balbach
2021-12-19 16:41 ` Demis Balbach
3 siblings, 0 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-19 13:19 UTC (permalink / raw)
To: 52470
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
> I actually didn't know there's a UUID type. This makes more sense. But
> not a list as only one value can be applied. Also I would advise
> introducing symbol like `'ll-privacy` and the like because of what I
> said earlier.
Typo: I meant "advise AGAINST introducing ... "
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-13 19:20 [bug#52470] [PATCH] services: bluetooth: Add missing config parameters Demis Balbach
` (2 preceding siblings ...)
2021-12-19 13:19 ` Demis Balbach
@ 2021-12-19 16:41 ` Demis Balbach
2022-02-05 10:22 ` Demis Balbach
2022-03-09 22:43 ` bug#52470: " Ludovic Courtès
3 siblings, 2 replies; 10+ messages in thread
From: Demis Balbach @ 2021-12-19 16:41 UTC (permalink / raw)
To: 52470
[-- Attachment #1: Type: text/plain, Size: 35183 bytes --]
---
doc/guix.texi | 443 ++++++++++++++++++++++++++++++++++++++-
gnu/services/desktop.scm | 375 ++++++++++++++++++++++++++++++++-
2 files changed, 813 insertions(+), 5 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index aca88cdada..138a862ff1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20777,6 +20777,448 @@ bluetooth keyboard or mouse.
Users need to be in the @code{lp} group to access the D-Bus service.
@end deffn
+@deffn {Scheme Variable} bluetooth-service-type
+This is the type for the @uref{https://bluez.org/, Linux Bluetooth Protocol
+Stack} (BlueZ) system, which generates the @file{/etc/bluetooth/main.conf}
+configuration file. The value for this type is a @command{bluetooth-configuration}
+record as in this example:
+
+@lisp
+(service bluetooth-service-type)
+@end lisp
+
+See below for details about @code{bluetooth-configuration}.
+@end deffn
+
+@deftp {Data Type} bluetooth-configuration
+Data type representing the configuration for @code{bluetooth-service}.
+
+@table @asis
+@item @code{bluez} (default: @code{bluez})
+@code{bluez} package to use.
+
+@item @code{name} (default: @code{"BlueZ"})
+Default adapter name.
+
+@item @code{class} (default: @code{#x000000})
+Default device class. Only the major and minor device class bits are considered.
+
+@item @code{discoverable-timeout} (default: @code{180})
+How long to stay in discoverable mode before going back to non-discoverable. The
+value is in seconds.
+
+@item @code{always-pairable?} (default: @code{#f})
+Always allow pairing even if there are no agents registered.
+
+@item @code{pairable-timeout} (default: @code{0})
+How long to stay in pairable mode before going back to non-discoverable. The
+value is in seconds.
+
+@item @code{device-id} (default: @code{#f})
+Use vendor id source (assigner), vendor, product and version information for
+DID profile support. The values are separated by ":" and @var{assigner}, @var{VID},
+@var{PID} and @var{version}.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{#f} to disable it,
+
+@item
+@code{"assigner:1234:5678:abcd"}, where @var{assigner} is either @code{usb} (default)
+or @code{bluetooth}.
+
+@end itemize
+
+@item @code{reverse-service-discovery?} (default: @code{#t})
+Do reverse service discovery for previously unknown devices that connect to
+us. For BR/EDR this option is really only needed for qualification since the
+BITE tester doesn't like us doing reverse SDP for some test cases, for LE
+this disables the GATT client functionally so it can be used in system which
+can only operate as peripheral.
+
+@item @code{name-resolving?} (default: @code{#t})
+Enable name resolving after inquiry. Set it to @code{#f} if you don't need
+remote devices name and want shorter discovery cycle.
+
+@item @code{debug-keys?} (default: @code{#f})
+Enable runtime persistency of debug link keys. Default is false which makes
+debug link keys valid only for the duration of the connection that they were
+created for.
+
+@item @code{controller-mode} (default: @code{'dual})
+Restricts all controllers to the specified transport. @code{'dual} means both
+BR/EDR and LE are enabled (if supported by the hardware).
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{'dual}
+
+@item
+@code{'bredr}
+
+@item
+@code{'le}
+
+@end itemize
+
+@item @code{multi-profile} (default: @code{'off})
+Enables Multi Profile Specification support. This allows to specify if system
+supports only Multiple Profiles Single Device (MPSD) configuration or both
+Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple Devices
+(MPMD) configurations.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{'off}
+
+@item
+@code{'single}
+
+@item
+@code{'multiple}
+
+@end itemize
+
+@item @code{fast-connectable?} (default: @code{#f})
+Permanently enables the Fast Connectable setting for adapters that support
+it. When enabled other devices can connect faster to us, however the
+tradeoff is increased power consumptions. This feature will fully work only
+on kernel version 4.1 and newer.
+
+@item @code{privacy} (default: @code{'off})
+Default privacy settings.
+
+@itemize @bullet
+@item
+@code{'off}: Disable local privacy
+
+@item
+@code{'network/on}: A device will only accept advertising packets from peer
+devices that contain private addresses. It may not be compatible with some
+legacy devices since it requires the use of RPA(s) all the time
+
+@item
+@code{'device}: A device in device privacy mode is only concerned about the
+privacy of the device and will accept advertising packets from peer devices
+that contain their Identity Address as well as ones that contain a private
+address, even if the peer device has distributed its IRK in the past
+
+@end itemize
+
+and additionally, if @var{controller-mode} is set to @code{'dual}:
+
+@itemize @bullet
+@item
+@code{'limited-network}: Apply Limited Discoverable Mode to advertising, which
+follows the same policy as to BR/EDR that publishes the identity address when
+discoverable, and Network Privacy Mode for scanning
+
+@item
+@code{'limited-device}: Apply Limited Discoverable Mode to advertising, which
+follows the same policy as to BR/EDR that publishes the identity address when
+discoverable, and Device Privacy Mode for scanning.
+
+@end itemize
+
+@item @code{just-works-repairing} (default: @code{'never})
+Specify the policy to the JUST-WORKS repairing initiated by peer.
+
+Possible values:
+@itemize @bullet
+@item
+@code{'never}
+
+@item
+@code{'confirm}
+
+@item
+@code{'always}
+
+@end itemize
+
+@item @code{temporary-timeout} (default: @code{30})
+How long to keep temporary devices around. The value is in seconds. @code{0}
+disables the timer completely.
+
+@item @code{refresh-discovery?} (default: @code{#t})
+Enables the device to issue an SDP request to update known services when
+profile is connected.
+
+@item @code{experimental} (default: @code{#f})
+Enables experimental features and interfaces, alternatively a list of UUIDs
+can be given.
+
+Possible values:
+
+@itemize @bullet
+@item
+@code{#t}
+
+@item
+@code{#f}
+
+@item
+@code{(list (uuid <uuid-1>) (uuid <uuid-2>) ...)}.
+@end itemize
+
+List of possible UUIDs:
+@itemize @bullet
+@item
+@code{d4992530-b9ec-469f-ab01-6c481c47da1c}: BlueZ Experimental Debug,
+
+@item
+@code{671b10b5-42c0-4696-9227-eb28d1b049d6}: BlueZ Experimental Simultaneous Central and Peripheral,
+
+@item
+@code{"15c0a148-c273-11ea-b3de-0242ac130004}: BlueZ Experimental LL privacy,
+
+@item
+@code{330859bc-7506-492d-9370-9a6f0614037f}: BlueZ Experimental Bluetooth Quality Report,
+
+@item
+@code{a6695ace-ee7f-4fb9-881a-5fac66c629af}: BlueZ Experimental Offload Codecs.
+@end itemize
+
+@item @code{remote-name-request-retry-delay} (default: @code{300})
+The duration to avoid retrying to resolve a peer's name, if the previous
+try failed.
+
+@item @code{page-scan-type} (default: @code{#f})
+BR/EDR Page scan activity type.
+
+@item @code{page-scan-interval} (default: @code{#f})
+BR/EDR Page scan activity interval.
+
+@item @code{page-scan-window} (default: @code{#f})
+BR/EDR Page scan activity window.
+
+@item @code{inquiry-scan-type} (default: @code{#f})
+BR/EDR Inquiry scan activity type.
+
+@item @code{inquiry-scan-interval} (default: @code{#f})
+BR/EDR Inquiry scan activity interval.
+
+@item @code{inquiry-scan-window} (default: @code{#f})
+BR/EDR Inquiry scan activity window.
+
+@item @code{link-supervision-timeout} (default: @code{#f})
+BR/EDR Link supervision timeout.
+
+@item @code{page-timeout} (default: @code{#f})
+BR/EDR Page timeout.
+
+@item @code{min-sniff-interval} (default: @code{#f})
+BR/EDR minimum sniff interval.
+
+@item @code{max-sniff-interval} (default: @code{#f})
+BR/EDR maximum sniff interval.
+
+@item @code{min-advertisement-interval} (default: @code{#f})
+LE minimum advertisement interval (used for legacy advertisement only).
+
+@item @code{max-advertisement-interval} (default: @code{#f})
+LE maximum advertisement interval (used for legacy advertisement only).
+
+@item @code{multi-advertisement-rotation-interval} (default: @code{#f})
+LE multiple advertisement rotation interval.
+
+@item @code{scan-interval-auto-connect} (default: @code{#f})
+LE scanning interval used for passive scanning supporting auto connect.
+
+@item @code{scan-window-auto-connect} (default: @code{#f})
+LE scanning window used for passive scanning supporting auto connect.
+
+@item @code{scan-interval-suspend} (default: @code{#f})
+LE scanning interval used for active scanning supporting wake from suspend.
+
+@item @code{scan-window-suspend} (default: @code{#f})
+LE scanning window used for active scanning supporting wake from suspend.
+
+@item @code{scan-interval-discovery} (default: @code{#f})
+LE scanning interval used for active scanning supporting discovery.
+
+@item @code{scan-window-discovery} (default: @code{#f})
+LE scanning window used for active scanning supporting discovery.
+
+@item @code{scan-interval-adv-monitor} (default: @code{#f})
+LE scanning interval used for passive scanning supporting the advertisement monitor APIs.
+
+@item @code{scan-window-adv-monitor} (default: @code{#f})
+LE scanning window used for passive scanning supporting the advertisement monitor APIs.
+
+@item @code{scan-interval-connect} (default: @code{#f})
+LE scanning interval used for connection establishment.
+
+@item @code{scan-window-connect} (default: @code{#f})
+LE scanning window used for connection establishment.
+
+@item @code{min-connection-interval} (default: @code{#f})
+LE default minimum connection interval. This value is superceeded by any specific
+value provided via the Load Connection Parameters interface.
+
+@item @code{max-connection-interval} (default: @code{#f})
+LE default maximum connection interval. This value is superceeded by any specific
+value provided via the Load Connection Parameters interface.
+
+@item @code{connection-latency} (default: @code{#f})
+LE default connection latency. This value is superceeded by any specific
+value provided via the Load Connection Parameters interface.
+
+@item @code{connection-supervision-timeout} (default: @code{#f})
+LE default connection supervision timeout. This value is superceeded by any specific
+value provided via the Load Connection Parameters interface.
+
+@item @code{autoconnect-timeout} (default: @code{#f})
+LE default autoconnect timeout. This value is superceeded by any specific
+value provided via the Load Connection Parameters interface.
+
+@item @code{adv-mon-allowlist-scan-duration} (default: @code{300})
+Allowlist scan duration during interleaving scan. Only used when scanning for ADV
+monitors. The units are msec.
+
+@item @code{adv-mon-no-filter-scan-duration} (default: @code{500})
+No filter scan duration during interleaving scan. Only used when scanning for ADV
+monitors. The units are msec.
+
+@item @code{enable-adv-mon-interleave-scan?} (default: @code{#t})
+Enable/Disable Advertisement Monitor interleave scan for power saving.
+
+@item @code{cache} (default: @code{'always})
+GATT attribute cache.
+
+Possible values are:
+@itemize @bullet
+@item
+@code{'always}: Always cache attributes even for devices not paired, this is
+recommended as it is best for interoperability, with more consistent
+reconnection times and enables proper tracking of notifications for all
+devices
+
+@item
+@code{'yes}: Only cache attributes of paired devices
+
+@item
+@code{'no}: Never cache attributes.
+@end itemize
+
+@item @code{key-size} (default: @code{0})
+Minimum required Encryption Key Size for accessing secured characteristics.
+
+Possible values are:
+@itemize @bullet
+@item
+@code{0}: Don't care
+
+@item
+@code{7 <= N <= 16}
+@end itemize
+
+@item @code{exchange-mtu} (default: @code{517})
+Exchange MTU size. Possible values are:
+
+@itemize @bullet
+@item
+@code{23 <= N <= 517}
+@end itemize
+
+@item @code{att-channels} (default: @code{3})
+Number of ATT channels. Possible values are:
+
+@itemize @bullet
+@item
+@code{1}: Disables EATT
+
+@item
+@code{2 <= N <= 5}
+@end itemize
+
+@item @code{session-mode} (default: @code{'basic})
+AVDTP L2CAP signalling channel mode.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{'basic}: Use L2CAP basic mode
+
+@item
+@code{'ertm}: Use L2CAP enhanced retransmission mode.
+@end itemize
+
+@item @code{stream-mode} (default: @code{'basic})
+AVDTP L2CAP transport channel mode.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{'basic}: Use L2CAP basic mode
+
+@item
+@code{'streaming}: Use L2CAP streaming mode.
+@end itemize
+
+@item @code{reconnect-uuids} (default: @code{'()})
+The ReconnectUUIDs defines the set of remote services that should try
+to be reconnected to in case of a link loss (link supervision
+timeout). The policy plugin should contain a sane set of values by
+default, but this list can be overridden here. By setting the list to
+empty the reconnection feature gets disabled.
+
+Possible values:
+
+@itemize @bullet
+@item
+@code{'()}
+
+@item
+@code{(list (uuid <uuid-1>) (uuid <uuid-2>) ...)}.
+@end itemize
+
+@item @code{reconnect-attempts} (default: @code{7})
+Defines the number of attempts to reconnect after a link lost. Setting
+the value to 0 disables reconnecting feature.
+
+@item @code{reconnect-intervals} (default: @code{'(1 2 4 8 16 32 64)})
+Defines a list of intervals in seconds to use in between attempts. If
+the number of attempts defined in @var{reconnect-attempts} is bigger than
+the list of intervals the last interval is repeated until the last attempt.
+
+@item @code{auto-enable?} (default: @code{#f})
+Defines option to enable all controllers when they are found. This includes
+adapters present on start as well as adapters that are plugged in later on.
+
+@item @code{resume-delay} (default: @code{2})
+Audio devices that were disconnected due to suspend will be reconnected on
+resume. @var{resume-delay} determines the delay between when the controller
+resumes from suspend and a connection attempt is made. A longer delay is
+better for better co-existence with Wi-Fi. The value is in seconds.
+
+@item @code{rssi-sampling-period} (default: @code{#xFF})
+Default RSSI Sampling Period. This is used when a client registers an
+advertisement monitor and leaves the RSSISamplingPeriod unset.
+
+Possible values are:
+@itemize @bullet
+@item
+@code{#x0}: Report all advertisements
+
+@item
+@code{N = #xXX}: Report advertisements every N x 100 msec (range: #x01 to #xFE)
+
+@item
+@code{#xFF}: Report only one advertisement per device during monitoring period.
+@end itemize
+
+@end table
+@end deftp
+
@defvr {Scheme Variable} gnome-keyring-service-type
This is the type of the service that adds the
@uref{https://wiki.gnome.org/Projects/GnomeKeyring, GNOME Keyring}. Its
@@ -20811,7 +21253,6 @@ and ``passwd'' is with the value @code{passwd}.
@end table
@end deftp
-
@node Sound Services
@subsection Sound Services
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index c6761ca784..76719dcba5 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -44,6 +44,7 @@ (define-module (gnu services desktop)
#:use-module (gnu system)
#:use-module (gnu system setuid)
#:use-module (gnu system shadow)
+ #:use-module (gnu system uuid)
#:use-module (gnu system pam)
#:use-module (gnu packages glib)
#:use-module (gnu packages admin)
@@ -403,14 +404,380 @@ (define-record-type* <bluetooth-configuration>
bluetooth-configuration make-bluetooth-configuration
bluetooth-configuration?
(bluez bluetooth-configuration-bluez (default bluez))
- (auto-enable? bluetooth-configuration-auto-enable? (default #f)))
+
+ ;;; [General]
+ (name bluetooth-configuration-name (default "BlueZ"))
+ (class bluetooth-configuration-class (default #x000000))
+ (discoverable-timeout
+ bluetooth-configuration-discoverable-timeout (default 180))
+ (always-pairable? bluetooth-configuration-always-pairable? (default #f))
+ (pairable-timeout bluetooth-configuration-pairable-timeout (default 0))
+
+ ;;; MAYBE: Exclude into separate <device-id> record-type?
+ (device-id bluetooth-configuration-device-id (default #f))
+ (reverse-service-discovery?
+ bluetooth-configuration-reverse-service-discovery (default #t))
+ (name-resolving? bluetooth-configuration-name-resolving? (default #t))
+ (debug-keys? bluetooth-configuration-debug-keys? (default #f))
+
+ ;;; Possible values:
+ ;;; 'dual, 'bredr, 'le
+ (controller-mode bluetooth-configuration-controller-mode (default 'dual))
+
+ ;;; Possible values:
+ ;;; 'off, 'single, 'multiple
+ (multi-profile bluetooth-configuration-multi-profile (default 'off))
+ (fast-connectable? bluetooth-configuration-fast-connectable? (default #f))
+
+ ;;; Possible values:
+ ;;; for LE mode: 'off, 'network/on, 'device
+ ;;; for Dual mode: 'off, 'network/on', 'device, 'limited-network, 'limited-device
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n68
+ (privacy bluetooth-configuration-privacy (default 'off))
+
+ ;;; Possible values:
+ ;;; 'never, 'confirm, 'always
+ (just-works-repairing
+ bluetooth-configuration-just-works-repairing (default 'never))
+ (temporary-timeout bluetooth-configuration-temporary-timeout (default 30))
+ (refresh-discovery? bluetooth-configuration-refresh-discovery (default #t))
+
+ ;;; Possible values: #t, #f, (uuid <uuid>)
+ ;;; Possible UUIDs:
+ ;;; d4992530-b9ec-469f-ab01-6c481c47da1c (BlueZ Experimental Debug)
+ ;;; 671b10b5-42c0-4696-9227-eb28d1b049d6 (BlueZ Experimental Simultaneous Central and Peripheral)
+ ;;; 15c0a148-c273-11ea-b3de-0242ac130004 (BlueZ Experimental LL privacy)
+ ;;; 330859bc-7506-492d-9370-9a6f0614037f (BlueZ Experimental Bluetooth Quality Report)
+ ;;; a6695ace-ee7f-4fb9-881a-5fac66c629af (BlueZ Experimental Offload Codecs)
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n110
+ (experimental bluetooth-configuration-experimental (default #f))
+ (remote-name-request-retry-delay
+ bluetooth-configuration-remote-name-request-retry-delay (default 300))
+
+ ;;; [BR]
+ (page-scan-type bluetooth-configuration-page-scan-type (default #f))
+ (page-scan-interval bluetooth-configuration-page-scan-interval (default #f))
+ (page-scan-window bluetooth-configuration-page-scan-window (default #f))
+ (inquiry-scan-type bluetooth-configuration-inquiry-scan-type (default #f))
+ (inquiry-scan-interval bluetooth-configuration-inquiry-scan-interval (default #f))
+ (inquiry-scan-window bluetooth-configuration-inquiry-scan-window (default #f))
+ (link-supervision-timeout bluetooth-configuration-link-supervision-timeout (default #f))
+ (page-timeout bluetooth-configuration-page-timeout (default #f))
+ (min-sniff-interval bluetooth-configuration-min-sniff-interval (default #f))
+ (max-sniff-interval bluetooth-configuration-max-sniff-interval (default #f))
+
+ ;;; [LE]
+ (min-advertisement-interval
+ bluetooth-configuration-min-advertisement-interval (default #f))
+ (max-advertisement-interval
+ bluetooth-configuration-max-advertisement-interval (default #f))
+ (multi-advertisement-rotation-interval
+ bluetooth-configuration-multi-advertisement-rotation-interval (default #f))
+ (scan-interval-auto-connect
+ bluetooth-configuration-scan-interval-auto-connect (default #f))
+ (scan-window-auto-connect
+ bluetooth-configuration-scan-window-auto-connect (default #f))
+ (scan-interval-suspend
+ bluetooth-configuration-scan-interval-suspend (default #f))
+ (scan-window-suspend
+ bluetooth-configuration-scan-window-suspend (default #f))
+ (scan-interval-discovery
+ bluetooth-configuration-scan-interval-discovery (default #f))
+ (scan-window-discovery
+ bluetooth-configuration-scan-window-discovery (default #f))
+ (scan-interval-adv-monitor
+ bluetooth-configuration-scan-interval-adv-monitor (default #f))
+ (scan-window-adv-monitor
+ bluetooth-configuration-scan-window-adv-monitor (default #f))
+ (scan-interval-connect
+ bluetooth-configuration-scan-interval-connect (default #f))
+ (scan-window-connect
+ bluetooth-configuration-scan-window-connect (default #f))
+ (min-connection-interval
+ bluetooth-configuration-min-connection-interval (default #f))
+ (max-connection-interval
+ bluetooth-configuration-max-connection-interval (default #f))
+ (connection-latency
+ bluetooth-configuration-connection-latency (default #f))
+ (connection-supervision-timeout
+ bluetooth-configuration-connection-supervision-timeout (default #f))
+ (autoconnect-timeout
+ bluetooth-configuration-autoconnect-timeout (default #f))
+ (adv-mon-allowlist-scan-duration
+ bluetooth-configuration-adv-mon-allowlist-scan-duration (default 300))
+ (adv-mon-no-filter-scan-duration
+ bluetooth-configuration-adv-mon-no-filter-scan-duration (default 500))
+ (enable-adv-mon-interleave-scan?
+ bluetooth-configuration-enable-adv-mon-interleave-scan (default #t))
+
+ ;;; [GATT]
+ ;;; Possible values: 'yes, 'no, 'always
+ (cache bluetooth-configuration-cache (default 'always))
+
+ ;;; Possible values: 7 ... 16, 0 (don't care)
+ (key-size bluetooth-configuration-key-size (default 0))
+
+ ;;; Possible values: 23 ... 517
+ (exchange-mtu bluetooth-configuration-exchange-mtu (default 517))
+
+ ;;; Possible values: 1 ... 5
+ (att-channels bluetooth-configuration-att-channels (default 3))
+
+ ;;; [AVDTP]
+ ;;; Possible values: 'basic, 'ertm
+ (session-mode bluetooth-configuration-session-mode (default 'basic))
+
+ ;;; Possible values: 'basic, 'streaming
+ (stream-mode bluetooth-configuration-stream-mode (default 'basic))
+
+ ;;; [Policy]
+ (reconnect-uuids bluetooth-configuration-reconnect-uuids (default '()))
+ (reconnect-attempts bluetooth-configuration-reconnect-attempts (default 7))
+ (reconnect-intervals bluetooth-configuration-reconnect-intervals
+ (default (list 1 2 4 8 16 32 64)))
+ (auto-enable? bluetooth-configuration-auto-enable? (default #f))
+ (resume-delay bluetooth-configuration-resume-delay (default 2))
+
+ ;;; [AdvMon]
+ ;;; Possible values:
+ ;;; "0x00", "0xFF",
+ ;;; "N = 0x00" ... "N = 0xFF"
+ ;;; Source: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n286
+ (rssi-sampling-period bluetooth-configuration-rssi-sampling-period
+ (default #xFF)))
(define (bluetooth-configuration-file config)
"Return a configuration file for the systemd bluetooth service, as a string."
(string-append
- "[Policy]\n"
- "AutoEnable=" (bool (bluetooth-configuration-auto-enable?
- config))))
+ "[General]"
+ "\nName = " (bluetooth-configuration-name config)
+ "\nClass = " (string-append
+ "0x"
+ (format #f "~6,'0x" (bluetooth-configuration-class config)))
+ "\nDiscoverableTimeout = " (number->string
+ (bluetooth-configuration-discoverable-timeout
+ config))
+ "\nAlwaysPairable = " (bool (bluetooth-configuration-always-pairable?
+ config))
+ "\nPairableTimeout = " (number->string
+ (bluetooth-configuration-pairable-timeout
+ config))
+ (if (bluetooth-configuration-device-id config)
+ (string-append "\nDeviceID = " (bluetooth-configuration-device-id config))
+ "")
+ "\nReverseServiceDiscovery = " (bool
+ (bluetooth-configuration-reverse-service-discovery
+ config))
+ "\nNameResolving = " (bool (bluetooth-configuration-name-resolving? config))
+ "\nDebugKeys = " (bool (bluetooth-configuration-debug-keys? config))
+ "\nControllerMode = " (symbol->string
+ (bluetooth-configuration-controller-mode config))
+ "\nMultiProfile = " (symbol->string (bluetooth-configuration-multi-profile
+ config))
+ "\nFastConnectable = " (bool (bluetooth-configuration-fast-connectable? config))
+ "\nPrivacy = " (symbol->string (bluetooth-configuration-privacy config))
+ "\nJustWorksRepairing = " (symbol->string
+ (bluetooth-configuration-just-works-repairing config))
+ "\nTemporaryTimeout = " (number->string
+ (bluetooth-configuration-temporary-timeout config))
+ "\nRefreshDiscovery = " (bool (bluetooth-configuration-refresh-discovery config))
+ "\nExperimental = " (let ((experimental (bluetooth-configuration-experimental config)))
+ (cond ((or (eq? experimental #t)
+ (eq? experimental #f)) (bool experimental))
+ ((list? experimental)
+ (string-join (map uuid->string experimental) ","))))
+ "\nRemoteNameRequestRetryDelay = " (number->string
+ (bluetooth-configuration-remote-name-request-retry-delay
+ config))
+ "\n[BR]"
+ (if (bluetooth-configuration-page-scan-type config)
+ (string-append
+ "\nPageScanType = "
+ (number->string (bluetooth-configuration-page-scan-type config)))
+ "")
+ (if (bluetooth-configuration-page-scan-interval config)
+ (string-append
+ "\nPageScanInterval = "
+ (number->string (bluetooth-configuration-page-scan-interval config)))
+ "")
+ (if (bluetooth-configuration-page-scan-window config)
+ (string-append
+ "\nPageScanWindow = "
+ (number->string (bluetooth-configuration-page-scan-window config)))
+ "")
+ (if (bluetooth-configuration-inquiry-scan-type config)
+ (string-append
+ "\nInquiryScanType = "
+ (number->string (bluetooth-configuration-inquiry-scan-type config)))
+ "")
+ (if (bluetooth-configuration-inquiry-scan-interval config)
+ (string-append
+ "\nInquiryScanInterval = "
+ (number->string (bluetooth-configuration-inquiry-scan-interval config)))
+ "")
+ (if (bluetooth-configuration-inquiry-scan-window config)
+ (string-append
+ "\nInquiryScanWindow = "
+ (number->string (bluetooth-configuration-inquiry-scan-window config)))
+ "")
+ (if (bluetooth-configuration-link-supervision-timeout config)
+ (string-append
+ "\nLinkSupervisionTimeout = "
+ (number->string (bluetooth-configuration-link-supervision-timeout config)))
+ "")
+ (if (bluetooth-configuration-page-timeout config)
+ (string-append
+ "\nPageTimeout = "
+ (number->string (bluetooth-configuration-page-timeout config)))
+ "")
+ (if (bluetooth-configuration-min-sniff-interval config)
+ (string-append
+ "\nMinSniffInterval = "
+ (number->string (bluetooth-configuration-min-sniff-interval config)))
+ "")
+ (if (bluetooth-configuration-max-sniff-interval config)
+ (string-append
+ "\nMaxSniffInterval = "
+ (number->string (bluetooth-configuration-max-sniff-interval config)))
+ "")
+
+ "\n[LE]"
+ (if (bluetooth-configuration-min-advertisement-interval config)
+ (string-append
+ "\nMinAdvertisementInterval = "
+ (number->string (bluetooth-configuration-min-advertisement-interval config)))
+ "")
+ (if (bluetooth-configuration-max-advertisement-interval config)
+ (string-append
+ "\nMaxAdvertisementInterval = "
+ (number->string (bluetooth-configuration-max-advertisement-interval config)))
+ "")
+ (if (bluetooth-configuration-multi-advertisement-rotation-interval config)
+ (string-append
+ "\nMultiAdvertisementRotationInterval = "
+ (number->string
+ (bluetooth-configuration-multi-advertisement-rotation-interval config)))
+ "")
+ (if (bluetooth-configuration-scan-interval-auto-connect config)
+ (string-append
+ "\nScanIntervalAutoConnect = "
+ (number->string (bluetooth-configuration-scan-interval-auto-connect config)))
+ "")
+ (if (bluetooth-configuration-scan-window-auto-connect config)
+ (string-append
+ "\nScanWindowAutoConnect = "
+ (number->string (bluetooth-configuration-scan-window-auto-connect config)))
+ "")
+ (if (bluetooth-configuration-scan-interval-suspend config)
+ (string-append
+ "\nScanIntervalSuspend = "
+ (number->string (bluetooth-configuration-scan-interval-suspend config)))
+ "")
+ (if (bluetooth-configuration-scan-window-suspend config)
+ (string-append
+ "\nScanWindowSuspend = "
+ (number->string (bluetooth-configuration-scan-window-suspend config)))
+ "")
+ (if (bluetooth-configuration-scan-interval-discovery config)
+ (string-append
+ "\nScanIntervalDiscovery = "
+ (number->string (bluetooth-configuration-scan-interval-discovery config)))
+ "")
+ (if (bluetooth-configuration-scan-window-discovery config)
+ (string-append
+ "\nScanWindowDiscovery = "
+ (number->string (bluetooth-configuration-scan-window-discovery config)))
+ "")
+ (if (bluetooth-configuration-scan-interval-adv-monitor config)
+ (string-append
+ "\nScanIntervalAdvMonitor = "
+ (number->string (bluetooth-configuration-scan-interval-adv-monitor config)))
+ "")
+ (if (bluetooth-configuration-scan-window-adv-monitor config)
+ (string-append
+ "\nScanWindowAdvMonitor = "
+ (number->string (bluetooth-configuration-scan-window-adv-monitor config)))
+ "")
+ (if (bluetooth-configuration-scan-interval-connect config)
+ (string-append
+ "\nScanIntervalConnect = "
+ (number->string (bluetooth-configuration-scan-interval-connect config)))
+ "")
+ (if (bluetooth-configuration-scan-window-connect config)
+ (string-append
+ "\nScanWindowConnect = "
+ (number->string (bluetooth-configuration-scan-window-connect config)))
+ "")
+ (if (bluetooth-configuration-min-connection-interval config)
+ (string-append
+ "\nMinConnectionInterval = "
+ (number->string (bluetooth-configuration-min-connection-interval config)))
+ "")
+ (if (bluetooth-configuration-max-connection-interval config)
+ (string-append
+ "\nMaxConnectionInterval = "
+ (number->string (bluetooth-configuration-max-connection-interval config)))
+ "")
+ (if (bluetooth-configuration-connection-latency config)
+ (string-append
+ "\nConnectionLatency = "
+ (number->string (bluetooth-configuration-connection-latency config)))
+ "")
+ (if (bluetooth-configuration-connection-supervision-timeout config)
+ (string-append
+ "\nConnectionSupervisionTimeout = "
+ (number->string (bluetooth-configuration-connection-supervision-timeout config)))
+ "")
+ (if (bluetooth-configuration-autoconnect-timeout config)
+ (string-append
+ "\nAutoconnecttimeout = "
+ (number->string (bluetooth-configuration-autoconnect-timeout config)))
+ "")
+ "\nAdvMonAllowlistScanDuration = " (number->string
+ (bluetooth-configuration-adv-mon-allowlist-scan-duration
+ config))
+ "\nAdvMonNoFilterScanDuration = " (number->string
+ (bluetooth-configuration-adv-mon-no-filter-scan-duration
+ config))
+ "\nEnableAdvMonInterleaveScan = " (number->string
+ (if (eq? #t
+ (bluetooth-configuration-enable-adv-mon-interleave-scan
+ config))
+ 1 0))
+
+ "\n[GATT]"
+ "\nCache = " (symbol->string (bluetooth-configuration-cache config))
+ "\nKeySize = " (number->string (bluetooth-configuration-key-size config))
+ "\nExchangeMTU = " (number->string (bluetooth-configuration-exchange-mtu config))
+ "\nChannels = " (number->string (bluetooth-configuration-att-channels config))
+
+ "\n[AVDTP]"
+ "\nSessionMode = " (symbol->string (bluetooth-configuration-session-mode config))
+ "\nStreamMode = " (symbol->string (bluetooth-configuration-stream-mode config))
+
+ "\n[Policy]"
+ (let ((uuids (bluetooth-configuration-reconnect-uuids config)))
+ (if (not (eq? '() uuids))
+ (string-append
+ "\nReconnectUUIDs = "
+ (string-join (map uuid->string uuids) ","))
+ ""))
+ "\nReconnectAttempts = " (number->string
+ (bluetooth-configuration-reconnect-attempts config))
+ "\nReconnectIntervals = " (string-join
+ (map number->string
+ (bluetooth-configuration-reconnect-intervals
+ config))
+ ",")
+ "\nAutoEnable = " (bool (bluetooth-configuration-auto-enable?
+ config))
+ "\nResumeDelay = " (number->string (bluetooth-configuration-resume-delay config))
+
+ "\n[AdvMon]"
+ "\nRSSISamplingPeriod = " (string-append
+ "0x"
+ (format #f "~2,'0x"
+ (bluetooth-configuration-rssi-sampling-period config)))))
(define (bluetooth-directory config)
(computed-file "etc-bluetooth"
--
2.34.0
Patch with applied fixed suggested by Liliana. This contains
documentation as well as implementation fixes if not stated otherwise.
Changes:
- Changed `bluetooth-configuration-class` to type number
- Changed `bluetooth-configuration-experimental` to `#f`/`#t`/list of
UUIDs
- Changed `bluetooth-configuration-enable-adv-mon-interleave-scan` to
boolean
- Changed `key-size` doc to `7 <= N <= 16`
- Changed `exchange-mtu` doc to `23 <= N <= 517`
- Changed `channels` doc to `2 <= N <= 5`
- Changed `bluetooth-configuration-reconnect-uuids` to list of UUIDs
- Changed `bluetooth-configuration-rssi-sampling-period` to type number
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#52470] [PATCH] services: bluetooth: Add missing config parameters
2021-12-19 16:41 ` Demis Balbach
@ 2022-02-05 10:22 ` Demis Balbach
2022-03-09 22:43 ` bug#52470: " Ludovic Courtès
1 sibling, 0 replies; 10+ messages in thread
From: Demis Balbach @ 2022-02-05 10:22 UTC (permalink / raw)
To: 52470
[-- Attachment #1: Type: text/plain, Size: 84 bytes --]
Any news on this?
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#52470: [PATCH] services: bluetooth: Add missing config parameters
2021-12-19 16:41 ` Demis Balbach
2022-02-05 10:22 ` Demis Balbach
@ 2022-03-09 22:43 ` Ludovic Courtès
1 sibling, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2022-03-09 22:43 UTC (permalink / raw)
To: Demis Balbach; +Cc: Josselin Poiret, Liliana Marie Prikler, 52470-done
Hi Demis,
Demis Balbach <db@minikn.xyz> skribis:
> ---
> doc/guix.texi | 443 ++++++++++++++++++++++++++++++++++++++-
> gnu/services/desktop.scm | 375 ++++++++++++++++++++++++++++++++-
> 2 files changed, 813 insertions(+), 5 deletions(-)
Great job!
I haven’t tested it with actual Bluetooth hardware but it LGTM, so I
went ahead and committed it. Apologies for the delay!
The documentation work is much welcome. Perhaps it would be interesting
to add a short example of ‘bluetooth-configuration’ with a sentence
explaining what it does—it’s often easier to get started with an
example.
Anyway, thank you for the hard work, and thanks Liliana and Josselin for
reviewing!
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-03-09 22:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-13 19:20 [bug#52470] [PATCH] services: bluetooth: Add missing config parameters Demis Balbach
2021-12-13 19:36 ` Demis Balbach
2021-12-14 13:03 ` Josselin Poiret via Guix-patches via
2021-12-14 14:51 ` Demis Balbach
2021-12-14 20:50 ` Demis Balbach
2021-12-19 13:11 ` Demis Balbach
2021-12-19 13:19 ` Demis Balbach
2021-12-19 16:41 ` Demis Balbach
2022-02-05 10:22 ` Demis Balbach
2022-03-09 22:43 ` bug#52470: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).