Turned generator to return []byte
This commit is contained in:
parent
e2bd52b5a0
commit
c046c67dbd
7
fuse.go
7
fuse.go
@ -47,7 +47,7 @@ func (i Device) VersionBytes() ([]byte, error) {
|
|||||||
type ITProperty struct {
|
type ITProperty struct {
|
||||||
name string
|
name string
|
||||||
Ino uint64
|
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 {
|
type sensorFileReadHandle struct {
|
||||||
ch <-chan uint8
|
ch <-chan []byte
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
}
|
}
|
||||||
var _ = (fs.FileReader)((*sensorFileReadHandle)(nil))
|
var _ = (fs.FileReader)((*sensorFileReadHandle)(nil))
|
||||||
func (fh *sensorFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
func (fh *sensorFileReadHandle) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno) {
|
||||||
v := <-fh.ch
|
content := <-fh.ch
|
||||||
content := []byte(strconv.Itoa(int(v)) + "\n")
|
|
||||||
return fuse.ReadResultData(content), 0
|
return fuse.ReadResultData(content), 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user