我试图在运行Windows 10的机器上挂载android设备,以便通过Java应用程序访问文件。我知道大家的共识是应该使用WebDav或FTP服务器,但如果可能的话,我想避免这样做。我花了好几个星期的时间研究这个问题,并最终决定接触到堆叠溢出的聪明头脑。
要挂载MTP设备,我们需要一个类似于用于Unix的fuse文件系统库。对于windows,两个明显的选择是:
据我所知,有两个主要的API/库可以访问MTP设备:
我已经成功地使用msys2 2/ using 64为windows编译了libmtp。
在我看来,我应该使用像mtpmount座这样的应用程序,或者使用像dokany这样的文件系统库来移植像简单-mtpfs这样的linux应用程序,而不是使用fuse。
但是,当我尝试使用mtp挂载(它使用WPD )时,它没有列出任何设备,当我使用所提供的示例测试libMTP时,会得到如下错误:
libusb_open() failed!: No error
libmtp version: 1.1.18
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
Found 1 device(s):
Samsung: Galaxy models (MTP) (04e8:6860) @ bus 1, dev 10
Attempting to connect device(s)
OK.
LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0我不知道该怎么做。任何帮助都将不胜感激。
更新
我让libmtp使用libusbk-dev-kit工作。具体来说,我使用libusbK向导为我的设备创建驱动程序。我测试了libusbk驱动程序和WinUSB驱动程序,发现它们都解决了我的问题。另外,我从源代码构建了mtpmount座,并发现它也能工作。
发布于 2021-04-24 13:27:50
我在寻找类似的东西时发现了你的问题:如何在Windows 10上使用Python 3与MTP (一个Garmin 200 i手持GPS单元--而不是手机)对话。
很高兴看到你找到了解决方案!我使用您的引线(特别是mtpmount座)为我的问题找到了部分解决方案,我想知道它是否为您的问题提供了另一个替代解决方案。
我还想知道,自从找到了解决方案之后,您是否还发现了有关mtpmount的更多信息。
根据你的线索,我去了mtpmount。我能够为windows命令行获得一个完整的解决方案,方法是: 1)下载并运行最新的.msi for dokany,确保选择要安装的所有组件;2)下载not挂载的最新.exe (它不是安装程序--它是实际的mtpmount可执行文件)。这是一个很顺利的安装过程,你可以希望在这个领域!向这两个项目的开发人员致敬!
我发现的惟一区别是: 1)文档中的可执行文件名与下载中的可执行文件名称不完全匹配--当然不是什么大问题;2)磅号必须以双引号表示--至少在powershell中是这样的;3)一件好事:您可以用相同的ID#语法指定驱动器号:
PS C:\Users\caver\Downloads> .\mtpmount-x64.exe list available
This is mtpmount, version 19.8.0 from commit 43033d6
This program comes with NO WARRANTY. Usage only at your own risk.
Available Connections and Storage Media:
Connection Elements: Contains 1 storages that can be mounted
|-- Storage E: [ID #0]
Connection My Passport: Contains 1 storages that can be mounted
|-- Storage F: [ID #1]
Connection Alpha 200i: Contains 2 storages that can be mounted
|-- Storage Internal Storage [ID #3]
|-- Storage Memory Card [ID #4]
Use mount command to make one of them a windows removable drive
PS C:\Users\caver\Downloads> .\mtpmount-x64.exe mount "#3" h:
This is mtpmount, version 19.8.0 from commit 43033d6
This program comes with NO WARRANTY. Usage only at your own risk.
Drive H:\ is now Alpha 200i\Internal Storage. Don't forget to unmount the drive (using unmount command) before disconnecting your device
PS C:\Users\caver\Downloads>然后你做你的驱动器访问工作。然后运行此命令以卸下:
PS C:\Users\caver\Downloads> .\mtpmount-x64.exe unmount "#3"
This is mtpmount, version 19.8.0 from commit 43033d6
This program comes with NO WARRANTY. Usage only at your own risk.
Alpha 200i\Internal Storage has been unmounted successfully.
Syncing Alpha 200i. DO NOT UNPLUG THIS DEVICE YET!终端机在此停留约5秒。
Cache OK
All content synced to Alpha 200i. You may now unplug this device.
PS C:\Users\caver\Downloads>我的问题是:
谢谢,恭喜你让它起作用了!
https://stackoverflow.com/questions/64910317
复制相似问题