Fix naming
This commit is contained in:
parent
da7b8c476c
commit
138fd917c6
4
definitions/keyboard-standard
Normal file
4
definitions/keyboard-standard
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
protocol="1"
|
||||||
|
subclass="1"
|
||||||
|
report_length="8"
|
||||||
|
report_name="keyboard-standard"
|
@ -1,4 +0,0 @@
|
|||||||
protocols="1"
|
|
||||||
subclasses="1"
|
|
||||||
report_lengths="1"
|
|
||||||
report_names="keyboard-standard"
|
|
@ -1,6 +1,6 @@
|
|||||||
id=ghid
|
id=ghid
|
||||||
name=ghid
|
name=ghid
|
||||||
version=0
|
version=0
|
||||||
versionCode=23
|
versionCode=26
|
||||||
author=lordwelch
|
author=lordwelch
|
||||||
description=creates ghid device files in /dev
|
description=creates ghid device files in /dev
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# $1 setup
|
# $1 setup
|
||||||
controller=$(getprop sys.usb.controller)
|
controller=$(getprop sys.usb.controller)
|
||||||
moddir=[MODDIR]
|
moddir=[MODDIR]
|
||||||
selected=standard-keyboard
|
selected=keyboard-standard
|
||||||
remove_ghid() {
|
remove_ghid() {
|
||||||
echo "disabling ghid" >>$moddir/ghid.log
|
echo "disabling ghid" >>$moddir/ghid.log
|
||||||
rm /config/usb_gadget/g1/configs/b.1/fhid
|
rm /config/usb_gadget/g1/configs/b.1/fhid
|
||||||
@ -10,38 +10,43 @@ remove_ghid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enable_ghid() {
|
enable_ghid() {
|
||||||
echo "enabling ghid" >>$moddir/ghid.log
|
for f in $selected; do
|
||||||
running=true
|
echo "enabling ghid" >>$moddir/ghid.log
|
||||||
. "$moddir/definitions/$selected"
|
running=true
|
||||||
if [ ! -d /config/usb_gadget/g1/functions/hid.usb0 ]; then
|
. "$moddir/definitions/$f"
|
||||||
mkdir /config/usb_gadget/g1/functions/hid.usb0
|
if [ ! -d /config/usb_gadget/g1/functions/hid.usb0 ]; then
|
||||||
fi
|
mkdir /config/usb_gadget/g1/functions/hid.usb0
|
||||||
current_protocols="$(cat /config/usb_gadget/g1/functions/hid.usb0/protocol)"
|
fi
|
||||||
current_subclasses="$(cat /config/usb_gadget/g1/functions/hid.usb0/subclass)"
|
current_protocol="$(cat /config/usb_gadget/g1/functions/hid.usb0/protocol)"
|
||||||
current_report_lengths="$(cat /config/usb_gadget/g1/functions/hid.usb0/report_length)"
|
current_subclass="$(cat /config/usb_gadget/g1/functions/hid.usb0/subclass)"
|
||||||
echo "current ghid" >>$moddir/ghid.log
|
current_report_length="$(cat /config/usb_gadget/g1/functions/hid.usb0/report_length)"
|
||||||
echo current_protocols $current_protocols >>$moddir/ghid.log
|
echo "current ghid" >>$moddir/ghid.log
|
||||||
echo current_subclasses $current_subclasses >>$moddir/ghid.log
|
echo current_protocol $current_protocol >>$moddir/ghid.log
|
||||||
echo current_report_lengths $current_report_lengths >>$moddir/ghid.log
|
echo current_subclass $current_subclass >>$moddir/ghid.log
|
||||||
|
echo current_report_length $current_report_length >>$moddir/ghid.log
|
||||||
|
|
||||||
if [ -e /config/usb_gadget/g1/functions/hid.usb0 -a "$current_protocols" == "$protocols" -a "$current_subclasses" == "$subclasses" -a "$current_report_lengths" == "$report_lengths" ] && diff "$moddir/reports/$report_names" /config/usb_gadget/g1/functions/hid.usb0/report_desc ; then
|
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
|
||||||
echo nothing to update >>$moddir/ghid.log
|
echo nothing to update >>$moddir/ghid.log
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo new ghid >>$moddir/ghid.log
|
echo new ghid >>$moddir/ghid.log
|
||||||
|
|
||||||
echo $protocols >>$moddir/ghid.log
|
echo $protocol >>$moddir/ghid.log
|
||||||
echo $subclasses >>$moddir/ghid.log
|
echo $subclass >>$moddir/ghid.log
|
||||||
echo $report_lengths >>$moddir/ghid.log
|
echo $report_length >>$moddir/ghid.log
|
||||||
|
|
||||||
|
rm /config/usb_gadget/g1/configs/b.1/fhid
|
||||||
|
echo $protocol >/config/usb_gadget/g1/functions/hid.usb0/protocol
|
||||||
|
echo $subclass >/config/usb_gadget/g1/functions/hid.usb0/subclass
|
||||||
|
echo $report_length >/config/usb_gadget/g1/functions/hid.usb0/report_length
|
||||||
|
cp "$moddir/reports/$report_name" /config/usb_gadget/g1/functions/hid.usb0/report_desc
|
||||||
|
cd /config/usb_gadget/g1/configs/b.1/
|
||||||
|
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
||||||
|
done
|
||||||
|
echo none >/config/usb_gadget/g1/UDC
|
||||||
|
echo "$controller" >/config/usb_gadget/g1/UDC
|
||||||
|
|
||||||
rm /config/usb_gadget/g1/configs/b.1/fhid
|
|
||||||
echo $protocols >/config/usb_gadget/g1/functions/hid.usb0/protocol
|
|
||||||
echo $subclasses >/config/usb_gadget/g1/functions/hid.usb0/subclass
|
|
||||||
echo $report_lengths >/config/usb_gadget/g1/functions/hid.usb0/report_length
|
|
||||||
cp "$moddir/reports/$report_names" /config/usb_gadget/g1/functions/hid.usb0/report_desc
|
|
||||||
cd /config/usb_gadget/g1/configs/b.1/
|
|
||||||
/data/adb/magisk/busybox ln -nsf ../../../../usb_gadget/g1/functions/hid.usb0 ./fhid
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo success ghid was run >>$moddir/ghid.log
|
echo success ghid was run >>$moddir/ghid.log
|
||||||
@ -59,3 +64,8 @@ case "$1" in
|
|||||||
enable_ghid
|
enable_ghid
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
chcon u:object_r:null_device:s0 /dev/hidg*
|
||||||
|
chmod 666 /dev/hidg*
|
||||||
|
sleep 1
|
||||||
|
chcon u:object_r:null_device:s0 /dev/hidg*
|
||||||
|
chmod 666 /dev/hidg*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user