Fixes to Automatic UDEV generation

+ Removing blank vid & pids entries to avoid `invalid value` warnings
+ Changing incorrect syntax from `ATTR` to `ATTRS`
+ Adding `Release` build check to .pro to work around code syntax highlighting issue in QTcreator
This commit is contained in:
Chris 2022-04-20 01:04:19 +10:00
parent 0b515ba901
commit 30c80adbe1
2 changed files with 26 additions and 18 deletions

View file

@ -78,8 +78,14 @@ do
pid=${pid/0x/}
device_name=${device_name//[^[:alnum:][:blank:]]/}
udev_line=$(printf 'SUBSYSTEMS=="%s|hidraw", ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", TAG+="uaccess", TAG+="%s"\n' ${type,,} ${vid,,} ${pid,,} ${device_name// /_})
echo -e "$udev_line" >>"$UDEV_FILE"
udev_line=$(printf 'SUBSYSTEMS=="%s|hidraw", ATTRS{idVendor}=="%s", ATTRS{idProduct}=="%s", TAG+="uaccess", TAG+="%s"\n' ${type,,} ${vid,,} ${pid,,} ${device_name// /_})
#Check to ensure that the vid and pid are not blank
if [[ $vid = "" || $pid = "" ]]; then
echo -e "Blank VID or PID Skipping: ${udev_line}"
else
echo -e "$udev_line" >>"$UDEV_FILE"
fi
done <<< "$text"
done <<< "$detectors"
fi