Added FUSE support #55

Merged
Elara6331 merged 65 commits from yannickulrich/itd:fuse into master 2023-03-25 22:23:52 +00:00
Showing only changes of commit 1799c072ff - Show all commits

15
fuse.go
View File

@ -88,6 +88,13 @@ func converterMotionValues(ctx context.Context, in <-chan infinitime.MotionValue
return out 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 { type ITProperty struct {
name string name string
Ino uint64 Ino uint64
@ -619,6 +626,14 @@ func startFuse(ctx context.Context, dev *infinitime.Device) error {
ans, err := dev.WatchStepCount(ctx) ans, err := dev.WatchStepCount(ctx)
return converterU32(ctx, ans), err 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() myfs, err = dev.FS()
if err != nil { if err != nil {