From c046c67dbda07e54f6844509267961b1bf7039bb Mon Sep 17 00:00:00 2001 From: Yannick Ulrich Date: Sun, 26 Feb 2023 19:07:09 +0000 Subject: [PATCH] Turned generator to return []byte --- fuse.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fuse.go b/fuse.go index 9c128f0..32d2a98 100644 --- a/fuse.go +++ b/fuse.go @@ -47,7 +47,7 @@ func (i Device) VersionBytes() ([]byte, error) { type ITProperty struct { name string Ino uint64 - gen func(context.Context) (<-chan uint8, error) + gen func(context.Context) (<-chan []byte, error) } @@ -247,13 +247,12 @@ func (fh *bytesFileReadHandle) Read(ctx context.Context, dest []byte, off int64) } type sensorFileReadHandle struct { - ch <-chan uint8 + ch <-chan []byte cancel context.CancelFunc } var _ = (fs.FileReader)((*sensorFileReadHandle)(nil)) func (fh *sensorFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) { - v := <-fh.ch - content := []byte(strconv.Itoa(int(v)) + "\n") + content := <-fh.ch return fuse.ReadResultData(content), 0 }