外部 USB 设备到 Android 手机?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2908530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
External USB devices to Android phones?
提问by Doughy
I would like to use Android phones as a way to do some processing and visualization of a sensor that would be attached to the USB port on the phone. The sensor would plug into the micro/mini USB, and then I would need to read the incoming data from the USB serial port.
我想使用 Android 手机作为对连接到手机 USB 端口的传感器进行一些处理和可视化的一种方式。传感器将插入微型/迷你 USB,然后我需要从 USB 串行端口读取传入的数据。
Is this possible? I have heard of people using Android to steer robots and other applications, but I have never seen Android being used as a host for a USB sensor. I can't seem to find any official documentation on the subject either, but it seems like it would be a very useful tool. Any thoughts, links, or information on this matter? Thanks.
这可能吗?我听说有人使用 Android 来引导机器人和其他应用程序,但我从未见过 Android 被用作 USB 传感器的主机。我似乎也找不到有关该主题的任何官方文档,但它似乎是一个非常有用的工具。关于此事的任何想法、链接或信息?谢谢。
采纳答案by victorhooi
What you're looking for is USB Host support.
您正在寻找的是 USB 主机支持。
There's an open issue in Android's issue tracker here for it:
Android 的问题跟踪器中存在一个未解决的问题:
and it's actually ranked 7th, in terms of "stars" (think votes, by the people), at 1110 stars. You can log in and star it yourself, both to vote for it, and to receive email updates.
它实际上在“明星”方面排名第 7(想想人民的投票),有 1110 颗星。您可以登录并自己加星标,既可以投票,也可以接收电子邮件更新。
There was also work on a patch back in February, 2010:
2010 年 2 月还有一个补丁:
http://groups.google.com/group/android-kernel/browse_thread/thread/c8471573d7553331
http://groups.google.com/group/android-kernel/browse_thread/thread/c8471573d7553331
and there's info on using a USB keyboard here:
这里有关于使用 USB 键盘的信息:
http://www.tombom.co.uk/blog/?p=124
http://www.tombom.co.uk/blog/?p=124
Perhaps you can find something for your sensor there?
也许您可以在那里找到适合您的传感器的东西?
This is cool =):
这很酷=):
http://www.technologyreview.com/biomedicine/25286/?a=fb
http://www.technologyreview.com/biomedicine/25286/?a=fb
Cheers, Victor
干杯,维克多
回答by Arjun
should be possible, look up android.hardware.usb.UsbDevice @ http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
应该是可能的,查找 android.hardware.usb.UsbDevice @ http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
回答by A.K.
This support has been added since Android 3.1.
自 Android 3.1 起已添加此支持。
Look at http://developer.android.com/guide/topics/connectivity/usb/index.html
查看http://developer.android.com/guide/topics/connectivity/usb/index.html
回答by user2248739
Have a look at You Are Here GPS.
看看你在这里 GPS。
https://play.google.com/store/apps/details?id=com.agbooth.usbgps
https://play.google.com/store/apps/details?id=com.agbooth.usbgps
回答by jaycec
The USB defines two type of equipment 1 usb host 2usb device .A device can only be attached to a host,no host to host or device to device connection.,in the beginning usb hosts were computers to which a usb device is attached.but with increase in popularity of usb interface a number of equipments come as usb host ie you can attach your pendrive and other usb device to it.In the starting mobile phones were manufactured as usb device ie you can attach your phone to usb host only typically a computer.but there also revolution come in now we have phone which can act as host and device when it is working as host we can attatch printer to it and when it work as device it can be attatched to a computer.only high end phone has this support.low end phones are still usb devices. so we have two options
USB 定义了两种类型的设备 1 usb 主机 2usb 设备。设备只能连接到主机,没有主机到主机或设备到设备的连接。在开始时,usb 主机是连接 USB 设备的计算机。但是随着 USB 接口的普及,许多设备都作为 USB 主机出现,即您可以将您的随身碟和其他 USB 设备连接到它。在开始时,手机是作为 USB 设备制造的,即您通常只能将手机连接到 USB 主机电脑。但现在也有革命了,我们有了手机,当它作为主机工作时,它可以作为主机和设备,我们可以将打印机连接到它,当它作为设备工作时,它可以连接到计算机。只有高端手机有这支持。低端手机仍然是 USB 设备。所以我们有两个选择
- phone in usb host mode and your senser as usb device(you will need microcontroller that can act as usb device for this purpose-eg pic 18f2550 microcontroller);
- your phone as device and your senser circuit as usb host here you will need high end microcontrollers that can act as usb host
- 手机处于 USB 主机模式,您的传感器作为 USB 设备(您将需要可以作为 USB 设备的微控制器,例如 pic 18f2550 微控制器);
- 您的手机作为设备,您的感应器电路作为 USB 主机在这里您将需要可以充当 USB 主机的高端微控制器
in both cases there involves coding at both phone and senser circuit microcontroller
在这两种情况下,都涉及在电话和感应器电路微控制器上进行编码
i dont know anything about phone side coding but i think this helps you to get a direction to what to do.
我对电话端编码一无所知,但我认为这可以帮助您了解要做什么。
回答by HXCaine
This guy has modded his Nexus One to work as a USB host and has done several cool things.
这家伙将他的 Nexus One 改装成 USB 主机,并做了几件很酷的事情。
He uses a USB keyboard and runs a movie from his USB stick. Then he runs a webcam through the phone and displays it on the computer and even runs an entire desktop-based Linux distro from his phone onto his computer monitor.
他使用 USB 键盘并从他的 USB 记忆棒运行电影。然后,他通过手机运行网络摄像头并将其显示在计算机上,甚至将整个基于桌面的 Linux 发行版从他的手机运行到他的计算机显示器上。
Pretty amazing stuff.
相当惊人的东西。