mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
[serial] Use a fast path to avoid pattern matching (#4255)
Signed-off-by: Jörg Sautter <joerg.sautter@gmx.net>
This commit is contained in:
parent
a5a7eee9a8
commit
9068ab2fac
@ -222,7 +222,10 @@ public class SysfsUsbSerialScanner implements UsbSerialScanner {
|
||||
* of a USB device.
|
||||
*/
|
||||
private @Nullable Path getUsbInterfaceParentPath(Path sysfsPath) {
|
||||
if (sysfsPath.getFileName() == null) {
|
||||
if (sysfsPath.toString().indexOf('-') == -1) {
|
||||
// a fast path to avoid pattern matching for dozens of not matching directories
|
||||
return null;
|
||||
} else if (sysfsPath.getFileName() == null) {
|
||||
return null;
|
||||
} else if (SYSFS_USB_INTERFACE_DIRECTORY_PATTERN.matcher(sysfsPath.getFileName().toString()).matches()) {
|
||||
return sysfsPath;
|
||||
|
Loading…
Reference in New Issue
Block a user