与Android平板电脑同花顺MTP连接? [英] Flush MTP connection with Android tablet?

查看:345
本文介绍了与Android平板电脑同花顺MTP连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用USB线连接三星Galaxy Android平板电脑运行Windows 7。它连接使用MTP。

I connect a Samsung Galaxy Android tablet with a USB cable to computer running Windows 7. It connects using MTP.

  • 第1步:通过Windows资源管理器中复制从Windows 7我的SQLite数据库的平板电脑。
  • 第2步:打开它在平板电脑上(它增加了android_metadata表),然后将其关闭。
  • 第三步:复制SQLite数据库返回到Windows。
  • 第四步:使用sqlite3.exe检查它。这是腐败的。

现在另一个测试。

  • 第1步:通过Windows资源管理器中复制从Windows 7我的SQLite数据库到平板电脑
  • 第2步:断开然后重新连接USB电缆。
  • 第三步:打开它在平板电脑上(它增加了android_metadata表),然后将其关闭。
  • 第三步:复制SQLite数据库返回到Windows。
  • 第四步:使用sqlite3.exe检查它。这不是腐败。

有趣的是,如果切换步骤2和3,它也可以。

Interestingly, if I switch steps 2 and 3, it also works.

由于它的工作原理,当我断开并重新连接USB电缆,我猜,我需要刷新MTP缓存莫名其妙。如何实现这一点,或者是有一个API,我可以用它来迅速断开或连接该设备?

Since it works when I disconnect and reconnect the USB cable, I'm guessing that I need to flush the MTP cache somehow. How can this be accomplished, or is there an API I can use to quickly disconnect and reconnect the device?

我实际的Windows应用程序使用WPD(Windows便携设备)的API,我只是测试使用Windows资源管理器,以证明它不是在我的Windows code的一个问题。我没有看到任何东西WPD做了刷新。

My actual Windows application uses the WPD (Windows Portable Devices) API, I'm just testing using Windows Explorer to prove it's not a problem in my Windows code. I don't see anything in WPD to do a flush.

该错误似乎在Android上的SQLite数据库的增长通过一个页面(或更多)的发生。 SQLite中的页面大小为512字节。纵观SQLite数据库的二进制数据,我可以看到发生了什么。我把数据库中的一个页面更大的设备上,复制数据库关闭设备,拔掉U盘,插上电源线,然后再复制它。比较两个文件,​​我收到后,我复制USB数据从文件是相同的,除了它在年底更大量的数据。这就像MTP不理解文件越大,直到你拔掉USB,并再次插入。如果你把USB插入它只是复制了那个在那里的最后一次复制的文件的字节数。

The error seems to occur when the SQLite database on Android grows by a page (or more). The page size in SQLite is 512 bytes. Looking at the SQLite database's binary data , I can see what's happening. I make the database one page bigger on the device, copy the database off the device, unplug the usb, plug it in, then copy it off again. Comparing the two files, the file I get after I copy the usb data off is the same except it has a lot more data at the end. It's like MTP doesn't understand the file is bigger until you unplug the usb and plug it in again. If you leave USB plugged in it only copies over the number of bytes that were there the last time it copied the file.

推荐答案

我已经找到确切同样的问题对三星Galaxy Tab 2 7.0。

I have found exact the same problem on the Samsung Galaxy Tab 2 7.0.

但是,在我看来这是对Android端的问题。

But in my oppinion it is a problem on the android side.

如果我强迫其打开数据库停止应用程序(系统设置 - >应用程序管理器 - >我的APP->力STOPP),那​​么它的工作原理。

If I force the application which opens the db to stop (System Settings->app manager->my app->force stopp) then it works.

只有打开连接和密切联系是远远不够的。 对android端的全过程必须关闭。

Only "open connection" and "close connection" isn't enough. The complete process on the android-side has to be closed.

这也解释了为什么在重新启动设备后,它的工作原理。

This explains why it works after restarting the device.

进一步的调查: 它可以完美地与银河标签和4.1.2(如果应用程序进程被关闭)。 它的工作原理与MTP但不PTP(图片传输协议)。 这两个协议都连接有WPD功能,但写入和读出(所以永远不会使用PTP)。

Further investigation: It works perfectly with Galaxy Tab and 4.1.2 (if App-process is closed). It works with MTP but not PTP (Picture Transfer Protocol). Both protocols are connecting with WPD-function but PTP is quite inconsistent when writing and reading (so never ever use PTP).

这篇关于与Android平板电脑同花顺MTP连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆