【发布时间】:2020-03-24 22:53:37
【问题描述】:
我制作了一个 Android 应用程序,可以让智能手机在 USB 主机模式下运行。我是使用此处给出的 Android 官方文档这样做的:
https://developer.android.com/guide/topics/connectivity/usb/host
为了测试应用程序,我通过 OTG 电缆连接了笔式驱动器。该应用程序能够检测笔式驱动器并读取其内容。现在基本上,我想用树莓派替换笔式驱动器。
请帮我解决这个问题:如何在 Raspberry Pi 和 Android 智能手机之间建立同步通信(基本上是流)。
我尝试过 UART 通信,但无法使用它,因为我正在从 Raspberry Pi 传输视频。
注意:由于限制,我无法使用 WIFI。
【问题讨论】:
-
在树莓派中使用otg模式并使用它?不确定您要达到的目标。您可以在 OTG 中使用树莓派零而无需重新布线。
-
我有 3b+ 不支持。
-
There is only one USB peripheral on the BCM283x SoC. On the CM, A, and Zero that is exposed directly to the outside world, so these tricks can be played. On any B, B+, 2B, or 3B there is an SMSC951x chip connected to it to act as a USB hub and network interface. You therefore can't switch the function of the port.来自 [raspberrypi.org/forums/viewtopic.php?t=143203] -
使用 Android 作为 USB 主机和 Raspi 作为客户端很可能无法像上面评论中提到的那样工作。您是否考虑过使用附件模式而不是主机模式 (developer.android.com/guide/topics/connectivity/usb)?
-
我使用的标签没有附件模式。
标签: android linux sockets stream raspberry-pi