如何设置Usb连接模式?

时间:2022-10-11 23:06:55

I'm writing an application which is supposed to dump data on the SD card and then another application on a pc which should read the data when the device is connected to the pc (in disc drive mode). On my HTC Legend there is a dialog to choose between: Charge only, HTC Sync, Disk drive..

我正在编写一个应用程序,它应该将数据转储到SD卡上,然后再打印到PC上的另一个应用程序,该应用程序应该在设备连接到PC时读取数据(在磁盘驱动器模式下)。在我的HTC Legend上有一个对话框可供选择:仅充电,HTC同步,磁盘驱动器..

Is there a possibility to set the mode with which the device is connecting to the pc or at least an intent to ask the user to switch the mode?

是否有可能设置设备连接到PC的模式,或者至少是要求用户切换模式的意图?

5 个解决方案

#1


1  

On HTC devices, open the ConnectToPC service (whilst USB is not plugged in) in Manage Apps (ICS - probably applies to Gingerbread too; don't remember), and hit Clear Data. Then, plug the USB back again, and you should have the option to "Don't ask again" available. Select your desired mode, check the box, and accept.

在HTC设备上,在管理应用程序中打开ConnectToPC服务(虽然没有插入USB)(ICS - 可能也适用于Gingerbread;不记得了),然后点击Clear Data。然后,再次将USB插回,您应该可以选择“不要再问”了。选择所需的模式,选中复选框,然后接受。

#2


0  

I haven't found a way of setting the mode programmatically, but I believe you can bring up the settings menu programmatically by invoking the same activity that the system invokes from the notification area. Unfortunately this appears to be manufacturer-specific: on my phone it is com.htc.android.psclient.SwitchUsbSettings.

我还没有找到一种以编程方式设置模式的方法,但我相信您可以通过调用系统从通知区域调用的相同活动以编程方式调出设置菜单。不幸的是,这似乎是制造商特定的:在我的手机上它是com.htc.android.psclient.SwitchUsbSettings。

#3


0  

CompanionLink does this when you request a USB sync in their android app: it flushes data to SD, then exports the SD as storage (a "disk drive") on the USB, then waits for the user to manually signal the android app when the PC is finished using the SD, and then undoes the SD export to USB again. Though the CompanionLink app can be very frustrating to use, at least this part of it is (largely) reliable.

当您在他们的Android应用程序中请求USB同步时,CompanionLink执行此操作:它将数据刷新到SD,然后将SD作为存储(“磁盘驱动器”)导出到USB,然后等待用户手动发信号通知Android应用程序PC使用SD完成,然后再次取消SD导出到USB。尽管CompanionLink应用程序使用起来非常令人沮丧,但至少其中的一部分(很大程度上)是可靠的。

Unfortunately I don't know the technical details, may well need to figure them out myself one of these months. If you can't get any traction with android docs, perhaps you could study what CompanionLink does on android to implement this. The sequence I describe above is when it is configured to sync over USB against a (PC-based) Palm Desktop.

不幸的是我不知道技术细节,可能需要在这几个月中找出自己。如果你无法获得Android文档的任何牵引力,也许你可以研究CompanionLink在android上实现的目的。我上面描述的顺序是它被配置为通过USB与基于(基于PC)的Palm Desktop同步。

As an aside, it appears that the reason for this highly-convoluted process is that the SD card's FS is accessed directly and at least the presently-used card FAT FS can only support a single client: the phone itself or USB. imo it would be extremely helpful if concurrent shared access to the SD were possible, but this would likely require deep android changes.

另外,似乎这个高度复杂的过程的原因是SD卡的FS是直接访问的,并且至少目前使用的卡FAT FS只能支持单个客户端:电话本身或USB。如果可能对SD进行并发共享访问将非常有用,但这可能需要深入的android更改。

#4


0  

For anyone having this issue with an HTC One M8, this is a bit off the wall, but makes the point to think outside the box. A USB connection resulted in the device charging, that was it.

对于任何有HTC One M8这个问题的人来说,这有点过时了,但是有必要在盒子外面思考。 USB连接导致设备充电,就是这样。

The solution was the combination of a different USB cable, uninstalling an application called Battery Doctor (which apparently likes to manage everything around your battery), AND USB Network Setting - turn ON Smart Network Sharing...Seemingly unrelated...but this combination got my connected with MobileGo for Android to manage and back up files,contacts and settings.

解决方案是组合使用不同的USB线缆,卸载名为Battery Doctor的应用程序(显然喜欢管理电池周围的所有内容),以及USB网络设置 - 打开智能网络共享...看似无关......但这种组合让我与MobileGo for Android联系,以管理和备份文件,联系人和设置。

Hope this helps someone.

希望这有助于某人。

#5


-1  

Yes .In Android there is a way to change the behaviour of the devices`s USB mode when the device is connected with the PC. I used a Motorola Milestone[running 2.1] and i was able to switch between the following modes : PC Suite[developed by Motorola],MemoryCardAccess and Charge alone. If you need to access phone memory I think you should turn ON "USB Debugging Mode " in your device.Am not sure about it though,I feel it may be handy !!

是的。在Android中,有一种方法可以在设备与PC连接时更改设备的USB模式的行为。我使用了Motorola Milestone [运行2.1],我可以在以下模式之间切换:PC套件[由摩托罗拉开发],MemoryCardAccess和Charge单独使用。如果你需要访问手机内存,我认为你应该打开设备中的“USB调试模式”。虽然不太确定,但我觉得它可能很方便!

#1


1  

On HTC devices, open the ConnectToPC service (whilst USB is not plugged in) in Manage Apps (ICS - probably applies to Gingerbread too; don't remember), and hit Clear Data. Then, plug the USB back again, and you should have the option to "Don't ask again" available. Select your desired mode, check the box, and accept.

在HTC设备上,在管理应用程序中打开ConnectToPC服务(虽然没有插入USB)(ICS - 可能也适用于Gingerbread;不记得了),然后点击Clear Data。然后,再次将USB插回,您应该可以选择“不要再问”了。选择所需的模式,选中复选框,然后接受。

#2


0  

I haven't found a way of setting the mode programmatically, but I believe you can bring up the settings menu programmatically by invoking the same activity that the system invokes from the notification area. Unfortunately this appears to be manufacturer-specific: on my phone it is com.htc.android.psclient.SwitchUsbSettings.

我还没有找到一种以编程方式设置模式的方法,但我相信您可以通过调用系统从通知区域调用的相同活动以编程方式调出设置菜单。不幸的是,这似乎是制造商特定的:在我的手机上它是com.htc.android.psclient.SwitchUsbSettings。

#3


0  

CompanionLink does this when you request a USB sync in their android app: it flushes data to SD, then exports the SD as storage (a "disk drive") on the USB, then waits for the user to manually signal the android app when the PC is finished using the SD, and then undoes the SD export to USB again. Though the CompanionLink app can be very frustrating to use, at least this part of it is (largely) reliable.

当您在他们的Android应用程序中请求USB同步时,CompanionLink执行此操作:它将数据刷新到SD,然后将SD作为存储(“磁盘驱动器”)导出到USB,然后等待用户手动发信号通知Android应用程序PC使用SD完成,然后再次取消SD导出到USB。尽管CompanionLink应用程序使用起来非常令人沮丧,但至少其中的一部分(很大程度上)是可靠的。

Unfortunately I don't know the technical details, may well need to figure them out myself one of these months. If you can't get any traction with android docs, perhaps you could study what CompanionLink does on android to implement this. The sequence I describe above is when it is configured to sync over USB against a (PC-based) Palm Desktop.

不幸的是我不知道技术细节,可能需要在这几个月中找出自己。如果你无法获得Android文档的任何牵引力,也许你可以研究CompanionLink在android上实现的目的。我上面描述的顺序是它被配置为通过USB与基于(基于PC)的Palm Desktop同步。

As an aside, it appears that the reason for this highly-convoluted process is that the SD card's FS is accessed directly and at least the presently-used card FAT FS can only support a single client: the phone itself or USB. imo it would be extremely helpful if concurrent shared access to the SD were possible, but this would likely require deep android changes.

另外,似乎这个高度复杂的过程的原因是SD卡的FS是直接访问的,并且至少目前使用的卡FAT FS只能支持单个客户端:电话本身或USB。如果可能对SD进行并发共享访问将非常有用,但这可能需要深入的android更改。

#4


0  

For anyone having this issue with an HTC One M8, this is a bit off the wall, but makes the point to think outside the box. A USB connection resulted in the device charging, that was it.

对于任何有HTC One M8这个问题的人来说,这有点过时了,但是有必要在盒子外面思考。 USB连接导致设备充电,就是这样。

The solution was the combination of a different USB cable, uninstalling an application called Battery Doctor (which apparently likes to manage everything around your battery), AND USB Network Setting - turn ON Smart Network Sharing...Seemingly unrelated...but this combination got my connected with MobileGo for Android to manage and back up files,contacts and settings.

解决方案是组合使用不同的USB线缆,卸载名为Battery Doctor的应用程序(显然喜欢管理电池周围的所有内容),以及USB网络设置 - 打开智能网络共享...看似无关......但这种组合让我与MobileGo for Android联系,以管理和备份文件,联系人和设置。

Hope this helps someone.

希望这有助于某人。

#5


-1  

Yes .In Android there is a way to change the behaviour of the devices`s USB mode when the device is connected with the PC. I used a Motorola Milestone[running 2.1] and i was able to switch between the following modes : PC Suite[developed by Motorola],MemoryCardAccess and Charge alone. If you need to access phone memory I think you should turn ON "USB Debugging Mode " in your device.Am not sure about it though,I feel it may be handy !!

是的。在Android中,有一种方法可以在设备与PC连接时更改设备的USB模式的行为。我使用了Motorola Milestone [运行2.1],我可以在以下模式之间切换:PC套件[由摩托罗拉开发],MemoryCardAccess和Charge单独使用。如果你需要访问手机内存,我认为你应该打开设备中的“USB调试模式”。虽然不太确定,但我觉得它可能很方便!