Android Things文件系统 [英] Android Things filesystem
问题描述
我正在基于Android事物构建此应用.我希望能够让它访问USB记忆棒上的媒体文件,甚至是树莓派的SD卡.我不知道该如何处理这些文件,但我只想知道它是否可能.如果不是很好,我还有其他解决方案,但我认为我会先从显而易见的方法入手.
I am building this app on android things. I want to be able to give it access to media files on a USB stick or maybe even the raspberry pi's SDcard. I don't know what I'll have it do with those files yet but I just wanna know if its possible. If it isn't that's fine I have other solutions but I figured I would start with the obvious approach first.
推荐答案
我没有尝试过,但似乎可以通过与普通Android OS相同的方式来尝试.为此,您应该将USB加密狗安装到文件系统中的某个位置,例如在新文件夹/mnt/usb
中,例如那 基瓦尔·帕特尔的项目:
I'm didn't try it, but seems it's possible by the same way as in normal Android OS. To do this You should mount Your USB dongle into the filesystem somewhere e.g. in new folder /mnt/usb
like in this answer of Onik or that project of Keval Patel:
安装USB驱动器:
将USB驱动器插入Raspberry Pi中的任何USB端口.
Plug you USB drive at any of the USB port in your Raspberry Pi.
在终端中键入以下命令打开adb外壳程序(确保您的树莓派通过adb连接):
Open adb shell by typing below command in terminal (Make sure your raspberry pi is connected via adb):
adb shell
通过在adb shell中运行以下命令来安装USB驱动器(您的USB驱动器应在FAT文件系统中格式化):
Mount the USB drive by running below command in adb shell (Your USB drive should be formatted in FAT file system):
su mkdir /mnt/usb
mount -t vfat -o rw /dev/block/sda1 /mnt/usb
其中
sda1
是第一个磁盘的第一个分区(sdb1
是第二个磁盘的第一个分区,依此类推),以及/mnt/usb
-已安装USB加密狗的新文件夹.
sda1
is the first partition of the first disk (sdb1
is the first partition of the second disk, etc.) and /mnt/usb
- new folder for mounted USB dongle.
然后,您可以通过以下方式访问已安装的USB加密狗:
Then You can access to mounted USB dongle something like this way:
File usbDongleRoot = new File("/mnt/usb");
(或类似的东西).
还请查看 Shaka Huang .
这篇关于Android Things文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!