Created
February 3, 2022 23:52
-
-
Save Langerz82/8484ad88905460db4586949a0ea4fd5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
check_guid() { | |
JSI="$1" | |
DEVICE_GUID="$2" | |
#echo "DEVICE_GUID=$DEVICE_GUID" | |
#v=${DEVICE_GUID:0:8} | |
#part1=$(echo ${v:6:2}${v:4:2}${v:2:2}${v:0:2}) # Bus, generally not needed | |
v=${DEVICE_GUID:8:8} | |
part2=$(echo ${v:6:2}${v:4:2}${v:2:2}${v:0:2}) # Vendor | |
v=${DEVICE_GUID:16:8} | |
part3=$(echo ${v:6:2}${v:4:2}${v:2:2}${v:0:2}) # Product | |
v=${DEVICE_GUID:24:8} | |
part4=$(echo ${v:6:2}${v:4:2}${v:2:2}${v:0:2}) # Version | |
input_vendor=$(echo ${part2} | sed 's/^0*//') | |
echo "input_vendor=$input_vendor" | |
input_product=$(echo ${part3} | sed 's/^0*//') | |
echo "input_product=$input_product" | |
input_version=$(echo ${part4} | sed 's/^0*//') | |
echo "input_version=$input_version" | |
[[ -z "input_vendor" ]] && input_vendor=0 | |
[[ -z "input_product" ]] && input_product=0 | |
[[ -z "input_version" ]] && input_version=0 | |
EE_DEV=$(cat /proc/bus/input/devices | grep -E -A 6 "Vendor=[0]*${input_vendor}" | grep -E -A 6 "Product=[0]*${input_product}" | grep -E -A 6 "Version=[0]*${input_version}" | grep -E "H: Handlers=.*js.*" | grep ${JSI}) | |
echo "EE_DEV=$EE_DEV" | |
[[ -z "${EE_DEV}" ]] && return 0 | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment