24 lines
1.1 KiB
Bash
24 lines
1.1 KiB
Bash
#!/system/bin/sh
|
|
$BOOTMODE || abort "! must be installed in the running system"
|
|
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"
|
|
else
|
|
test -d /config/usb_gadget || abort "! kernel does not have the required modules"
|
|
mkdir /config/usb_gadget/g1 || 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
|
|
chmod 755 "$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"
|
|
{
|
|
grep -v /dev/hidg /system_ext/etc/selinux/system_ext_file_contexts
|
|
echo "/dev/hidg[0-9]+ u:object_r:null_device:s0"
|
|
} >"$MODPATH/system/system_ext/etc/selinux/system_ext_file_contexts"
|
|
|
|
{
|
|
grep -v /dev/hidg /system/etc/ueventd.rc
|
|
echo "/dev/hidg* 0666 root root"
|
|
} >"$MODPATH/system/etc/ueventd.rc"
|