Android USB主机api和USB存储 [英] Android usb host api and USB storage

查看:168
本文介绍了Android USB主机api和USB存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用android主机api进行USB存储.我对此有很多怀疑.

I am trying to use the android host api for USB storage. I have many doubts regarding same.

  1. 使用主机api可以实现所有功能.我想查看USB的内容,如果可能的话,请查看正常的文件操作.我没有找到与此相关的任何文档帮助.

  1. What all things are possible using host api. I want to see the content of USB and if possible so the normal file operation. I didnt find any documentation help regarding this.

我能够使用UsbDeviceConnection类API声明接口,但是我无法理解bulkTransfer的工作原理,因此,如果有人可以指导我或提供一些参考,我将自己尝试一下.

I am able to claimInterface using UsbDeviceConnection class API but I'm unable to understand how the bulkTransfer works so if anyone can guide me or give some reference I will try myself.

我也尝试阅读USB规范,我了解bulkTransfer如何在USB级别工作,但无法关联使用bulkTransfer而不是File Descriptor使用UsbEndpoint进行android/java文件操作的方式.

I tried reading the USB specification also, I understood how bulkTransfer works at USB level but unable to relate how android/java file operations are possible using bulkTransfer which using UsbEndpoint not the File Descriptor.

预先感谢!

推荐答案

Android USB Host API不包括USB Mass Storage文件系统代码,在2014年撰写本文时,也不会储备" Android在操作系统级别安装USB Mass Storage卷.

The Android USB Host APIs do not include USB Mass Storage filesystem code, nor as of this writing in 2014 will "stock" Android mount a USB Mass Storage volume at operating system level.

要使用库存的Android USB Host API访问USB海量存储设备,因此,您必须在应用程序代码中实现实现块级设备访问所需的原始USB操作以及适当的文件系统逻辑本身.不用说,这些细节的复杂性超出了此处的答案范围,但是您可以从研究文档或现有的USB Mass Storage驱动程序和其他平台的文件系统驱动程序的实现开始.

To access a USB Mass Storage device using the stock Android USB Host APIs, you must therefore implement in your Application code both the necessary raw-USB operations to achieve block-level device access, and the appropriate filesystem logic itself. Needless to say, the details of such are of a complexity beyond the scope of an answer here, but you could start by studying documentation or existing implementations of USB Mass Storage drivers and filesystem drivers for other platforms.

似乎Android 6中的情况可能有所不同,甚至可能不再允许通过USB主机api访问版本识别为存储设备的内容.面向Android 6+的用户可能需要将目光投向其他地方,但是较旧的设备将继续使用一段时间.

It appears the situation in Android 6 may be different, and access via the USB host apis to something that version recognizes as a storage device might even no longer be permitted. Those targeting Android 6+ may need to look elsewhere, but older devices will remain in use for some time.

这篇关于Android USB主机api和USB存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆