From ae4259bc03e93353b0689906fa0582eec2f25af5 Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Tue, 5 Oct 2021 15:45:12 +0200 Subject: [PATCH] Add ser2net mDNS USB serial discovery * Add support for using multiple UsbSerialDiscovery services * Add Ser2NetUsbSerialDiscovery that can use mDNS to discover ser2net RFC2217 serial ports * Use discovered USB ports in SerialConfigOptionProvider mDNS discovery is supported in ser2net 4.3.0 and newer. E.g. you can install a ser2net version that provides this using APT in Ubuntu 21.04 and Debian 11. Example ser2net YAML configuration that allows a serial port to be discovered using mDNS discovery: %YAML 1.1 --- connection: &con01 accepter: telnet(rfc2217),tcp,2222 connector: serialdev,/dev/ttyUSB0 options: mdns: true mdns-sysattrs: true mdns-name: devicename Closes #1511 Signed-off-by: Wouter Born --- bom/openhab-core/pom.xml | 6 + .../.classpath | 29 +++ .../.project | 23 ++ .../NOTICE | 14 ++ .../pom.xml | 30 +++ .../internal/Ser2NetUsbSerialDiscovery.java | 202 ++++++++++++++++++ .../internal/UsbSerialDiscoveryService.java | 45 ++-- .../org.openhab.core.config.serial/pom.xml | 5 + .../internal/SerialConfigOptionProvider.java | 64 ++++-- .../rfc2217/internal/RFC2217PortProvider.java | 1 - bundles/pom.xml | 1 + .../openhab-core/src/main/feature/feature.xml | 1 + 12 files changed, 377 insertions(+), 44 deletions(-) create mode 100644 bundles/org.openhab.core.config.discovery.usbserial.ser2net/.classpath create mode 100644 bundles/org.openhab.core.config.discovery.usbserial.ser2net/.project create mode 100644 bundles/org.openhab.core.config.discovery.usbserial.ser2net/NOTICE create mode 100644 bundles/org.openhab.core.config.discovery.usbserial.ser2net/pom.xml create mode 100644 bundles/org.openhab.core.config.discovery.usbserial.ser2net/src/main/java/org/openhab/core/config/discovery/usbserial/ser2net/internal/Ser2NetUsbSerialDiscovery.java diff --git a/bom/openhab-core/pom.xml b/bom/openhab-core/pom.xml index 00c4a1dff15..ad505b5ef4e 100644 --- a/bom/openhab-core/pom.xml +++ b/bom/openhab-core/pom.xml @@ -316,6 +316,12 @@ ${project.version} compile + + org.openhab.core.bundles + org.openhab.core.config.discovery.usbserial.ser2net + ${project.version} + compile + org.openhab.core.bundles org.openhab.core.config.discovery.upnp diff --git a/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.classpath b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.classpath new file mode 100644 index 00000000000..4244343f8aa --- /dev/null +++ b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.classpath @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.project b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.project new file mode 100644 index 00000000000..30e9c110128 --- /dev/null +++ b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/.project @@ -0,0 +1,23 @@ + + + org.openhab.core.config.discovery.usbserial.ser2net + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/bundles/org.openhab.core.config.discovery.usbserial.ser2net/NOTICE b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/NOTICE new file mode 100644 index 00000000000..6c17d0d8a45 --- /dev/null +++ b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/NOTICE @@ -0,0 +1,14 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-core + diff --git a/bundles/org.openhab.core.config.discovery.usbserial.ser2net/pom.xml b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/pom.xml new file mode 100644 index 00000000000..1384c0fd078 --- /dev/null +++ b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + + + org.openhab.core.bundles + org.openhab.core.reactor.bundles + 3.2.0-SNAPSHOT + + + org.openhab.core.config.discovery.usbserial.ser2net + + openHAB Core :: Bundles :: Configuration USB-Serial Discovery using ser2net mDNS scanning + + + + org.openhab.core.bundles + org.openhab.core.config.discovery.usbserial + ${project.version} + + + org.openhab.core.bundles + org.openhab.core.io.transport.mdns + ${project.version} + + + + diff --git a/bundles/org.openhab.core.config.discovery.usbserial.ser2net/src/main/java/org/openhab/core/config/discovery/usbserial/ser2net/internal/Ser2NetUsbSerialDiscovery.java b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/src/main/java/org/openhab/core/config/discovery/usbserial/ser2net/internal/Ser2NetUsbSerialDiscovery.java new file mode 100644 index 00000000000..9c2a173a57f --- /dev/null +++ b/bundles/org.openhab.core.config.discovery.usbserial.ser2net/src/main/java/org/openhab/core/config/discovery/usbserial/ser2net/internal/Ser2NetUsbSerialDiscovery.java @@ -0,0 +1,202 @@ +/** + * Copyright (c) 2010-2021 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.discovery.usbserial.ser2net.internal; + +import java.time.Duration; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.jmdns.ServiceEvent; +import javax.jmdns.ServiceInfo; +import javax.jmdns.ServiceListener; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; +import org.openhab.core.config.discovery.usbserial.UsbSerialDiscovery; +import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryListener; +import org.openhab.core.io.transport.mdns.MDNSClient; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Wouter Born - Initial contribution + */ +@NonNullByDefault +@Component(service = UsbSerialDiscovery.class) +public class Ser2NetUsbSerialDiscovery implements ServiceListener, UsbSerialDiscovery { + + private final Logger logger = LoggerFactory.getLogger(Ser2NetUsbSerialDiscovery.class); + + private static final String SERVICE_TYPE = "_iostream._tcp.local."; + + private static final String PROPERTY_PROVIDER = "provider"; + private static final String PROPERTY_DEVICE_TYPE = "devicetype"; + private static final String PROPERTY_GENSIO_STACK = "gensiostack"; + + private static final String PROPERTY_VENDOR_ID = "idVendor"; + private static final String PROPERTY_PRODUCT_ID = "idProduct"; + + private static final String PROPERTY_SERIAL_NUMBER = "serial"; + private static final String PROPERTY_MANUFACTURER = "manufacturer"; + private static final String PROPERTY_PRODUCT = "product"; + + private static final String PROPERTY_INTERFACE_NUMBER = "bInterfaceNumber"; + private static final String PROPERTY_INTERFACE = "interface"; + + private static final String SER2NET = "ser2net"; + private static final String SERIALUSB = "serialusb"; + private static final String TELNET_RFC2217_TCP = "telnet(rfc2217),tcp"; + + private static final String SERIAL_PORT_NAME_FORMAT = "rfc2217://%s:%s"; + + private final Set discoveryListeners = new CopyOnWriteArraySet<>(); + private final MDNSClient mdnsClient; + + private boolean backgroundDiscoveryEnabled = false; + + private Set lastScanResult = new HashSet<>(); + + @Activate + public Ser2NetUsbSerialDiscovery(final @Reference MDNSClient mdnsClient) { + this.mdnsClient = mdnsClient; + } + + @Override + public void registerDiscoveryListener(UsbSerialDiscoveryListener listener) { + discoveryListeners.add(listener); + } + + @Override + public void unregisterDiscoveryListener(UsbSerialDiscoveryListener listener) { + discoveryListeners.remove(listener); + } + + @Override + public synchronized void startBackgroundScanning() { + backgroundDiscoveryEnabled = true; + mdnsClient.addServiceListener(SERVICE_TYPE, this); + logger.debug("Started ser2net USB-Serial mDNS background discovery"); + } + + @Override + public synchronized void stopBackgroundScanning() { + backgroundDiscoveryEnabled = false; + mdnsClient.removeServiceListener(SERVICE_TYPE, this); + logger.debug("Stopped ser2net USB-Serial mDNS background discovery"); + } + + @Override + public synchronized void doSingleScan() { + logger.debug("Starting ser2net USB-Serial mDNS single discovery scan"); + + Set scanResult = Stream.of(mdnsClient.list(SERVICE_TYPE, Duration.ofSeconds(5))) + .map(this::createUsbSerialDeviceInformation) // + .filter(Optional::isPresent) // + .map(Optional::get) // + .collect(Collectors.toSet()); + + Set added = setDifference(scanResult, lastScanResult); + Set removed = setDifference(lastScanResult, scanResult); + Set unchanged = setDifference(scanResult, added); + + lastScanResult = scanResult; + + removed.stream().forEach(this::announceRemovedDevice); + added.stream().forEach(this::announceAddedDevice); + unchanged.stream().forEach(this::announceAddedDevice); + + logger.debug("Completed ser2net USB-Serial mDNS single discovery scan"); + } + + private Set setDifference(Set set1, Set set2) { + Set result = new HashSet<>(set1); + result.removeAll(set2); + return Set.copyOf(result); + } + + private void announceAddedDevice(UsbSerialDeviceInformation deviceInfo) { + for (UsbSerialDiscoveryListener listener : discoveryListeners) { + listener.usbSerialDeviceDiscovered(deviceInfo); + } + } + + private void announceRemovedDevice(UsbSerialDeviceInformation deviceInfo) { + for (UsbSerialDiscoveryListener listener : discoveryListeners) { + listener.usbSerialDeviceRemoved(deviceInfo); + } + } + + @Override + public void serviceAdded(@NonNullByDefault({}) ServiceEvent event) { + if (backgroundDiscoveryEnabled) { + Optional deviceInfo = createUsbSerialDeviceInformation(event.getInfo()); + deviceInfo.ifPresent(this::announceAddedDevice); + } + } + + @Override + public void serviceRemoved(@NonNullByDefault({}) ServiceEvent event) { + if (backgroundDiscoveryEnabled) { + Optional deviceInfo = createUsbSerialDeviceInformation(event.getInfo()); + deviceInfo.ifPresent(this::announceRemovedDevice); + } + } + + @Override + public void serviceResolved(@NonNullByDefault({}) ServiceEvent event) { + serviceAdded(event); + } + + private Optional createUsbSerialDeviceInformation(ServiceInfo serviceInfo) { + String provider = serviceInfo.getPropertyString(PROPERTY_PROVIDER); + String deviceType = serviceInfo.getPropertyString(PROPERTY_DEVICE_TYPE); + String gensioStack = serviceInfo.getPropertyString(PROPERTY_GENSIO_STACK); + + // Check ser2net specific properties when present + if (SER2NET.equals(provider) && (deviceType != null && !SERIALUSB.equals(deviceType)) + || (gensioStack != null && !TELNET_RFC2217_TCP.equals(gensioStack))) { + logger.debug("Skipping creation of UsbSerialDeviceInformation based on {}", serviceInfo); + return Optional.empty(); + } + + try { + int vendorId = Integer.parseInt(serviceInfo.getPropertyString(PROPERTY_VENDOR_ID), 16); + int productId = Integer.parseInt(serviceInfo.getPropertyString(PROPERTY_PRODUCT_ID), 16); + + String serialNumber = serviceInfo.getPropertyString(PROPERTY_SERIAL_NUMBER); + String manufacturer = serviceInfo.getPropertyString(PROPERTY_MANUFACTURER); + String product = serviceInfo.getPropertyString(PROPERTY_PRODUCT); + + int interfaceNumber = Integer.parseInt(serviceInfo.getPropertyString(PROPERTY_INTERFACE_NUMBER), 16); + String interfaceDescription = serviceInfo.getPropertyString(PROPERTY_INTERFACE); + + String serialPortName = String.format(SERIAL_PORT_NAME_FORMAT, serviceInfo.getHostAddresses()[0], + serviceInfo.getPort()); + + UsbSerialDeviceInformation deviceInfo = new UsbSerialDeviceInformation(vendorId, productId, serialNumber, + manufacturer, product, interfaceNumber, interfaceDescription, serialPortName); + logger.debug("Created {} based on {}", deviceInfo, serviceInfo); + return Optional.of(deviceInfo); + } catch (NumberFormatException e) { + logger.debug("Failed to create UsbSerialDeviceInformation based on {}", serviceInfo, e); + return Optional.empty(); + } + } +} diff --git a/bundles/org.openhab.core.config.discovery.usbserial/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryService.java b/bundles/org.openhab.core.config.discovery.usbserial/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryService.java index 69893fbf9c0..3c358f19f81 100644 --- a/bundles/org.openhab.core.config.discovery.usbserial/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryService.java +++ b/bundles/org.openhab.core.config.discovery.usbserial/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryService.java @@ -47,14 +47,14 @@ * This discovery service is intended to be used by bindings that support USB devices, but do not directly talk to the * USB devices but rather use a serial port for the communication, where the serial port is provided by an operating * system driver outside the scope of openHAB. Examples for such USB devices are USB dongles that provide - * access to wireless networks, like, e.g., Zigbeee or Zwave dongles. + * access to wireless networks, like, e.g., Zigbee or Zwave dongles. *

* This discovery service provides functionality for discovering added and removed USB devices and the corresponding * serial ports. The actual {@link DiscoveryResult}s are then provided by {@link UsbSerialDiscoveryParticipant}s, which * are called by this discovery service whenever new devices are detected or devices are removed. Such * {@link UsbSerialDiscoveryParticipant}s should be provided by bindings accessing USB devices via a serial port. *

- * This discovery service requires a component implementing the interface {@link UsbSerialDiscovery}, which performs the + * This discovery service requires components implementing the interface {@link UsbSerialDiscovery}, which perform the * actual serial port and USB device discovery (as this discovery might differ depending on the operating system). * * @author Henning Sudbrock - Initial contribution @@ -70,10 +70,8 @@ public class UsbSerialDiscoveryService extends AbstractDiscoveryService implemen private static final String THING_PROPERTY_USB_PRODUCT_ID = "usb_product_id"; private final Set discoveryParticipants = new CopyOnWriteArraySet<>(); - private final Set previouslyDiscovered = new CopyOnWriteArraySet<>(); - - private @NonNullByDefault({}) UsbSerialDiscovery usbSerialDiscovery; + private final Set usbSerialDiscoveries = new CopyOnWriteArraySet<>(); public UsbSerialDiscoveryService() { super(5); @@ -83,7 +81,6 @@ public UsbSerialDiscoveryService() { @Activate protected void activate(@Nullable Map configProperties) { super.activate(configProperties); - usbSerialDiscovery.registerDiscoveryListener(this); } @Modified @@ -100,7 +97,7 @@ protected void deactivate() { @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addUsbSerialDiscoveryParticipant(UsbSerialDiscoveryParticipant participant) { - this.discoveryParticipants.add(participant); + discoveryParticipants.add(participant); for (UsbSerialDeviceInformation usbSerialDeviceInformation : previouslyDiscovered) { DiscoveryResult result = participant.createResult(usbSerialDeviceInformation); if (result != null) { @@ -110,19 +107,20 @@ protected void addUsbSerialDiscoveryParticipant(UsbSerialDiscoveryParticipant pa } protected void removeUsbSerialDiscoveryParticipant(UsbSerialDiscoveryParticipant participant) { - this.discoveryParticipants.remove(participant); + discoveryParticipants.remove(participant); } - @Reference - protected void setUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { - this.usbSerialDiscovery = usbSerialDiscovery; + @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) + protected void addUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { + usbSerialDiscoveries.add(usbSerialDiscovery); + usbSerialDiscovery.registerDiscoveryListener(this); } - protected synchronized void unsetUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { + protected synchronized void removeUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { usbSerialDiscovery.stopBackgroundScanning(); usbSerialDiscovery.unregisterDiscoveryListener(this); - this.usbSerialDiscovery = null; - this.previouslyDiscovered.clear(); + usbSerialDiscoveries.remove(usbSerialDiscovery); + previouslyDiscovered.clear(); } @Override @@ -133,30 +131,17 @@ public Set getSupportedThingTypes() { @Override protected void startScan() { - if (usbSerialDiscovery != null) { - usbSerialDiscovery.doSingleScan(); - } else { - logger.info("Could not scan, as there is no USB-Serial discovery service configured."); - } + usbSerialDiscoveries.forEach(UsbSerialDiscovery::doSingleScan); } @Override protected void startBackgroundDiscovery() { - if (usbSerialDiscovery != null) { - usbSerialDiscovery.startBackgroundScanning(); - } else { - logger.info( - "Could not start background discovery, as there is no USB-Serial discovery service configured."); - } + usbSerialDiscoveries.forEach(UsbSerialDiscovery::startBackgroundScanning); } @Override protected void stopBackgroundDiscovery() { - if (usbSerialDiscovery != null) { - usbSerialDiscovery.stopBackgroundScanning(); - } else { - logger.info("Could not stop background discovery, as there is no USB-Serial discovery service configured."); - } + usbSerialDiscoveries.forEach(UsbSerialDiscovery::stopBackgroundScanning); } @Override diff --git a/bundles/org.openhab.core.config.serial/pom.xml b/bundles/org.openhab.core.config.serial/pom.xml index 83f4ea7380c..22e833f0ed5 100644 --- a/bundles/org.openhab.core.config.serial/pom.xml +++ b/bundles/org.openhab.core.config.serial/pom.xml @@ -25,6 +25,11 @@ org.openhab.core.io.transport.serial ${project.version} + + org.openhab.core.bundles + org.openhab.core.config.discovery.usbserial + ${project.version} + diff --git a/bundles/org.openhab.core.config.serial/src/main/java/org/openhab/core/config/serial/internal/SerialConfigOptionProvider.java b/bundles/org.openhab.core.config.serial/src/main/java/org/openhab/core/config/serial/internal/SerialConfigOptionProvider.java index 99411929586..61ff6c1b1ae 100644 --- a/bundles/org.openhab.core.config.serial/src/main/java/org/openhab/core/config/serial/internal/SerialConfigOptionProvider.java +++ b/bundles/org.openhab.core.config.serial/src/main/java/org/openhab/core/config/serial/internal/SerialConfigOptionProvider.java @@ -13,43 +13,81 @@ package org.openhab.core.config.serial.internal; import java.net.URI; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import java.util.Locale; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.ConfigOptionProvider; import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; +import org.openhab.core.config.discovery.usbserial.UsbSerialDiscovery; +import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryListener; +import org.openhab.core.io.transport.serial.SerialPortIdentifier; import org.openhab.core.io.transport.serial.SerialPortManager; +import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; /** * This service provides serial port names as options for configuration parameters. * * @author Kai Kreuzer - Initial contribution + * @author Wouter Born - Add discovered USB serial port names to serial port parameter options */ +@NonNullByDefault @Component -public class SerialConfigOptionProvider implements ConfigOptionProvider { +public class SerialConfigOptionProvider implements ConfigOptionProvider, UsbSerialDiscoveryListener { - private SerialPortManager serialPortManager; + private final SerialPortManager serialPortManager; + private final Set previouslyDiscovered = new CopyOnWriteArraySet<>(); + private final Set usbSerialDiscoveries = new CopyOnWriteArraySet<>(); - @Reference - protected void setSerialPortManager(final SerialPortManager serialPortManager) { + @Activate + public SerialConfigOptionProvider(final @Reference SerialPortManager serialPortManager) { this.serialPortManager = serialPortManager; } - protected void unsetSerialPortManager(final SerialPortManager serialPortManager) { - this.serialPortManager = null; + @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) + protected void addUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { + usbSerialDiscoveries.add(usbSerialDiscovery); + usbSerialDiscovery.registerDiscoveryListener(this); + } + + protected synchronized void removeUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { + usbSerialDiscovery.unregisterDiscoveryListener(this); + usbSerialDiscoveries.remove(usbSerialDiscovery); + previouslyDiscovered.clear(); + } + + @Override + public void usbSerialDeviceDiscovered(UsbSerialDeviceInformation usbSerialDeviceInformation) { + previouslyDiscovered.add(usbSerialDeviceInformation); } @Override - public Collection getParameterOptions(URI uri, String param, String context, Locale locale) { - List options = new ArrayList<>(); + public void usbSerialDeviceRemoved(UsbSerialDeviceInformation usbSerialDeviceInformation) { + previouslyDiscovered.remove(usbSerialDeviceInformation); + } + + @Override + public @Nullable Collection getParameterOptions(URI uri, String param, @Nullable String context, + @Nullable Locale locale) { if ("serial-port".equals(context)) { - serialPortManager.getIdentifiers() - .forEach(id -> options.add(new ParameterOption(id.getName(), id.getName()))); + return Stream + .concat(serialPortManager.getIdentifiers().map(SerialPortIdentifier::getName), + previouslyDiscovered.stream().map(UsbSerialDeviceInformation::getSerialPort)) + .distinct() // + .map(serialPortName -> new ParameterOption(serialPortName, serialPortName)) // + .collect(Collectors.toList()); } - return options; + return null; } + } diff --git a/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/src/main/java/org/openhab/core/io/transport/serial/rxtx/rfc2217/internal/RFC2217PortProvider.java b/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/src/main/java/org/openhab/core/io/transport/serial/rxtx/rfc2217/internal/RFC2217PortProvider.java index fef063d36a3..1c25fb9ace6 100644 --- a/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/src/main/java/org/openhab/core/io/transport/serial/rxtx/rfc2217/internal/RFC2217PortProvider.java +++ b/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/src/main/java/org/openhab/core/io/transport/serial/rxtx/rfc2217/internal/RFC2217PortProvider.java @@ -49,7 +49,6 @@ public Stream getAcceptedProtocols() { @Override public Stream getSerialPortIdentifiers() { - // TODO implement discovery here. https://github.com/eclipse/smarthome/pull/5560 return Stream.empty(); } } diff --git a/bundles/pom.xml b/bundles/pom.xml index 101aeca02aa..748a9326d26 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -31,6 +31,7 @@ org.openhab.core.config.discovery.mdns org.openhab.core.config.discovery.usbserial org.openhab.core.config.discovery.usbserial.linuxsysfs + org.openhab.core.config.discovery.usbserial.ser2net org.openhab.core.config.discovery.upnp org.openhab.core.config.dispatch org.openhab.core.config.serial diff --git a/features/karaf/openhab-core/src/main/feature/feature.xml b/features/karaf/openhab-core/src/main/feature/feature.xml index c6af467b5b1..48f4e072a0a 100644 --- a/features/karaf/openhab-core/src/main/feature/feature.xml +++ b/features/karaf/openhab-core/src/main/feature/feature.xml @@ -466,6 +466,7 @@ mvn:org.openhab.core.bundles/org.openhab.core.config.serial/${project.version} mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial/${project.version} mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial.ser2net/${project.version} mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx/${project.version} mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/${project.version}