summaryrefslogtreecommitdiff
path: root/px/services/bluetooth.scm
diff options
context:
space:
mode:
authorFranz Geffke <franz@pantherx.org>2023-11-06 20:08:14 +0000
committerFranz Geffke <franz@pantherx.org>2023-11-06 20:08:14 +0000
commit47b4c9c854915df93893dbaa993accfacf9027fe (patch)
tree4f9b1742d63fcfbc94cc6b8d84f76c4d00c3a0b7 /px/services/bluetooth.scm
parent0b426d7b7ed8e176bf464ef9e0683f74a6c9d20f (diff)
rewrite: apply guix-reference formatting; cleanup some module imports
Diffstat (limited to 'px/services/bluetooth.scm')
-rw-r--r--px/services/bluetooth.scm132
1 files changed, 74 insertions, 58 deletions
diff --git a/px/services/bluetooth.scm b/px/services/bluetooth.scm
index d8953df..ce72f31 100644
--- a/px/services/bluetooth.scm
+++ b/px/services/bluetooth.scm
@@ -19,9 +19,8 @@
#:use-module (ice-9 match)
#:use-module (ice-9 pretty-print)
- #:export (btuart-configuration
+ #:export (btuart-configuration
btuart-service-type
-
bluetooth-client-manager-configuration
bluetooth-client-manager-service-type))
@@ -29,13 +28,14 @@
;; btuart-service-type
;;
-(define-record-type* <btuart-configuration>
- btuart-configuration make-btuart-configuration
+(define-record-type* <btuart-configuration> btuart-configuration
+ make-btuart-configuration
btuart-configuration?
- (package btuart-configuration-package
- (default bluez))
- (device btuart-configuration-device
- (default "/dev/ttyAMA0"))
+ (package
+ btuart-configuration-package
+ (default bluez))
+ (device btuart-configuration-device
+ (default "/dev/ttyAMA0"))
(protocol btuart-configuration-protocol
(default "bcm"))
(baudrate btuart-configuration-baudrate
@@ -43,72 +43,88 @@
(flow-control? btuart-configuration-flow-control?
(default #t)))
-
(define btuart-shepherd-service
(match-lambda
- (($ <btuart-configuration> package device protocol baudrate flow-control?)
- (list
- (shepherd-service
- (documentation "attach serial lines as Bluetooth HCI interfaces")
- (provision '(btuart))
- (requirement '(udev))
- (start #~(make-forkexec-constructor
- (list #$(file-append package "/bin/btattach")
- "-B" #$device "-P" #$protocol
- "-S" #$baudrate
- (when #$flow-control? "-N"))))
- (one-shot? #t))))))
-
+ (($ <btuart-configuration>
+ package
+ device
+ protocol
+ baudrate
+ flow-control?)
+ (list (shepherd-service (documentation
+ "attach serial lines as Bluetooth HCI interfaces")
+ (provision '(btuart))
+ (requirement '(udev))
+ (start #~(make-forkexec-constructor (list #$(file-append
+ package
+ "/bin/btattach")
+ "-B"
+ #$device
+ "-P"
+ #$protocol
+ "-S"
+ #$baudrate
+ (when #$flow-control?
+ "-N"))))
+ (one-shot? #t))))))
(define btuart-service-type
- (service-type
- (name 'btuart)
- (extensions (list (service-extension shepherd-root-service-type
- btuart-shepherd-service)))
- (default-value (btuart-configuration))
- (description "Attach serial lines as Bluetooth HCI interfaces")))
+ (service-type (name 'btuart)
+ (extensions (list (service-extension
+ shepherd-root-service-type
+ btuart-shepherd-service)))
+ (default-value (btuart-configuration))
+ (description "Attach serial lines as Bluetooth HCI interfaces")))
;;
;; bluetooth-client-manager-service
;;
(define-record-type* <bluetooth-client-manager-configuration>
- bluetooth-client-manager-configuration make-bluetooth-client-manager-configuration
+ bluetooth-client-manager-configuration
+ make-bluetooth-client-manager-configuration
bluetooth-client-manager-configuration?
- (package bluetooth-client-manager-configuration-package
- (default bluetooth-client-manager-service))
- (debug? bluetooth-client-manager-configuration-debug?
- (default #f))
+ (package
+ bluetooth-client-manager-configuration-package
+ (default bluetooth-client-manager-service))
+ (debug? bluetooth-client-manager-configuration-debug?
+ (default #f))
(skip-approval? bluetooth-client-manager-configuration-skip-approval?
(default #f)))
-
(define bluetooth-client-manager-shepherd-service
(match-lambda
(($ <bluetooth-client-manager-configuration> package debug? skip-approval?)
- (list (shepherd-service
- (provision '(bluetooth-client-manager-service))
- (documentation "Run px-device-identity-service as a daemon")
- (requirement '(networking user-processes px-device-identity))
- (start #~(make-forkexec-constructor
- (list (string-append #$package "/bin/bluetooth-client-manager-service")
- #$@(if debug? '("--verbose") '())
- #$@(if skip-approval? '("--skip-approval") '()))
- #:log-file "/var/log/bluetooth-client-manager-service.log"
- #:environment-variables
- (cons* "HOME=/root"
- "XDG_DATA_HOME=/root/.local/share"
- "XDG_CONFIG_HOME=/root/.config"
- "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs"
- "SSL_CERT_FILE=/run/current-system/profile/etc/ssl/certs/ca-certificates.crt"
- (default-environment-variables))))
- (stop #~(make-kill-destructor)))))))
-
+ (list (shepherd-service (provision '(bluetooth-client-manager-service))
+ (documentation
+ "Run px-device-identity-service as a daemon")
+ (requirement '(networking user-processes
+ px-device-identity))
+ (start #~(make-forkexec-constructor (list (string-append #$package
+ "/bin/bluetooth-client-manager-service")
+ #$@(if
+ debug?
+ '("--verbose")
+ '())
+ #$@(if
+ skip-approval?
+ '("--skip-approval")
+ '()))
+ #:log-file
+ "/var/log/bluetooth-client-manager-service.log"
+ #:environment-variables (cons*
+ "HOME=/root"
+ "XDG_DATA_HOME=/root/.local/share"
+ "XDG_CONFIG_HOME=/root/.config"
+ "SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs"
+ "SSL_CERT_FILE=/run/current-system/profile/etc/ssl/certs/ca-certificates.crt"
+ (default-environment-variables))))
+ (stop #~(make-kill-destructor)))))))
(define bluetooth-client-manager-service-type
- (service-type
- (name 'bluetooth-client-manager-service)
- (description "PantherX Bluetooth Client Manager service")
- (extensions (list (service-extension shepherd-root-service-type
- bluetooth-client-manager-shepherd-service)))
- (default-value (bluetooth-client-manager-configuration))))
+ (service-type (name 'bluetooth-client-manager-service)
+ (description "PantherX Bluetooth Client Manager service")
+ (extensions (list (service-extension
+ shepherd-root-service-type
+ bluetooth-client-manager-shepherd-service)))
+ (default-value (bluetooth-client-manager-configuration))))