hanwen / go-mtpfs

Mount MTP devices over FUSE
Other
683 stars 85 forks source link

Not able to list the devices. #150

Closed ganeshrvel closed 4 years ago

ganeshrvel commented 4 years ago

I am using macOS and I am trying to write code to access my android phone.

I installed pkg-config and libusb via homebrew

My code:

package main

import "github.com/hanwen/go-mtpfs/mtp"
import "github.com/hanwen/usb"

func main() {
    usbContext := usb.NewContext()

    device, err := mtp.FindDevices(usbContext)

    println("error: ", err)

    if err != nil {
        println(device)
    }
}

it outputs: error: (0x0,0x0)

What am I doing wrong here? I am trying to write a portable mtp application using go-mtpfs.

hanwen commented 4 years ago

https://play.golang.org/p/Qcx2Age8kfH - (0x0,0x0) means that the error is nil, ie. there is no error.

It looks like you have little experience writing Go. I recommend learning the language fully first.

ganeshrvel commented 4 years ago

@hanwen hey, I am yeah still trying to figure out golang. I am sure that I can pick it up.

I am trying to write an app to access the MTP devices. There isn't much code samples out there. Are there any resources or codes that I could use to understand how to get some basic things done?

Like list MTP devices, select a device, get storage, copy files etc.. ?

It had be a great help.

Thanks

hanwen commented 4 years ago

once you are fluent and understand Go, you could look at the source code of go-mtpfs. I'm not sure if it works on OSX, though.

ganeshrvel commented 4 years ago

Oho, is there any go-mtpfs port for macos? Is there a reason why it's still not supported?

I am actually looking a replacement for libmtp and thought that go-mtpfs could help

hanwen commented 4 years ago

i've heard of people using it on osx, but I don't have a mac myself, so I can't vouch for it.