通过 USB 使用 Android 采集数据
在 Android 设备 (HTC Magic
) 上将 USB 作为串行端口访问的最佳方式是什么?
我正在考虑 OBD-II 接口。 我可以在标准手机上执行此操作还是更有可能需要修改固件?
What would be the best way to access the USB as a serial port on an Android device (HTC Magic
)?
I am thinking about an OBD-II interface. Can I do this on a standard phone or more likely will I need a modified firmware?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
根据这篇文章,Matt Porter 发表了一篇评论Android 在欧洲嵌入式 Linux 会议上。 我提到这一点主要是因为用于描述 Android 当前状态的示例。
我确信有人正在研究它,但恐怕现在你运气不好,除非你愿意深入底层并编辑操作系统。
According to this post, Matt Porter presented a review of Android at the Embedded Linux Conference Europe. I mention this mostly because of the example used to describe the current state of Android.
I'm sure someone's working on it, but I'm afraid for now you're out of luck unless you're willing to go low-level and edit the OS.
PSFreedom(项目到越狱 Playstation 3)有 支持 USB 主机模式的控制器列表,然后转换为 < a href="http://psfreedom.com/wiki/Device_compatibility_list" rel="nofollow noreferrer">支持的 Android 设备。
我自己的经验是 USB 主机可以在 HTC Dream/G1 上正常工作。
对于 OBD-II,我建议使用蓝牙 ODB-II 适配器,它可以避免USB 主机适配器有问题。
PSFreedom (project to jailbrack Playstation 3) has list of controllers which support usb host mode which then translate to supported Android devices.
My own expirience is that usb host works on HTC Dream/G1 without problems.
For OBD-II I would suggest bluetooth ODB-II dongle which side-stepps problem with usb host adapter.
根据特定手机中的 USB 芯片,可以重建内核以支持 USB Host 模式或 USB On-The-Go(Host + Gadget 模式),而不是普通的 USB Gadget 模式。 我发现有些人猜测它可能在 HTC Dream 上实现。 假设您可以在主机模式下重新配置 USB 端口,USB 转串行、ODB-II 或 CAN 应该是可行的。
Depending on the USB chip in your particular phone, it may be possible to rebuild the kernel to support USB Host mode or USB On-The-Go (Host + Gadget modes) instead of the normal USB Gadget mode. I've found some people speculating that it could be possible on the HTC Dream. Assuming you could reconfigure the USB port in Host mode a USB to serial, ODB-II, or CAN should be doable.
据我所知,Android 是某种 Linux,要拥有显示为串行端口的 USB 设备,您应该为该设备编写一个驱动程序。 我对 OBD-II 接口不太了解,但我猜测他们使用某种用于 Windows 的 USB 驱动程序,对于 Android 也是如此,更不用说处理驱动程序的应用程序了。
From what I can tell Android is Linux of some sort, to have USB device which would apear as serial port, you should write a driver for that device. I don't know much about OBD-II interface but i am guesing they use some sort of USB driver for windows, same is for android, not mentioning the application to handle the driver.
我认为当前的 Android 设备不能充当 USB 主机,只能在连接到主机时充当 USB 设备。 所以用USB口当串口是不太可能的。
I don't think the current Android devices can act as a USB host only as a USB device when attached to a host. So using the USB port as a serial port is not likely.
为您的设备获取主机模式内核,您可以使用适用于 Android 的 python 和 pyserial 库通过 USB 与串口通信。 我用华为 Ideos U8150 做到了这一点(这是环回测试的帖子)。
Get a hostmode kernel for your device and you can use python for android and the pyserial library to talk to the serial over USB. I did this with Huawei Ideos U8150 (here is the post) for a loopback test.