Fix shell issues
This commit is contained in:
parent
ff422dbc23
commit
195b558057
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/system/bin/sh
|
||||||
$BOOTMODE || abort "! must be installed in the running system"
|
$BOOTMODE || abort "! must be installed in the running system"
|
||||||
if [[ -e /proc/config.gz ]]; then
|
if [[ -e /proc/config.gz ]]; then
|
||||||
zcat /proc/config.gz | grep -Eq 'CONFIG_USB_(CONFIGFS_)?F_HID=[my]' || abort "! kernel does not have the required modules"
|
zcat /proc/config.gz | grep -Eq 'CONFIG_USB_(CONFIGFS_)?F_HID=[my]' || abort "! kernel does not have the required modules"
|
||||||
@ -8,7 +8,8 @@ else
|
|||||||
mkdir /config/usb_gadget/g1/functions/hid.usb0 || abort "! kernel does not have the required modules"
|
mkdir /config/usb_gadget/g1/functions/hid.usb0 || abort "! kernel does not have the required modules"
|
||||||
fi
|
fi
|
||||||
chmod 755 "$MODPATH/system/bin/ghid.sh"
|
chmod 755 "$MODPATH/system/bin/ghid.sh"
|
||||||
sed -i -e "s@\[MODDIR\]@${MODPATH%_update}@g" "$MODPATH/system/bin/ghid.sh"
|
chmod 755 "$MODPATH/service.sh"
|
||||||
|
sed -i -e "s@\[MODDIR\]@${MODPATH%_update/ghid}/ghid@g" "$MODPATH/system/bin/ghid.sh"
|
||||||
|
|
||||||
mkdir -p "$MODPATH/system/system_ext/etc/selinux/" "$MODPATH/system/etc"
|
mkdir -p "$MODPATH/system/system_ext/etc/selinux/" "$MODPATH/system/etc"
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
id=ghid
|
id=ghid
|
||||||
name=ghid
|
name=ghid
|
||||||
version=0.12.69
|
version=0.12.78
|
||||||
versionCode=69
|
versionCode=78
|
||||||
author=lordwelch
|
author=lordwelch
|
||||||
description=creates ghid device files in /dev
|
description=creates hidg device files in /dev
|
||||||
|
2
service.sh
Normal file → Executable file
2
service.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/system/bin/sh
|
||||||
ueventd=$(getprop init.svc.ueventd)
|
ueventd=$(getprop init.svc.ueventd)
|
||||||
if [ "$ueventd" = "running" ]; then
|
if [ "$ueventd" = "running" ]; then
|
||||||
# ueventd ensures that the correct permissions get applied, it may also apply the correct selabel, not sure
|
# ueventd ensures that the correct permissions get applied, it may also apply the correct selabel, not sure
|
||||||
|
29
system/bin/ghid.sh
Normal file → Executable file
29
system/bin/ghid.sh
Normal file → Executable file
@ -3,16 +3,16 @@
|
|||||||
controller=$(getprop sys.usb.controller)
|
controller=$(getprop sys.usb.controller)
|
||||||
moddir=[MODDIR]
|
moddir=[MODDIR]
|
||||||
|
|
||||||
exec >>$moddir/ghid.log
|
exec >>"$moddir"/ghid.log
|
||||||
exec 2>>$moddir/ghid.log
|
exec 2>>"$moddir"/ghid.log
|
||||||
date
|
date
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
set -o nohup
|
set -o nohup
|
||||||
set +o errexit
|
set +o errexit
|
||||||
set +o sh
|
set +o sh
|
||||||
set +o posix
|
set +o posix
|
||||||
exec >>$moddir/oghid.log
|
exec >>"$moddir"/oghid.log
|
||||||
exec 2>>$moddir/oghid.log
|
exec 2>>"$moddir"/oghid.log
|
||||||
|
|
||||||
remove_ghid() {
|
remove_ghid() {
|
||||||
echo "disabling ghid"
|
echo "disabling ghid"
|
||||||
@ -29,7 +29,7 @@ enable_ghid() {
|
|||||||
current_subclass="$(cat /config/usb_gadget/g1/functions/hid.usb0/subclass)"
|
current_subclass="$(cat /config/usb_gadget/g1/functions/hid.usb0/subclass)"
|
||||||
current_report_length="$(cat /config/usb_gadget/g1/functions/hid.usb0/report_length)"
|
current_report_length="$(cat /config/usb_gadget/g1/functions/hid.usb0/report_length)"
|
||||||
|
|
||||||
if [ -e /config/usb_gadget/g1/functions/hid.usb0 -a "$current_protocol" == "$protocol" -a "$current_subclass" == "$subclass" -a "$current_report_length" == "$report_length" ] && diff "$moddir/reports/$report_name" /config/usb_gadget/g1/functions/hid.usb0/report_desc; then
|
if [ -e /config/usb_gadget/g1/functions/hid.usb0 ] && [ "$current_protocol" = "$protocol" ] && [ "$current_subclass" = "$subclass" ] && [ "$current_report_length" = "$report_length" ] && diff "$moddir/reports/$report_name" /config/usb_gadget/g1/functions/hid.usb0/report_desc; then
|
||||||
echo nothing to update
|
echo nothing to update
|
||||||
cd /config/usb_gadget/g1/configs/b.1/
|
cd /config/usb_gadget/g1/configs/b.1/
|
||||||
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
||||||
@ -38,17 +38,24 @@ enable_ghid() {
|
|||||||
|
|
||||||
echo new ghid
|
echo new ghid
|
||||||
|
|
||||||
echo protocol: $protocol
|
echo protocol: "$protocol"
|
||||||
echo subclass: $subclass
|
echo subclass: "$subclass"
|
||||||
echo report_length: $report_length
|
echo report_length: "$report_length"
|
||||||
|
|
||||||
echo $protocol >/config/usb_gadget/g1/functions/hid.usb0/protocol
|
echo "$protocol" >/config/usb_gadget/g1/functions/hid.usb0/protocol
|
||||||
echo $subclass >/config/usb_gadget/g1/functions/hid.usb0/subclass
|
echo "$subclass" >/config/usb_gadget/g1/functions/hid.usb0/subclass
|
||||||
echo $report_length >/config/usb_gadget/g1/functions/hid.usb0/report_length
|
echo "$report_length" >/config/usb_gadget/g1/functions/hid.usb0/report_length
|
||||||
cat "$moddir/reports/$report_name" >/config/usb_gadget/g1/functions/hid.usb0/report_desc
|
cat "$moddir/reports/$report_name" >/config/usb_gadget/g1/functions/hid.usb0/report_desc
|
||||||
|
|
||||||
cd /config/usb_gadget/g1/configs/b.1/
|
cd /config/usb_gadget/g1/configs/b.1/
|
||||||
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
||||||
|
|
||||||
|
# Normally we would let init take care of this but if we are connected when we boot up,
|
||||||
|
# init will have already set this before we can setup the hid device
|
||||||
|
if [ "$(getprop sys.boot_completed)" != "1" ]; then
|
||||||
|
echo none >/config/usb_gadget/g1/UDC
|
||||||
|
echo "$controller" >/config/usb_gadget/g1/UDC
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
echo success ghid was run with: "$@"
|
echo success ghid was run with: "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user