Android 4.0.3. USB Host - sending data via controlTransfer

人盡茶涼 提交于 2019-12-10 21:28:57

问题


I am new to Android and just started working with Android 4.0.3. which enables USB Host connection. I'm trying to send some signal via USB to a camera, let's say it is supposed to be some characters that the camera has to receive and e.g. start recording. I wanted to do it via controlTransfer(), but I am unable to understand what each part of the logic of this method means. I've checked many fora, but everywhere I see it people keep refering to it as if it was obvious. What is the request ID, value and index? Or maybe there is some other approach to the problem that I don't know. I know for sure that you can send a signal via USB from Linux terminal to that camera and as android has a linux kernel so maybe the way to go would be to start a terminal and do it the Linux way? Thanks for any tips :)


回答1:


controlTransfer() intended to send commands via control endpoint (endpoint 0). Request ID, index and value and part of USB protocol. Please refer to http://www.beyondlogic.org/usbnutshell/usb6.shtml#SetupPacket for more information.

Do you has protocol description for your camera? I suppose, you need to use other endpoint (as described in camera protocol) to send characters to a camera.



来源:https://stackoverflow.com/questions/9938729/android-4-0-3-usb-host-sending-data-via-controltransfer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!