From 1799c072ffbd2ae5d8725b7626d3693c0915da12 Mon Sep 17 00:00:00 2001 From: Yannick Ulrich Date: Sun, 26 Feb 2023 19:08:35 +0000 Subject: [PATCH] Added one-shot converter for strings --- fuse.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fuse.go b/fuse.go index d4c141a..3dc1ec1 100644 --- a/fuse.go +++ b/fuse.go @@ -88,6 +88,13 @@ func converterMotionValues(ctx context.Context, in <-chan infinitime.MotionValue return out } +func converter1String(ctx context.Context, in string) <-chan []byte { + out := make(chan []byte, 2) + out <- []byte(in + "\n") + close(out) + return out +} + type ITProperty struct { name string Ino uint64 @@ -619,6 +626,14 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error { ans, err := dev.WatchStepCount(ctx) return converterU32(ctx, ans), err } + properties[4].gen = func(ctx context.Context) (<-chan []byte, error) { + ans, err := dev.Version() + return converter1String(ctx, ans), err + } + properties[5].gen = func(ctx context.Context) (<-chan []byte, error) { + ans := dev.Address() + return converter1String(ctx, ans), nil + } myfs, err = dev.FS() if err != nil {