Skip to content

Commit 1f3415b

Browse files
Chr1sNoCalcProgrammer1
authored andcommitted
Changed UDEV build-udev-rules.sh to allow for DOS encoded files
1 parent 9200834 commit 1f3415b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/build-udev-rules.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ echo -e "$UDEV_HEADER" > "$UDEV_FILE"
3939
echo -e "Creating device list"
4040
HID_LIST=$(grep -hR -e "static\ HIDDeviceDetector" . | cut -d '(' -f 2- | awk -F , '{ print $2 ":|" $3 "|" $4 "|" $1 "|" }')
4141

42+
#Check the output of the hid_list
43+
# echo -e "$HID_LIST" >> "hid_list.txt"
44+
4245
#-----------------------------------------------------------------------------#
4346
# Create a list of RGBController.cpp classes including path #
4447
#-----------------------------------------------------------------------------#
4548
echo -e "Creating file list to parse metadata"
4649
FILE_LIST=$(find ${CONTROLLER_PATH} | grep RGBController_ | grep cpp)
4750

51+
#Check the output of the file_list
52+
# echo -e "$FILE_LIST" >> "file_list.txt"
53+
4854
#-----------------------------------------------------------------------------#
4955
# Iterate over the Controller file list and repplace the detectors #
5056
# for each controller with the list of PIDs #
@@ -53,9 +59,9 @@ while read -r controller
5359
do
5460
DATA=$(awk -v RS='' '/\/\*\*/' ${controller})
5561

56-
name=$(printf %s "$DATA" | grep @name | sed -e 's/@name//g' -e 's/^ *//g')
57-
type=$(printf %s "$DATA" | grep @type | sed -e 's/@type//g' -e 's/^ *//g')
58-
detectors=$(printf %s "$DATA" | grep @detectors | sed -e 's/@detectors *//g' -e 's/^ *//g' -e 's/\,/\n/g')
62+
name=$(printf %s "$DATA" | grep @name | sed -e 's/\r$//' -e 's/@name//g' -e 's/^ *//g')
63+
type=$(printf %s "$DATA" | grep @type | sed -e 's/\r$//' -e 's/@type//g' -e 's/^ *//g')
64+
detectors=$(printf %s "$DATA" | grep @detectors | sed -e 's/\r$//' -e 's/@detectors *//g' -e 's/^ *//g' -e 's/\,/\n/g')
5965

6066
if [[ $type = USB || $type = Serial ]]; then #Check that the type is USB
6167
## Iterate over the comma seperated detector function list
@@ -79,7 +85,7 @@ do
7985
device_name=${device_name//[^[:alnum:][:blank:]]/}
8086

8187
udev_line=$(printf 'SUBSYSTEMS=="%s|hidraw", ATTRS{idVendor}=="%s", ATTRS{idProduct}=="%s", TAG+="uaccess", TAG+="%s"\n' ${type,,} ${vid,,} ${pid,,} ${device_name// /_})
82-
88+
8389
#Check to ensure that the vid and pid are not blank
8490
if [[ $vid = "" || $pid = "" ]]; then
8591
echo -e "Blank VID or PID Skipping: ${udev_line}"

0 commit comments

Comments
 (0)