hanwen / go-mtpfs

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

Can't connect on macOS: LIBUSB_ERROR_NOT_FOUND #121

Open wesleym opened 7 years ago

wesleym commented 7 years ago

I built go-mtpfs from source but can't make it connect to my phone.

$ go install
$ $GOPATH/bin/go-mtpfs ~/mtp
2016/12/16 12:22:48 fatal error LIBUSB_ERROR_NOT_FOUND; closing connection.
2016/12/16 12:22:48 mount failed: no FUSE devices found

The debug output seems to show some MTP communication. The DeviceInfo retrieved doesn't seem obviously wrong. It's not clear why LIBUSB_ERROR_NOT_FOUND is printed first though.

$ $GOPATH/bin/go-mtpfs -debug usb,data,mtp,fuse ~/mtp
2016/12/16 12:24:41 fatal error LIBUSB_ERROR_NOT_FOUND; closing connection.
2016/12/16 12:24:41 MTP request OpenSession [781159543]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0210 0000 0000 778c 8f2e  ............w...
recv: 0x10 bytes with ep 0x81:
0000: 1000 0000 0300 1e20 0000 0000 5f13 c14a  ....... ...._..J
2016/12/16 12:24:41 MTP response SessionAlreadyOpened [1254167391]
2016/12/16 12:24:41 MTP request CloseSession []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0310 0000 0000            ............
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0000 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP request OpenSession [1127230799]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0210 0000 0000 4f2d 3043  ............O-0C
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0000 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP request GetStorageIDs []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0410 0100 0000            ............
recv: 0x14 bytes with ep 0x81:
0000: 1400 0000 0200 0410 0100 0000 0100 0000  ................
0010: 0100 0100                                ....
2016/12/16 12:24:41 MTP data 0x14 bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0100 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP decoded &mtp.Uint32Array{Values:[]uint32{0x10001}}
2016/12/16 12:24:41 MTP request GetStorageInfo [65537]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0510 0200 0000 0100 0100  ................
recv: 0x78 bytes with ep 0x81:
0000: 7800 0000 0200 0510 0200 0000 0300 0200  x...............
0010: 0000 00b0 43d1 0d00 0000 0000 0055 0d00  ....C........U..
0020: 0000 0000 0040 1149 006e 0074 0065 0072  .....@.I.n.t.e.r
0030: 006e 0061 006c 0020 0073 0074 006f 0072  .n.a.l. .s.t.o.r
0040: 0061 0067 0065 0000 0017 2300 2300 7300  .a.g.e....#.#.s.
0050: 7400 6f00 7200 6100 6700 6500 2300 2300  t.o.r.a.g.e.#.#.
0060: 6500 6d00 7500 6c00 6100 7400 6500 6400  e.m.u.l.a.t.e.d.
0070: 2300 2300 3000 0000                      #.#.0...
2016/12/16 12:24:41 MTP data 0x78 bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0200 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0xdd143b000, FreeSpaceInBytes:0xd55000000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:"##storage##emulated##0"}
2016/12/16 12:24:41 MTP request GetDeviceInfo []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0110 0300 0000            ............
recv: 0x153 bytes with ep 0x81:
0000: 5301 0000 0200 0110 0300 0000 6400 0600  S...........d...
0010: 0000 6400 266d 0069 0063 0072 006f 0073  ..d.&m.i.c.r.o.s
0020: 006f 0066 0074 002e 0063 006f 006d 003a  .o.f.t...c.o.m.:
0030: 0020 0031 002e 0030 003b 0020 0061 006e  . .1...0.;. .a.n
0040: 0064 0072 006f 0069 0064 002e 0063 006f  .d.r.o.i.d...c.o
0050: 006d 003a 0020 0031 002e 0030 003b 0000  .m.:. .1...0.;..
0060: 0000 001e 0000 0001 1002 1003 1004 1005  ................
0070: 1006 1007 1008 1009 100a 100b 100c 100d  ................
0080: 1014 1015 1016 1017 101b 1001 9802 9803  ................
0090: 9804 9805 9811 98c1 95c2 95c3 95c4 95c5  ................
00a0: 95f0 9604 0000 0002 4003 4004 4005 4003  ........@.@.@.@.
00b0: 0000 0001 d402 d403 5000 0000 0020 0000  ........P.... ..
00c0: 0000 3001 3004 3005 3008 3009 300b 3001  ..0.0.0.0.0.0.0.
00d0: 3802 3804 3807 3808 380b 380d 3801 b902  8.8.8.8.8.8.8...
00e0: b903 b982 b983 b984 b905 ba10 ba11 ba14  ................
00f0: ba82 ba06 b981 b90a 300c 3083 ba85 ba86  ........0.0.....
0100: ba04 4800 5400 4300 0000 0b48 0054 0043  ..H.T.C....H.T.C
0110: 0020 004f 006e 0065 0020 0058 002b 0000  . .O.n.e. .X.+..
0120: 000b 3200 2e00 3100 3800 2e00 3400 3000  ..2...1.8...4.0.
0130: 3100 2e00 3300 0000 0d46 0041 0032 0043  1...3....F.A.2.C
0140: 0056 0057 0031 0030 0033 0033 0037 0038  .V.W.1.0.3.3.7.8
0150: 0000 00                                  ...
2016/12/16 12:24:41 MTP data 0x153 bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0300 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP decoded &mtp.DeviceInfo{StandardVersion:0x64, MTPVendorExtensionID:0x6, MTPVersion:0x64, MTPExtension:"microsoft.com: 1.0; android.com: 1.0;", FunctionalMode:0x0, OperationsSupported:[]uint16{0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x1014, 0x1015, 0x1016, 0x1017, 0x101b, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9811, 0x95c1, 0x95c2, 0x95c3, 0x95c4, 0x95c5, 0x96f0}, EventsSupported:[]uint16{0x4002, 0x4003, 0x4004, 0x4005}, DevicePropertiesSupported:[]uint16{0xd401, 0xd402, 0x5003}, CaptureFormats:[]uint16{}, PlaybackFormats:[]uint16{0x3000, 0x3001, 0x3004, 0x3005, 0x3008, 0x3009, 0x300b, 0x3801, 0x3802, 0x3804, 0x3807, 0x3808, 0x380b, 0x380d, 0xb901, 0xb902, 0xb903, 0xb982, 0xb983, 0xb984, 0xba05, 0xba10, 0xba11, 0xba14, 0xba82, 0xb906, 0xb981, 0x300a, 0x300c, 0xba83, 0xba85, 0xba86}, Manufacturer:"HTC", Model:"HTC One X+", DeviceVersion:"2.18.401.3", SerialNumber:"FA2CVW103378"}
2016/12/16 12:24:41 MTP request GetStorageInfo [65537]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0510 0400 0000 0100 0100  ................
recv: 0x78 bytes with ep 0x81:
0000: 7800 0000 0200 0510 0400 0000 0300 0200  x...............
0010: 0000 00b0 43d1 0d00 0000 0000 0055 0d00  ....C........U..
0020: 0000 0000 0040 1149 006e 0074 0065 0072  .....@.I.n.t.e.r
0030: 006e 0061 006c 0020 0073 0074 006f 0072  .n.a.l. .s.t.o.r
0040: 0061 0067 0065 0000 0017 2300 2300 7300  .a.g.e....#.#.s.
0050: 7400 6f00 7200 6100 6700 6500 2300 2300  t.o.r.a.g.e.#.#.
0060: 6500 6d00 7500 6c00 6100 7400 6500 6400  e.m.u.l.a.t.e.d.
0070: 2300 2300 3000 0000                      #.#.0...
2016/12/16 12:24:41 MTP data 0x78 bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0400 0000            ....... ....
2016/12/16 12:24:41 MTP response OK []
2016/12/16 12:24:41 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0xdd143b000, FreeSpaceInBytes:0xd55000000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:"##storage##emulated##0"}
2016/12/16 12:24:41 mount failed: no FUSE devices found

Hardware

MacBook Pro (Retina, 15-inch, Mid 2015); MacBookPro11,5 HTC One X+

Versions

go-mtpfs: bc7c0f7 go-fuse: 6c2b7d8 usb: 69aee45

libusb: from Homebrew, described as: stable 1.0.20 (bottled), HEAD FUSE for macOS: 3.5.4, installed without MacFUSE compatibility layer

macOS 10.12.2 Android 4.2.2

dmaclach commented 7 years ago

I hit the same issue

macOS 10.12.5

bin/go-mtpfs -debug usb,data,mtp,fuse xoom
2017/06/30 09:28:52 fatal error LIBUSB_ERROR_NOT_FOUND; closing connection.
2017/06/30 09:28:52 MTP request OpenSession [726241119]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0210 0000 0000 5f8f 492b  ............_.I+
recv: 0x10 bytes with ep 0x81:
0000: 1000 0000 0300 1e20 0000 0000 c7f2 3424  ....... ......4$
2017/06/30 09:28:52 MTP response SessionAlreadyOpened [607449799]
2017/06/30 09:28:52 MTP request CloseSession []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0310 0000 0000            ............
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0000 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP request OpenSession [1615948533]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0210 0000 0000 f56a 5160  .............jQ`
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0000 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP request GetStorageIDs []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0410 0100 0000            ............
recv: 0x14 bytes with ep 0x81:
0000: 1400 0000 0200 0410 0100 0000 0100 0000  ................
0010: 0100 0100                                ....
2017/06/30 09:28:52 MTP data 0x14 bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0100 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP decoded &mtp.Uint32Array{Values:[]uint32{0x10001}}
2017/06/30 09:28:52 MTP request GetStorageInfo [65537]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0510 0200 0000 0100 0100  ................
recv: 0x4a bytes with ep 0x81:
0000: 4a00 0000 0200 0510 0200 0000 0300 0200  J...............
0010: 0000 00f0 5a23 0300 0000 00e0 5f7d 0000  ....Z#......_}..
0020: 0000 0000 0040 1149 006e 0074 0065 0072  .....@.I.n.t.e.r
0030: 006e 0061 006c 0020 0073 0074 006f 0072  .n.a.l. .s.t.o.r
0040: 0061 0067 0065 0000 0000                 .a.g.e....
2017/06/30 09:28:52 MTP data 0x4a bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0200 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0x3235af000, FreeSpaceInBytes:0x7d5fe000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:""}
2017/06/30 09:28:52 MTP request GetDeviceInfo []
send: 0xc bytes with ep 0x1:
0000: 0c00 0000 0100 0110 0300 0000            ............
recv: 0x13f bytes with ep 0x81:
0000: 3f01 0000 0200 0110 0300 0000 6400 0600  ?...........d...
0010: 0000 6400 266d 0069 0063 0072 006f 0073  ..d.&m.i.c.r.o.s
0020: 006f 0066 0074 002e 0063 006f 006d 003a  .o.f.t...c.o.m.:
0030: 0020 0031 002e 0030 003b 0020 0061 006e  . .1...0.;. .a.n
0040: 0064 0072 006f 0069 0064 002e 0063 006f  .d.r.o.i.d...c.o
0050: 006d 003a 0020 0031 002e 0030 003b 0000  .m.:. .1...0.;..
0060: 0000 001e 0000 0001 1002 1003 1004 1005  ................
0070: 1006 1007 1008 1009 100a 100b 100c 100d  ................
0080: 1014 1015 1016 1017 101b 1001 9802 9803  ................
0090: 9804 9805 9810 9811 98c1 95c2 95c3 95c4  ................
00a0: 95c5 9505 0000 0002 4003 4004 4005 4006  ........@.@.@.@.
00b0: 4004 0000 0001 d402 d403 5001 5000 0000  @.........P.P...
00c0: 001a 0000 0000 3001 3004 3005 3008 3009  ......0.0.0.0.0.
00d0: 300b 3001 3802 3804 3807 3808 380b 380d  0.0.8.8.8.8.8.8.
00e0: 3801 b902 b903 b982 b983 b984 b905 ba10  8...............
00f0: ba11 ba14 ba82 ba06 b904 4c00 4700 4500  ..........L.G.E.
0100: 0000 084e 0065 0078 0075 0073 0020 0035  ...N.e.x.u.s. .5
0110: 0000 0004 3100 2e00 3000 0000 1130 0034  ....1...0....0.4
0120: 0061 0064 0033 0039 0039 0038 0066 0030  .a.d.3.9.9.8.f.0
0130: 0063 0037 0034 0062 0061 0030 0000 00    .c.7.4.b.a.0...
2017/06/30 09:28:52 MTP data 0x13f bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0300 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP decoded &mtp.DeviceInfo{StandardVersion:0x64, MTPVendorExtensionID:0x6, MTPVersion:0x64, MTPExtension:"microsoft.com: 1.0; android.com: 1.0;", FunctionalMode:0x0, OperationsSupported:[]uint16{0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x1014, 0x1015, 0x1016, 0x1017, 0x101b, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9810, 0x9811, 0x95c1, 0x95c2, 0x95c3, 0x95c4, 0x95c5}, EventsSupported:[]uint16{0x4002, 0x4003, 0x4004, 0x4005, 0x4006}, DevicePropertiesSupported:[]uint16{0xd401, 0xd402, 0x5003, 0x5001}, CaptureFormats:[]uint16{}, PlaybackFormats:[]uint16{0x3000, 0x3001, 0x3004, 0x3005, 0x3008, 0x3009, 0x300b, 0x3801, 0x3802, 0x3804, 0x3807, 0x3808, 0x380b, 0x380d, 0xb901, 0xb902, 0xb903, 0xb982, 0xb983, 0xb984, 0xba05, 0xba10, 0xba11, 0xba14, 0xba82, 0xb906}, Manufacturer:"LGE", Model:"Nexus 5", DeviceVersion:"1.0", SerialNumber:"04ad3998f0c74ba0"}
2017/06/30 09:28:52 MTP request GetStorageInfo [65537]
send: 0x10 bytes with ep 0x1:
0000: 1000 0000 0100 0510 0400 0000 0100 0100  ................
recv: 0x4a bytes with ep 0x81:
0000: 4a00 0000 0200 0510 0400 0000 0300 0200  J...............
0010: 0000 00f0 5a23 0300 0000 00e0 5f7d 0000  ....Z#......_}..
0020: 0000 0000 0040 1149 006e 0074 0065 0072  .....@.I.n.t.e.r
0030: 006e 0061 006c 0020 0073 0074 006f 0072  .n.a.l. .s.t.o.r
0040: 0061 0067 0065 0000 0000                 .a.g.e....
2017/06/30 09:28:52 MTP data 0x4a bytes
recv: 0xc bytes with ep 0x81:
0000: 0c00 0000 0300 0120 0400 0000            ....... ....
2017/06/30 09:28:52 MTP response OK []
2017/06/30 09:28:52 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0x3235af000, FreeSpaceInBytes:0x7d5fe000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:""}
2017/06/30 09:28:52 mount failed: no FUSE devices found
dmaclach-macbookpro4:go dmaclach$ 
hanwen commented 7 years ago

I think this is the message if OSX FUSE is not isntalled. Can you confirm that you have some FUSE FS mounted?

superbeef150 commented 7 years ago

Having similar symptoms here. 2010 MacBook OSX 10.11.6

Looks like the same output before/after installing OSX FUSE using osxfuse-3.6.3.dmg from their site, here's what I got after installing and rebooting:

./go-mtpfs -debug usb,data,mtp,fuse n7 2017/08/16 13:46:31 fatal error LIBUSB_ERROR_NOT_FOUND; closing connection. 2017/08/16 13:46:31 MTP request OpenSession [1661691511] send: 0x10 bytes with ep 0x2: 0000: 1000 0000 0100 0210 0000 0000 7766 0b63 ............wf.c recv: 0x10 bytes with ep 0x81: 0000: 1000 0000 0300 1e20 0000 0000 f93c c738 ....... .....<.8 2017/08/16 13:46:31 MTP response SessionAlreadyOpened [952581369] 2017/08/16 13:46:31 MTP request CloseSession [] send: 0xc bytes with ep 0x2: 0000: 0c00 0000 0100 0310 0000 0000 ............ recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0000 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP request OpenSession [890242095] send: 0x10 bytes with ep 0x2: 0000: 1000 0000 0100 0210 0000 0000 2f04 1035 ............/..5 recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0000 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP request GetStorageIDs [] send: 0xc bytes with ep 0x2: 0000: 0c00 0000 0100 0410 0100 0000 ............ recv: 0x14 bytes with ep 0x81: 0000: 1400 0000 0200 0410 0100 0000 0100 0000 ................ 0010: 0100 0100 .... 2017/08/16 13:46:31 MTP data 0x14 bytes recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0100 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP decoded &mtp.Uint32Array{Values:[]uint32{0x10001}} 2017/08/16 13:46:31 MTP request GetStorageInfo [65537] send: 0x10 bytes with ep 0x2: 0000: 1000 0000 0100 0510 0200 0000 0100 0100 ................ recv: 0x4a bytes with ep 0x81: 0000: 4a00 0000 0200 0510 0200 0000 0300 0200 J............... 0010: 0000 00f0 cde4 0600 0000 00d0 6ce0 0400 ............l... 0020: 0000 0000 0040 1149 006e 0074 0065 0072 .....@.I.n.t.e.r 0030: 006e 0061 006c 0020 0073 0074 006f 0072 .n.a.l. .s.t.o.r 0040: 0061 0067 0065 0000 0000 .a.g.e.... 2017/08/16 13:46:31 MTP data 0x4a bytes recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0200 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0x6e4cdf000, FreeSpaceInBytes:0x4e06cd000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:""} 2017/08/16 13:46:31 MTP request GetDeviceInfo [] send: 0xc bytes with ep 0x2: 0000: 0c00 0000 0100 0110 0300 0000 ............ recv: 0x141 bytes with ep 0x81: 0000: 4101 0000 0200 0110 0300 0000 6400 0600 A...........d... 0010: 0000 6400 266d 0069 0063 0072 006f 0073 ..d.&m.i.c.r.o.s 0020: 006f 0066 0074 002e 0063 006f 006d 003a .o.f.t...c.o.m.: 0030: 0020 0031 002e 0030 003b 0020 0061 006e . .1...0.;. .a.n 0040: 0064 0072 006f 0069 0064 002e 0063 006f .d.r.o.i.d...c.o 0050: 006d 003a 0020 0031 002e 0030 003b 0000 .m.:. .1...0.;.. 0060: 0000 001e 0000 0001 1002 1003 1004 1005 ................ 0070: 1006 1007 1008 1009 100a 100b 100c 100d ................ 0080: 1014 1015 1016 1017 101b 1001 9802 9803 ................ 0090: 9804 9805 9810 9811 98c1 95c2 95c3 95c4 ................ 00a0: 95c5 9505 0000 0002 4003 4004 4005 4006 ........@.@.@.@. 00b0: 4004 0000 0001 d402 d403 5001 5000 0000 @.........P.P... 00c0: 001a 0000 0000 3001 3004 3005 3008 3009 ......0.0.0.0.0. 00d0: 300b 3001 3802 3804 3807 3808 380b 380d 0.0.8.8.8.8.8.8. 00e0: 3801 b902 b903 b982 b983 b984 b905 ba10 8............... 00f0: ba11 ba14 ba82 ba06 b905 6100 7300 7500 ..........a.s.u. 0100: 7300 0000 084e 0065 0078 0075 0073 0020 s....N.e.x.u.s. 0110: 0037 0000 0004 3100 2e00 3000 0000 1130 .7....1...0....0 0120: 0031 0035 0064 0032 0036 0032 0065 0033 .1.5.d.2.6.2.e.3 0130: 0031 0030 0063 0031 0030 0031 0033 0000 .1.0.c.1.0.1.3.. 0140: 00 . 2017/08/16 13:46:31 MTP data 0x141 bytes recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0300 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP decoded &mtp.DeviceInfo{StandardVersion:0x64, MTPVendorExtensionID:0x6, MTPVersion:0x64, MTPExtension:"microsoft.com: 1.0; android.com: 1.0;", FunctionalMode:0x0, OperationsSupported:[]uint16{0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x1014, 0x1015, 0x1016, 0x1017, 0x101b, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9810, 0x9811, 0x95c1, 0x95c2, 0x95c3, 0x95c4, 0x95c5}, EventsSupported:[]uint16{0x4002, 0x4003, 0x4004, 0x4005, 0x4006}, DevicePropertiesSupported:[]uint16{0xd401, 0xd402, 0x5003, 0x5001}, CaptureFormats:[]uint16{}, PlaybackFormats:[]uint16{0x3000, 0x3001, 0x3004, 0x3005, 0x3008, 0x3009, 0x300b, 0x3801, 0x3802, 0x3804, 0x3807, 0x3808, 0x380b, 0x380d, 0xb901, 0xb902, 0xb903, 0xb982, 0xb983, 0xb984, 0xba05, 0xba10, 0xba11, 0xba14, 0xba82, 0xb906}, Manufacturer:"asus", Model:"Nexus 7", DeviceVersion:"1.0", SerialNumber:"015d262e310c1013"} 2017/08/16 13:46:31 MTP request GetStorageInfo [65537] send: 0x10 bytes with ep 0x2: 0000: 1000 0000 0100 0510 0400 0000 0100 0100 ................ recv: 0x4a bytes with ep 0x81: 0000: 4a00 0000 0200 0510 0400 0000 0300 0200 J............... 0010: 0000 00f0 cde4 0600 0000 00d0 6ce0 0400 ............l... 0020: 0000 0000 0040 1149 006e 0074 0065 0072 .....@.I.n.t.e.r 0030: 006e 0061 006c 0020 0073 0074 006f 0072 .n.a.l. .s.t.o.r 0040: 0061 0067 0065 0000 0000 .a.g.e.... 2017/08/16 13:46:31 MTP data 0x4a bytes recv: 0xc bytes with ep 0x81: 0000: 0c00 0000 0300 0120 0400 0000 ....... .... 2017/08/16 13:46:31 MTP response OK [] 2017/08/16 13:46:31 MTP decoded &mtp.StorageInfo{StorageType:0x3, FilesystemType:0x2, AccessCapability:0x0, MaxCapability:0x6e4cdf000, FreeSpaceInBytes:0x4e06cd000, FreeSpaceInImages:0x40000000, StorageDescription:"Internal storage", VolumeLabel:""} 2017/08/16 13:46:31 mount failed: no FUSE devices found

puhitaku commented 4 years ago

Good news guys (seems to be outdated issue anyway), I had similar issue and found that calling mtp.Device.claim() before any communication solves the LIBUSB_ERROR_NOT_FOUND issue.

diff --git a/mtp/mtp.go b/mtp/mtp.go
index 3c90d5b..0524e22 100644
--- a/mtp/mtp.go
+++ b/mtp/mtp.go
@@ -146,6 +146,7 @@ func (d *Device) Open() error {
        return err
    }

+   d.claim()
    if d.ifaceDescr.InterfaceStringIndex == 0 {
        // Some of the win8phones have no interface field.
        info := DeviceInfo{}
@@ -168,7 +169,6 @@ func (d *Device) Open() error {
        }
    }

-   d.claim()
    return nil
 }

I don't know if it's portable between serveral OSes but anyway it's working on my Mac.

puhitaku commented 4 years ago

I was hacking my fork and it seems it works on Windows, macOS, and Linux.

ganeshrvel commented 4 years ago

@puhitaku

I was hacking my fork and it seems it works on Windows, macOS, and Linux.

I have raised a PR with your patch.