projects
/
linux-usb-otg
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
39d79fc
)
insert or eject file from gadget mass storage
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 10 Oct 2017 14:28:22 +0000
(16:28 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 10 Oct 2017 14:28:22 +0000
(16:28 +0200)
mass-storage-file.sh
[new file with mode: 0755]
patch
|
blob
diff --git a/mass-storage-file.sh
b/mass-storage-file.sh
new file mode 100755
(executable)
index 0000000..
5a32bfa
--- /dev/null
+++ b/
mass-storage-file.sh
@@ -0,0
+1,15
@@
+#!/bin/sh
+
+FILE=/sys/kernel/config/usb_gadget/g1/configs/c.1/mass_storage.usb0/lun.0/file
+
+if [ -z "$1" ] ; then
+ echo "EJECT "`cat $FILE`
+ sudo sh -c "echo '' > $FILE"
+elif [ -e "$1" ] ; then
+ sudo sh -c "readlink -f $1 > $FILE"
+ echo "INSERT "`cat $FILE`
+else
+ echo "Usage: $0 /path/to/disk.img"
+ exit 1
+fi
+