在Android上开发一个通过USB端口连接的特殊设备通信应用程序
我找到了 Android 的 USB 文档,从那里看来,人们似乎可以在 Android 手机上编写一个通信程序,其工作方式与在 PC 上完全相同。
我有一条普通的 USB 电缆,通常用于连接 PC 和外部设备。一端是普通 USB,另一端有一个用于该设备的特殊插头。
如果我有一个 USB 母头-母头适配器,我可以将我的普通 Android 手机电缆 USB 端连接到我的设备 USB 电缆,然后将我的特殊 USB 电缆插入 Android 手机。
有人有在 Android 上进行 USB 通信编程的经验 - 基本上是复制普通 PC USB 功能吗?我所要做的就是通过 USB 端口发送和接收文本字符串 - 就像在 PC 上一样。
这可能吗,或者 Android 上的 USB 端口编程是否受到任何限制 和 PC 上的 USB 编程不太一样吗?例如。通过 USB 或其他方式供电?
ps 在 PC 上我需要安装 FTDI 驱动程序才能与外部设备配合使用。
非常感谢
更新: 似乎从 Android 3.1 开始就可以做到这一点 - 但是,如果我正确理解 htis,Android 3.1 只能在平板电脑 Android 设备上运行 - 我可能是错的 - 与 Apple 相比,这一切都相当令人困惑(但是,与苹果 iPhone 永远不会工作!
I found the USB docs for Android and from there it seems as if one could write a communication program on an Android phone that works exactly like on a PC.
I have a normal USB-cable that normally connects between a PC and an external device. On one end it is a normal USB on the other end it has a special plug for the device.
If I get an USB female-female adapter I could connect my normal Android phone cable USB end to my device USB cable and so basically plug in my special USB cable into the Android phone.
Does anyone have experience doing USB communcation programming on Android - basically copying normal PC USB functionality? All I would have to do is sent and receive text strings over the USB port - just like on a PC.
Is this possible or is the USB port programming on Android limited in any way
and not really identical to USB programming on a PC? eg. power supply through USB or anything else?
ps on the PC I need to have a FTDI driver installed to work with the external device.
Many thanks
UPDATE:
it seems that starting with Android 3.1 it is possible to do this - however, if I understand htis correctly, Android 3.1 runs only on tablet Android devices - I might be wrong with this - compared to Apple this all this pretty confusing (however, with Apple iPhone it will never work! ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,Android 在 3.1 及更高版本上支持 USB 主机,因此您可以使用转换器电缆将 USB 设备直接连接到 Android 设备。 Android 4.0 为手机设备带来了这一功能。
Yes, Android supports USB host on 3.1 and newer, so you can connect USB devices directly to an Android device using a converter cable. Android 4.0 brings this feature to handset devices.