Refactor repetitive device registration in BrailleDisplayDriver
Closed this issue · 1 comments
coderabbitai commented
Currently, the registerAutomaticDetection
method in the BrailleDisplayDriver
class contains repetitive code for registering USB devices. This could be refactored into a loop or a helper function to reduce redundancy and improve maintainability.
Suggested refactor:
device_types = {
bdDetect.DeviceType.HID: {'VID_045E&PID_940A'},
bdDetect.DeviceType.CUSTOM: {'VID_045E&PID_930A', 'VID_045E&PID_930B'},
bdDetect.DeviceType.SERIAL: {'VID_0403&PID_6001', 'VID_1A86&PID_55D3'}
}
for device_type, ids in device_types.items():
driverRegistrar.addUsbDevices(device_type, ids)
This issue was suggested in a PR review comment. For more context, see the PR at #16340 and the specific comment at #16340 (comment).