-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable / Disable support for USB Gadget (allows background updates)
File correctly placed for installation
- Loading branch information
Showing
6 changed files
with
83 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
[Unit] | ||
Description=My USB gadget | ||
After=systemd-modules-load.service apache2.service | ||
Description=USB Gadget Service | ||
After=systemd-modules-load.service | ||
Before=networking.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/usr/local/bin/myusbgadget | ||
ExecStart=/usr/local/bin/usbgadget_enable.sh | ||
ExecStop=/usr/local/bin//usbgadget_disable.sh | ||
|
||
[Install] | ||
WantedBy=sysinit.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
if [ "$(whoami)" != "root" ]; then | ||
echo "This script needs to be run as root. Please use sudo." | ||
exit 1 | ||
fi | ||
|
||
echo "Stopping USB Gadget..." | ||
|
||
echo "" > /sys/kernel/config/usb_gadget/g/UDC | ||
# sh -c "echo '' > /sys/kernel/config/usb_gadget/g/UDC" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
if [ "$(whoami)" != "root" ]; then | ||
echo "This script needs to be run as root. Please use sudo." | ||
exit 1 | ||
fi | ||
|
||
echo "Starting USB Gadget..." | ||
|
||
if [ ! -d "/sys/kernel/config/usb_gadget/g/configs/c.1" ]; then | ||
# usb gadget not yet created | ||
/usr/local/bin/myusbgadget | ||
fi | ||
|
||
ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/g/UDC | ||
|