Permalink
Browse files

Add DeviceFs(MODEL) as identifier.

  • Loading branch information...
1 parent cedfc3f commit faf06063dcf4658bacd7405246094de06276b22f @hanwen committed May 30, 2012
Showing with 12 additions and 0 deletions.
  1. +5 −0 fs.go
  2. +7 −0 mtp.go
View
5 fs.go
@@ -5,6 +5,7 @@
package main
import (
+ "fmt"
"github.com/hanwen/go-fuse/fuse"
"io/ioutil"
"log"
@@ -45,6 +46,10 @@ func (fs *DeviceFs) Root() fuse.FsNode {
return fs.root
}
+func (fs *DeviceFs) String() string {
+ return fmt.Sprintf("DeviceFs(%s)", fs.dev.ModelName())
+}
+
func (fs *DeviceFs) statFs() *fuse.StatfsOut {
total := uint64(0)
free := uint64(0)
View
7 mtp.go
@@ -196,6 +196,13 @@ func (d *Device) SendFromFileDescriptor(file *File, fd uintptr) error {
return nil
}
+func (d *Device) ModelName() (name string) {
+ cname := C.LIBMTP_Get_Modelname(d.me())
+ name = C.GoString(cname)
+ C.free(unsafe.Pointer(cname))
+ return name
+}
+
func (d *Device) CreateFolder(parent uint32, name string, storage uint32) (uint32, error) {
cname := C.CString(name)
id := C.LIBMTP_Create_Folder(d.me(), cname, C.uint32_t(parent), C.uint32_t(storage))

0 comments on commit faf0606

Please sign in to comment.