Subject: Re: [bug#52470] [PATCH] services: bluetooth: Add missing config parameters

From: Josselin Poiret <[email-masked]>
Date: Tue, 14 Dec 2021 14:03:14 +0100

Hello,

Demis Balbach <[email-masked]> 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