Adding DUMMY_DEVICE_DETECTORS to supplement dynamic UDEV rules

* USB devices that are **not** registering a detector that includes the VID and PID will need to specify these details separately to be added to the UDEV rules
at compile time
* Resolves #2440
This commit is contained in:
Chris 2022-05-08 22:35:09 +10:00 committed by Adam Honse
parent c4708eb39b
commit 2485c24560
6 changed files with 35 additions and 4 deletions

View file

@ -34,3 +34,8 @@ void DetectBlinkyTapeControllers(std::vector<RGBController*> &rgb_controllers)
}
REGISTER_DETECTOR("BlinkyTape", DetectBlinkyTapeControllers);
/*---------------------------------------------------------------------------------------------------------*\
| Entries for dynamic UDEV rules |
| |
| DUMMY_DEVICE_DETECTOR("BlinkyTape", DetectBlinkyTapeControllers, 0x1D50, 0x605E ) |
\*---------------------------------------------------------------------------------------------------------*/

View file

@ -71,10 +71,17 @@ void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectCorsairHydroControllers() */
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
/*---------------------------------------------------------------------------------------------------------*\
| Entries for dynamic UDEV rules |
| |
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, x0C12 ) |
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, x0C13 ) |
| DUMMY_DEVICE_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers, 0x1B1C, x0C15 ) |
\*---------------------------------------------------------------------------------------------------------*/

View file

@ -37,3 +37,8 @@ void DetectDygmaRaiseControllers(std::vector<RGBController*> &rgb_controllers)
}
REGISTER_DETECTOR("Dygma Raise", DetectDygmaRaiseControllers);
/*---------------------------------------------------------------------------------------------------------*\
| Entries for dynamic UDEV rules |
| |
| DUMMY_DEVICE_DETECTOR("Dygma Raise", DetectDygmaRaiseControllers, 0x1209, 0x2201 ) |
\*---------------------------------------------------------------------------------------------------------*/

View file

@ -77,3 +77,8 @@ void DetectLianLiUniHub(std::vector<RGBController*>&)
}
REGISTER_DETECTOR("Lian Li Uni Hub", DetectLianLiUniHub);
/*---------------------------------------------------------------------------------------------------------*\
| Entries for dynamic UDEV rules |
| |
| DUMMY_DEVICE_DETECTOR("Lian Li Uni Hub", DetectLianLiUniHub, 0x0CF2, 0x7750 ) |
\*---------------------------------------------------------------------------------------------------------*/

View file

@ -34,3 +34,8 @@ void DetectNZXTHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
} /* DetectHuePlusControllers() */
REGISTER_DETECTOR("NZXT Hue+", DetectNZXTHuePlusControllers);
/*---------------------------------------------------------------------------------------------------------*\
| Entries for dynamic UDEV rules |
| |
| DUMMY_DEVICE_DETECTOR("NZXT Hue+", DetectNZXTHuePlusControllers, 0x04D8, 0x00DF ) |
\*---------------------------------------------------------------------------------------------------------*/

View file

@ -38,9 +38,10 @@ echo -e "$UDEV_HEADER" > "$UDEV_FILE"
#-----------------------------------------------------------------------------#
echo -e "Creating device list"
HID_LIST=$(grep -hR -e "static\ HIDDeviceDetector" . | cut -d '(' -f 2- | awk -F , '{ print $2 ":|" $3 "|" $4 "|" $1 "|" }')
DUMMY_LIST=$( grep -hR -e DUMMY_DEVICE_DETECTOR ${CONTROLLER_PATH} | cut -d '(' -f 2- | cut -d ')' -f 1 | awk -F , '{ print $2 ":|" $3 "|" $4 "|" $1 "|" }')
#Check the output of the hid_list
# echo -e "$HID_LIST" >> "hid_list.txt"
# echo -e "$HID_LIST\n$DUMMY_LIST" >> "hid_list.txt"
#-----------------------------------------------------------------------------#
# Create a list of RGBController.cpp classes including path #
@ -68,7 +69,7 @@ do
while read -r detector
do
#Filter the list for all devices that use this detector
text=$(printf %s "$HID_LIST" | grep ${detector} | cut -d: -f 2- | sed -e 's/"//g')
text=$(printf '%s\n%s' "$HID_LIST" "$DUMMY_LIST" | grep ${detector} | cut -d: -f 2- | sed -e 's/"//g')
#Replace the detector string with the list of devices
detectors=${detectors/${detector}/${text}}
@ -88,7 +89,7 @@ do
#Check to ensure that the vid and pid are not blank
if [[ $vid = "" || $pid = "" ]]; then
echo -e "Blank VID or PID Skipping: ${udev_line}"
echo -e "Blank VID or PID Skipping: ${name} ${detector} ${udev_line}"
else
echo -e "$udev_line" >>"$UDEV_FILE"
fi
@ -100,6 +101,9 @@ done <<< "$FILE_LIST"
if [ -f "$UDEV_FILE" ]; then
outpath=$(readlink -f "$UDEV_FILE")
echo -e "Udev rules built at: $outpath"
#Clean up the preprocessor files if the rules file was created successfully
rm *.{ii,s}
else
echo -e "Something went wrong. No Udev file was found"
fi