-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Fiddian-Green <[email protected]>
- Loading branch information
Showing
9 changed files
with
425 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
bundles/org.openhab.core.config.discovery.usbserial.javaxusb/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="annotationpath" value="target/dependency"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="annotationpath" value="target/dependency"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
23 changes: 23 additions & 0 deletions
23
bundles/org.openhab.core.config.discovery.usbserial.javaxusb/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.core.config.discovery.usbserial.javaxusb</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
14 changes: 14 additions & 0 deletions
14
bundles/org.openhab.core.config.discovery.usbserial.javaxusb/NOTICE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
63 changes: 63 additions & 0 deletions
63
bundles/org.openhab.core.config.discovery.usbserial.javaxusb/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.core.bundles</groupId> | ||
<artifactId>org.openhab.core.reactor.bundles</artifactId> | ||
<version>4.1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.core.config.discovery.usbserial.javaxusb</artifactId> | ||
|
||
<name>openHAB Core :: Bundles :: Configuration USB-Serial Discovery via 'javax.usb'</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.openhab.core.bundles</groupId> | ||
<artifactId>org.openhab.core.config.discovery.usbserial</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.usb</groupId> | ||
<artifactId>usb-api</artifactId> | ||
<version>1.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.usb4java</groupId> | ||
<artifactId>usb4java-javax</artifactId> | ||
<version>1.3.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>3.1.1</version> | ||
<executions> | ||
<execution> | ||
<id>embed-dependencies</id> | ||
<goals> | ||
<goal>unpack-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<includeScope>runtime</includeScope> | ||
<includeTypes>jar</includeTypes> | ||
<includeGroupIds>org.usb4java,javax.usb</includeGroupIds> | ||
<outputDirectory>${project.build.directory}/classes</outputDirectory> | ||
<overWriteReleases>true</overWriteReleases> | ||
<overWriteSnapshots>true</overWriteSnapshots> | ||
<excludeTransitive>false</excludeTransitive> | ||
<type>jar</type> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
65 changes: 65 additions & 0 deletions
65
...b/core/config/discovery/usbserial/otheros/internal/JavaxUsbDeviceInformationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright (c) 2010-2023 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.otheros.internal; | ||
|
||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; | ||
|
||
/** | ||
* This is an information provider that provides additional information about known products. It is required because in | ||
* some cases the javax.usb USB scanner gets null values for manufacturer and product description strings, and this | ||
* provider can try to fill in null values as a fallback. | ||
* | ||
* @author Andrew Fiddian-Green - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class JavaxUsbDeviceInformationProvider { | ||
|
||
// @formatter:off | ||
private static final Set<UsbSerialDeviceInformation> KNOWN_DEVICES = Set.of( | ||
/* | ||
* ==== EnOcean sticks ==== | ||
*/ | ||
// the following generic is used in EnOcean sticks => EXCLUDE from being discovered | ||
new UsbSerialDeviceInformation(0x0403, 0x6001, null, "Future Technology Devices", "GENERIC", 0, null, ""), | ||
|
||
/* | ||
* ==== Zigbee sticks ==== | ||
*/ | ||
new UsbSerialDeviceInformation(0x0403, 0x8A28, null, "Future Technology Devices", "Rainforest Automation ZigBee", 0, null, ""), | ||
new UsbSerialDeviceInformation(0x0451, 0x16A8, null, "Texas Instruments", "ZigBee", 0, null, ""), | ||
new UsbSerialDeviceInformation(0x10C4, 0x89FB, null, "Silicon Laboratories", "ZigBee", 0, null, ""), | ||
new UsbSerialDeviceInformation(0x1CF1, 0x0030, null, "Dresden Elektronik", "ZigBee", 0, null, ""), | ||
|
||
/* | ||
* ==== Z-Wave sticks ==== | ||
*/ | ||
new UsbSerialDeviceInformation(0x0658, 0x0200, null, "Sigma Designs", "Aeotec / ZWave.me UZB Z-Wave", 0, null, ""), | ||
new UsbSerialDeviceInformation(0x1A86, 0x55D4, null, "Nanjing Qinheng Microelectronics", "Zooz 800 Z-Wave", 0, null, ""), | ||
|
||
/* | ||
* ==== Zigbee sticks || Z-Wave sticks ==== | ||
*/ | ||
// the following generic very common => EXCLUDE from being discovered | ||
new UsbSerialDeviceInformation(0x10C4, 0xEA60, null, "Silicon Laboratories", "Aeon Labs / Zooz 700 / sonoff / GENERIC", 0, null, "") | ||
); | ||
// @formatter:on | ||
|
||
public static Optional<UsbSerialDeviceInformation> getDeviceInformation(int vendorId, int productId) { | ||
return KNOWN_DEVICES.stream().filter(p -> (vendorId == p.getVendorId()) && (productId == p.getProductId())) | ||
.findFirst(); | ||
} | ||
} |
Oops, something went wrong.