Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the macos LIBUSB_ERROR_NOT_FOUND bug #152

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -eux

for x in fs mtp
do
go build github.com/hanwen/go-mtpfs/$x
go test -i github.com/hanwen/go-mtpfs/$x
go test github.com/hanwen/go-mtpfs/$x
go build github.com/ganeshrvel/go-mtpfs/$x
go test -i github.com/ganeshrvel/go-mtpfs/$x
go test github.com/ganeshrvel/go-mtpfs/$x
done

go build github.com/hanwen/go-mtpfs
2 changes: 1 addition & 1 deletion fs/classic.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-mtpfs/mtp"
"github.com/ganeshrvel/go-mtpfs/mtp"
)

type classicNode struct {
Expand Down
2 changes: 1 addition & 1 deletion fs/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-mtpfs/mtp"
"github.com/ganeshrvel/go-mtpfs/mtp"
)

// VerboseTest returns true if the testing framework is run with -v.
Expand Down
2 changes: 1 addition & 1 deletion fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-mtpfs/mtp"
"github.com/ganeshrvel/go-mtpfs/mtp"
)

const blockSize = 512
Expand Down
2 changes: 1 addition & 1 deletion fs/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"regexp"

"github.com/hanwen/go-mtpfs/mtp"
"github.com/ganeshrvel/go-mtpfs/mtp"
)

func SelectStorages(dev *mtp.Device, pat string) ([]uint32, error) {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module github.com/hanwen/go-mtpfs
module github.com/ganeshrvel/go-mtpfs

go 1.12

require (
github.com/hanwen/go-fuse v1.0.0
github.com/hanwen/go-fuse/v2 v2.0.2
github.com/hanwen/usb v0.0.0-20141217151552-69aee4530ac7
github.com/kylelemons/godebug v1.1.0 // indirect
Expand Down
5 changes: 1 addition & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
github.com/hanwen/go-fuse v0.0.0-20190726130028-2f298055551b h1:oUwn+w6XmXlah84XM7iSqKcr6ojbKUED0o4JVpGW7n4=
github.com/hanwen/go-fuse v0.0.0-20190726130028-2f298055551b/go.mod h1:PHVWttMW0DYH6ESFXdZ8S+STmGjwEuGX6gsCPi605mg=
github.com/hanwen/go-fuse v1.0.0 h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=
github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok=
github.com/hanwen/go-fuse/v2 v2.0.1 h1:ZqWzfYbVQe/xSDDFNqW9Ivl+AwWt+t0/5lWLhbroJTM=
github.com/hanwen/go-fuse/v2 v2.0.1/go.mod h1:OT5e1HOVxxQyq/qgsYpObejwriAgou9DURqOpiGxWfI=
github.com/hanwen/go-fuse/v2 v2.0.2 h1:BtsqKI5RXOqDMnTgpCb0IWgvRgGLJdqYVZ/Hm6KgKto=
github.com/hanwen/go-fuse/v2 v2.0.2/go.mod h1:HH3ygZOoyRbP9y2q7y3+JM6hPL+Epe29IbWaS0UA81o=
github.com/hanwen/usb v0.0.0-20141217151552-69aee4530ac7 h1:fJ8PRDCj5Fa3oEwweff/QaCGUYjLjGUmCgeOUT+JkJM=
github.com/hanwen/usb v0.0.0-20141217151552-69aee4530ac7/go.mod h1:yF/X+HyjXB5nFLDk2wr03cx0BRaFJ7iaAPFGRaKnwEk=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

fusefs "github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/hanwen/go-mtpfs/fs"
"github.com/hanwen/go-mtpfs/mtp"
"github.com/ganeshrvel/go-mtpfs/fs"
"github.com/ganeshrvel/go-mtpfs/mtp"
)

func main() {
Expand Down
6 changes: 4 additions & 2 deletions mtp/mtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ func (d *Device) Open() error {
return err
}

d.claim()

if d.ifaceDescr.InterfaceStringIndex == 0 {
// Some of the win8phones have no interface field.
info := DeviceInfo{}
Expand All @@ -162,13 +164,13 @@ func (d *Device) Open() error {
return err
}

if !strings.Contains(iface, "MTP") {
// support for older samsung phones
if !strings.Contains(iface, "MTP") && !strings.Contains(iface, "CDC") && !strings.Contains(iface, "ACM") {
d.Close()
return fmt.Errorf("has no MTP in interface string")
}
}

d.claim()
return nil
}

Expand Down