|
1 |
| -# UMS Interface |
2 |
| -This program allows you to chose a block device or disk image as a 'disk',and communicate with PC through usb mass storage (just as usb disk do).Root permission is needed. |
3 |
| - |
4 |
| - * [download latest version](https://raw.githubusercontent.com/outofmemo/UMS-Interface/master/update/app-release.apk) |
5 |
| - |
6 |
| - |
7 |
| - |
8 |
| -## introduction |
9 |
| -<h4 style="color:#0F0">quick start</h4> |
10 |
| -<b style="color:#009;">usb connection:</b> |
11 |
| -set current data source as U disk<br/> |
12 |
| -<b style="color:#009;">mount to:</b> |
13 |
| -mount current data source<br/> |
14 |
| -<b style="color:#009;">quick create:</b> |
15 |
| -create a image with the given size,format as vfat,mount it,and use it as U disk<br/><br/> |
16 |
| -<b style="color:#900;"> |
17 |
| - *If the file you just copied can not be displayed immediately, try click 'close'/'launch' and 'umount'/'mount' continuously.</b><br/> |
18 |
| -<h4 style="color:#0F0">U disk</h4> |
19 |
| -<b style="color:#009;">block device:</b> |
20 |
| -Representing a disk or partition, usually located in /dev/block or /dev.<br/> |
21 |
| -<b style="color:#009;">image file:</b> |
22 |
| - Usually named as *.img .An image file with a file system can be mounted like normal disk.<br/> |
23 |
| -<b style="color:#009;">data source:</b> |
24 |
| -source of the data in U disk,an image file or a block device is available .<br/> |
25 |
| -<b style="color:#009;">config path:</b> |
26 |
| -path this software relied.Like /sys/class/android_usb/android0 or /sys/devices/virtual/android_usb/android0.<br/> |
27 |
| -<b style="color:#009;">readonly:</b>may have no effect for some phone |
28 |
| -<br/> |
29 |
| -<h4 style="color:#0F0">mount</h4> |
30 |
| -<b style="color:#009;">data source:</b> |
31 |
| -source of the data to mount,an image file or a block device is available .<br/> |
32 |
| -<b style="color:#009;">mount point:</b> |
33 |
| -chose a directory to mount.<br/> |
34 |
| -<b style="color:#009;">file system:</b> |
35 |
| -will be automatically chose if not specified.<br/> |
36 |
| -<b style="color:#009;">mask:</b> |
37 |
| -used to set dmask and fmask.<br/><br/> |
38 |
| -<b style="color:#900;"> |
39 |
| - *You must disable 'mount namespace separation' in SuperSu, or it won't work.</b><br/> |
40 |
| -<h4 style="color:#0F0">create image</h4> |
41 |
| -<b style="color:#009;">format:</b> |
42 |
| -create file system for image file.<br/><br/> |
43 |
| -It can be used as a boot disk for PC when select a solved image.<br/> |
44 |
| - |
45 |
| -## screen shots |
46 |
| - |
47 |
| - |
48 |
| - |
49 |
| - |
50 |
| - |
51 |
| - |
52 |
| - |
53 |
| - |
54 |
| -## see more |
55 |
| - * [android6.0.1 usb mass storage](http://blog.csdn.net/outofmemo/article/details/53348552) |
56 |
| - * [coolapk](http://www.coolapk.com/apk/com.sjj.echo.umsinterface) |
57 |
| - * [boot disk image(PE),password: er8y](http://pan.baidu.com/s/1gfa9GbD) |
58 |
| - |
59 |
| -## 简介 |
60 |
| -<h4 style="color:#0F0">快捷启动</h4> |
61 |
| -<b style="color:#009;">U盘连接:</b> |
62 |
| -将当前数据源作为U盘,点击'终止'取消 <br/> |
63 |
| -<b style="color:#009;">挂载到:</b> |
64 |
| -自动挂载当前数据源,点击'终止'取消<br/> |
65 |
| -<b style="color:#009;">一键启动:</b> |
66 |
| -点击创建,创建指定大小镜像文件,格式化vfat,并将其挂载,同时作为U盘使用<br/><br/> |
67 |
| -<b style="color:#900;"> |
68 |
| - *如果刚复制的文件无法立即显示,尝试连续点击'关闭'/'启动','卸载'/'挂载'.</b><br/> |
69 |
| -<h4 style="color:#0F0">U盘</h4> |
70 |
| -<b style="color:#009;">块设备:</b> |
71 |
| -代表一个存储器或分区,通常位于/dev/block 或 /dev.<br/> |
72 |
| -<b style="color:#009;">镜像文件:</b> |
73 |
| -通常命名为*.img .一个内含文件系统的镜像文件可被挂载,和普通存储器一样使用.<br/> |
74 |
| -<b style="color:#009;">数据源:</b> |
75 |
| -可选任意镜像文件或块设备.若选则块设备,请谨慎操作,以免数据丢失.<br/> |
76 |
| -<b style="color:#009;">配置目录:</b> |
77 |
| -通常会自动寻找,可点击"选择"以手动指定.多数手机上此目录为 /sys/class/android_usb/android0 或 /sys/devices/virtual/android_usb/android0.<br/> |
78 |
| -<b style="color:#009;">只读:</b> |
79 |
| -U盘只读,很多手机上可能无效<br/><br/> |
80 |
| -<b style="color:#900;"> |
81 |
| - *由于内核原因,使用三星芯片的一些手机使用此功能会被作为CD ROM</b><br/> |
82 |
| -<h4 style="color:#0F0">挂载</h4> |
83 |
| -<b style="color:#009;">数据源:</b> |
84 |
| -可以指定内含文件系统的镜像文件或块设备.<br/> |
85 |
| -<b style="color:#009;">挂载点:</b> |
86 |
| -指定一个目录,"磁盘"中的文件会被放到这里.<br/> |
87 |
| -<b style="color:#009;">文件系统:</b> |
88 |
| -忽略,会自动判断.<br/> |
89 |
| -<b style="color:#009;">权限掩码:</b> |
90 |
| -用于挂载vfat时指定文件访问权限.<br/><br/> |
91 |
| -<b style="color:#900;"> |
92 |
| - *SuperSU 中的"挂载空间分离"可能会影响本功能,可尝试在SuperSu中取消.</b><br/> |
93 |
| -<h4 style="color:#0F0">创建镜像</h4> |
94 |
| -<b style="color:#009;">格式化:</b> |
95 |
| -为文件建立文件系统,以便立即挂载.<br/> |
96 |
| -<b style="color:#900;"></b> |
97 |
| -可将启动盘的磁盘镜像作为U盘的数据源,这样便可方便的将手机作为电脑启动盘.<br/> |
98 |
| - |
99 |
| -## 指南 |
100 |
| - * [安卓4.4以上版本将手机作为U盘使用](http://jingyan.baidu.com/article/a3f121e4be8e7ffc9052bb19.html) |
| 1 | +[English Description](#english-description) [中文描述](#中文描述) [APP Description](https://github.com/outofmemo/UMS-Interface/blob/master/README.md) |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## English Description |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## 中文描述 |
| 10 | + |
| 11 | +基本功能: 使用 `usb gadget` 驱动使指定的镜像或块设备可作为 USB Drive 被PC访问; 同时将此镜像或块设备挂载到Android本地. |
| 12 | + |
| 13 | +使用场景: |
| 14 | + |
| 15 | +* 摆脱`MTP`, 实现PC与Android的文件传输, Mass Storage 比 MTP 兼容性更好. |
| 16 | +* 替代实体U盘, 携带手机后, 无需再带U盘. |
| 17 | +* 使用已有的iso或pe镜像, 用于PC系统维护, 无需刻盘, 替代PC启动盘. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +UMSInterface APP后面不再维护. 如果仍然想使用此APP, 可参考[APP Description](https://github.com/outofmemo/UMS-Interface/blob/master/README.md). |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +作为替代, 下面提供一个基于`Termux`环境的shell脚本示例, 来完成大致相同的功能. 此方法需要使用者对linux和shell有一定的了解. 同时, 挂载/卸载分区, 以及对块设备的操作本来就是高危操作, 如果使用者对linux环境不熟悉, 可能会时手机变砖, 这也是APP不再维护的原因之一. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +替代方法如下: |
| 30 | + |
| 31 | +1. 此shell脚本运行环境基于`Termux`, 请先安装[Termux](https://termux.com/). |
| 32 | + |
| 33 | + 同时, 为了方便一键操作, 建议安装 [Termux:Widget](https://wiki.termux.com/wiki/Termux:Widget); |
| 34 | + |
| 35 | + 为了方便显示toast消息, 建议安装 [Termux:API](https://wiki.termux.com/wiki/Termux:API). |
| 36 | + |
| 37 | + 2. 将 [mass_storage.sh](https://github.com/outofmemo/UMS-Interface/blob/master/mass_storage.sh) 拷贝至 `/data/data/com.termux/files/home/.shortcuts/` 或执行: |
| 38 | + |
| 39 | + ```bash |
| 40 | + mkdir /data/data/com.termux/files/home/.shortcuts |
| 41 | + cd /data/data/com.termux/files/home/.shortcuts |
| 42 | + apt install wget |
| 43 | + wget https://raw.githubusercontent.com/outofmemo/UMS-Interface/master/ |
| 44 | + ``` |
| 45 | + |
| 46 | + 其中的部分参数可根据实际情况进行修改, 如: |
| 47 | + |
| 48 | + * `default_size_mb`: 默认创建的镜像大小, 单位: MB. |
| 49 | + * `src`: 镜像文件或块设备路径. |
| 50 | + * 可以指定一个不存在的路径, 此时会自动创建一个空的镜像. |
| 51 | + * 可以指定一个块设备路径. 但要谨慎这么做, 否则可能导致手机无法启动. |
| 52 | + * 可以指定一个已存在的镜像. 比如可以指定iso镜像 或 pe磁盘镜像用于PC的系统维护. 或者也可以指定一个使用`dd`命令拷贝的磁盘镜像. |
| 53 | + * `dst`: 挂载点路径. 留空则不挂载. |
| 54 | + |
| 55 | + 3. 为`mass_storage.sh`添加可执行权限: |
| 56 | + |
| 57 | + ```bash |
| 58 | + chmod +x /data/data/com.termux/files/home/.shortcuts/mass_storage.sh |
| 59 | + ``` |
| 60 | + |
| 61 | + 4. 如果有安装`Termux:Widget`, 则可在桌面添加相应的小部件, 点击小部件上的`mass_storage.sh`即可执行此脚本. |
| 62 | + |
| 63 | +  |
| 64 | + |
| 65 | + 如果没有安装, 可直接在`Termux`中执行此脚本. |
| 66 | + |
| 67 | + 5. 如果希望开机时自动运行此脚本: |
| 68 | + |
| 69 | + 1. 安装 [Termux:Boot](https://wiki.termux.com/wiki/Termux:Boot). |
| 70 | + |
| 71 | + 2. 应用设置中授予 `Termux:Boot` 自启动权限 |
| 72 | + |
| 73 | + 3. 将 `mass_storage.sh` 拷贝至 `/data/data/com.termux/files/home/.termux/boot`, 并添加可执行权限. |
| 74 | + |
| 75 | + ```bash |
| 76 | + cp /data/data/com.termux/files/home/.shortcuts/mass_storage.sh /data/data/com.termux/files/home/.termux/boot |
| 77 | + chmod +x /data/data/com.termux/files/home/.termux/boot/mass_storage.sh |
| 78 | + ``` |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +注意事项: |
| 83 | + |
| 84 | +* PC 端向 USB Driver 中写入文件后, Android 无法感知文件系统的变化. 可以通过再次执行`mass_storage.sh`来刷新. |
| 85 | +* 同理, Android 端向镜像或块设备中写如文件后, PC也无法感知文件系统的变化. 可以通过重新插拔USB或再次执行`mass_storage.sh`来刷新. |
| 86 | +* PC 和 Android 端不要同时对文件系统进行写操作(如: 文件的移动, 复制, 重命名, 创建, 删除, 写入), 否则会损坏文件系统, 导致文件丢失. |
| 87 | +* 不要在没有副本的情况下, 包重要文件存放到上述脚本指定的镜像或块设备中. |
| 88 | + |
0 commit comments