Skip to content

Commit a6623d3

Browse files
committed
update readme
1 parent 156520a commit a6623d3

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

README.md

+38-34
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,63 @@
44

55
## English Description
66

7-
Basic function: Use the usb gadget driver to make the specified image or block device accessible by the PC as a USB Drive; at the same time, mount the image or block device to the Android local.
7+
### Use case:
88

9+
* Transfer file between PC and Android without `MTP`. Mass Storage is more compatible than `MTP`.
10+
* Boot from an ISO or PE image for PC system maintenance without burning a disk.
911

1012

11-
Scenes to be used:
13+
### How it works:
1214

13-
* Get rid of `MTP`, realize file transfer between PC and Android, Mass Storage is more compatible than MTP.
14-
* Use a mobile phone to replace a physical USB flash drive.
15-
* Use an existing iso or pe image for PC system maintenance, no need to burn the disk.
15+
This script create a virtual usb flash disk with an image, and mount the image on Android. So that you can access the files in the image on both Android and PC.
1616

17+
---
1718

19+
**The UMSInterface APP is no longer maintained. If you still want to use the APP, refer to the [APP Description](https://github.com/outofmemo/UMS-Interface/blob/master/README-app.md).**
1820

19-
**The UMSInterface APP is no longer maintained. If you still want to use this APP, please refer to the [APP Description](https://github.com/outofmemo/UMS-Interface/blob/master/README-app.md).**
2021

2122

23+
As an alternative, a shell script is provided to realize roughly the same function. This method requires users to have a certain understanding of linux and shell.
2224

23-
As an alternative, the following provides an example of a shell script based on the Termux environment to accomplish roughly the same function. This method requires users to have a certain understanding of linux and shell. At the same time, mounting/unmounting partitions, and operations on block devices are High-risk operations, if the user is not familiar with the Linux environment, it may brick the phone.
25+
---
2426

27+
Alternative method:
2528

29+
1. This script is based on `Termux` environment, please install `Termux` APP first.
2630

27-
The alternative method is as follows:
31+
In order to run the script conveniently, it is recommended to install [Termux:Widget](https://wiki.termux.com/wiki/Termux:Widget).
2832

29-
1. This shell script running environment is based on Termux, please install Termux first.
33+
In order to show toast messages, [Termux:API](https://wiki.termux.com/wiki/Termux:API) is needed.
3034

31-
In order to facilitate one-click operation, it is recommended to install [Termux:Widget](https://wiki.termux.com/wiki/Termux:Widget).
32-
33-
In order to display toast messages conveniently, it is recommended to install [Termux:API](https://wiki.termux.com/wiki/Termux:API).
34-
35-
Newer packages do not come with the `mount` command, you need to install `mount-utils` additionally in `Termux`: `pkg install mount-utils`.
35+
For new `Termux` which has no `mount` command, install `mount-utils` additionally in `Termux` by `pkg install mount-utils`.
3636

3737
2. Copy [mass_storage.sh](https://github.com/outofmemo/UMS-Interface/blob/master/mass_storage.sh) to `/data/data/com.termux/files/home/.shortcuts/`.
3838

39-
Some of the parameters can be modified according to actual conditions. For example:
39+
Some of the parameters can be modified when needed. For example:
4040

4141
https://github.com/outofmemo/UMS-Interface/blob/87ce4fe5ae81baaf5a846c680f3fcff3fed9292e/mass_storage.sh#L17
4242

43-
* `default_size_mb`: The size of the image created by default, unit: MB.
43+
* `default_size_mb`: The size(MB) of the image created by default.
4444
* `dst`: Mount point path. Leave blank to not mount.
4545
* `src`: Image or block device path.
4646
* You can specify a path that does not exist, and an empty image will be created automatically.
47-
* You can specify a block device path. But be careful to do so, otherwise operating errors may cause the phone to become bricked.
48-
* You can specify an existing image. For example, you can specify an iso image or a pe disk image for PC system maintenance. You can also specify a disk image copied with `dd` command.
47+
* You can specify a block device path. **DO NOT DO IT, if you have no idea what it means.**
48+
* You can specify an existing image. For example, you can specify an iso image or a PE disk image for PC system maintenance. You can also specify a disk image copied with `dd` command.
4949

5050
3. Add executable permissions to `mass_storage.sh`:
5151

5252
```bash
5353
chmod +x /data/data/com.termux/files/home/.shortcuts/mass_storage.sh
5454
```
5555

56-
4. If `Termux: Widget` is installed, you can add the corresponding widget on the desktop, and click `mass_storage.sh` on the widget to execute this script.
57-
58-
If it is not installed, you can execute this script directly in `Termux`.
56+
4. If `Termux: Widget` is installed, you can add the widget to desktop, so that you can execute the script by clicking the widget.
5957

6058
![](https://raw.githubusercontent.com/outofmemo/UMS-Interface/master/screenshots/widget.png)
6159

60+
Or you can run `adb shell am start-activity -n com.termux.widget/.TermuxCreateShortcutActivity` to create a shortcut for the script.
61+
62+
If `Termux: Widget` is not installed, you can execute the script in `Termux`: `bash /data/data/com.termux/files/home/.shortcuts/mass_storage.sh`.
63+
6264
5. If you want to run this script automatically at boot:
6365

6466
1. Install [Termux:Boot](https://wiki.termux.com/wiki/Termux:Boot).
@@ -74,14 +76,15 @@ The alternative method is as follows:
7476

7577

7678

77-
Precautions:
78-
79-
* After the PC writes the file to the USB Driver, Android cannot perceive the file system changes. You can refresh by executing `mass_storage.sh` again.
80-
* After the Android writes a file to the image or block device, the PC cannot perceive the change of the file system. You can refresh it by plugging and unplugging the USB or executing `mass_storage.sh` again.
81-
* Do not write to the file system at the same time on the PC and Android (such as: file movement, copy, rename, create, delete, write), otherwise the file system will be damaged and the file will be lost.
82-
* Don't store important files in the image or block device specified by the above script without a copy.
79+
Notice:
8380

81+
* After PC writes a file to the USB Driver, Android cannot perceive the file system changes. You can refresh by executing `mass_storage.sh` again.
82+
* After Android writes a file to the image or block device, PC cannot perceive the change. You can refresh it by plugging and unplugging the USB or executing `mass_storage.sh` again.
83+
* **Do not write to the file system at the same time on PC and Android** (such as: file movement, copy, rename, create, delete, write), otherwise the file system will be damaged and the file will be lost.
84+
* **Don't store important files** in the image or block device used by this script without backup.
8485
86+
---
87+
---
8588
8689
## 中文描述
8790
@@ -92,7 +95,6 @@ Precautions:
9295
使用场景:
9396
9497
* 摆脱`MTP`, 实现PC与Android的文件传输, Mass Storage 比 MTP 兼容性更好.
95-
* 替代实体U盘, 携带手机后, 无需再带U盘.
9698
* 使用已有的iso或pe镜像, 用于PC系统维护, 无需刻盘, 替代PC启动盘.
9799
98100
@@ -101,7 +103,7 @@ Precautions:
101103
102104
103105
104-
作为替代, 下面提供一个基于`Termux`环境的shell脚本示例, 来完成大致相同的功能. 此方法需要使用者对linux和shell有一定的了解. 同时, 挂载/卸载分区, 以及对块设备的操作本来就是高危操作, 如果使用者对linux环境不熟悉, 可能会使手机变砖.
106+
作为替代, 下面提供一个基于`Termux`环境的shell脚本示例, 来完成大致相同的功能. 此方法需要使用者对linux和shell有一定的了解.
105107
106108
107109
@@ -125,7 +127,7 @@ Precautions:
125127
* `dst`: 挂载点路径. 留空则不挂载.
126128
* `src`: 镜像文件或块设备路径.
127129
* 可以指定一个不存在的路径, 此时会自动创建一个空的镜像.
128-
* 可以指定一个块设备路径. 但要谨慎这么做, 否则操作失误可能会导致手机无法启动.
130+
* 可以指定一个块设备路径. 但要谨慎这么做, 否则**操作失误可能会导致手机无法启动**.
129131
* 可以指定一个已存在的镜像. 比如可以指定iso镜像 或 pe磁盘镜像用于PC的系统维护. 或者也可以指定一个使用`dd`命令拷贝的磁盘镜像.
130132
131133
3. 为`mass_storage.sh`添加可执行权限:
@@ -136,10 +138,12 @@ Precautions:
136138
137139
4. 如果有安装 `Termux:Widget`, 则可在桌面添加相应的小部件, 点击小部件上的 `mass_storage.sh` 即可执行此脚本.
138140
139-
如果没有安装, 可直接在 `Termux` 中执行此脚本.
140-
141141
![](https://raw.githubusercontent.com/outofmemo/UMS-Interface/master/screenshots/widget.png)
142142
143+
或执行 `adb shell am start-activity -n com.termux.widget/.TermuxCreateShortcutActivity` 来创建脚本的桌面快捷方式.
144+
145+
如果没有安装, 可直接在 `Termux` 中执行此脚本.
146+
143147
5. 如果希望开机时自动运行此脚本:
144148
145149
1. 安装 [Termux:Boot](https://wiki.termux.com/wiki/Termux:Boot).
@@ -159,6 +163,6 @@ Precautions:
159163
160164
* PC 端向 USB Driver 中写入文件后, Android 无法感知文件系统的变化. 可以通过再次执行 `mass_storage.sh` 来刷新.
161165
* 同理, Android 端向镜像或块设备中写入文件后, PC也无法感知文件系统的变化. 可以通过重新插拔USB或再次执行 `mass_storage.sh` 来刷新.
162-
* PC 和 Android 端不要同时对文件系统进行写操作(如: 文件的移动, 复制, 重命名, 创建, 删除, 写入), 否则会损坏文件系统, 导致文件丢失.
163-
* 不要在没有副本的情况下, 把重要文件存放到上述脚本指定的镜像或块设备中.
166+
* **PC 和 Android 端不要同时对文件系统进行写操作**(如: 文件的移动, 复制, 重命名, 创建, 删除, 写入), 否则会损坏文件系统, 导致文件丢失.
167+
* **不要在没有副本的情况下, 把重要文件存放到上述脚本指定的镜像或块设备中**.
164168

0 commit comments

Comments
 (0)