From 8db08aab9fe295acb68181ea470a3095e6d0f8d3 Mon Sep 17 00:00:00 2001 From: Manuel Bl Date: Wed, 3 Jan 2024 15:43:43 +0100 Subject: [PATCH] Prepare for release 0.7 --- .github/workflows/continuous-integration.yaml | 4 +- README.md | 27 ++++++++-- examples/bulk_transfer/README.md | 2 +- examples/bulk_transfer/pom.xml | 4 +- examples/enumerate/README.md | 2 +- examples/enumerate/pom.xml | 4 +- examples/enumerate_kotlin/README.md | 50 +++++++++++++++++++ examples/enumerate_kotlin/pom.xml | 37 +++++++++++--- examples/epaper_display/README.md | 4 +- examples/epaper_display/pom.xml | 4 +- examples/monitor/README.md | 2 +- examples/monitor/pom.xml | 4 +- examples/monitor_kotlin/README.md | 49 ++++++++++++++++++ examples/monitor_kotlin/pom.xml | 37 +++++++++++--- examples/stm_dfu/README.md | 2 +- examples/stm_dfu/pom.xml | 4 +- java-does-usb/pom.xml | 2 +- 17 files changed, 202 insertions(+), 36 deletions(-) create mode 100644 examples/enumerate_kotlin/README.md create mode 100644 examples/monitor_kotlin/README.md diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 1c554aa..deef007 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -47,13 +47,13 @@ jobs: run: ./mvnw $MAVEN_ARGS clean compile working-directory: ./examples/enumerate - name: Example "enumerate" (Kotlin) - run: ./mvnw $MAVEN_ARGS clean compile + run: ./mvnw $MAVEN_ARGS clean package working-directory: ./examples/enumerate_kotlin - name: Example "monitor" run: ./mvnw $MAVEN_ARGS clean compile working-directory: ./examples/monitor - name: Example "monitor" (Kotlin) - run: ./mvnw $MAVEN_ARGS clean compile + run: ./mvnw $MAVEN_ARGS clean package working-directory: ./examples/monitor_kotlin - name: Example "stm_dfu" run: ./mvnw $MAVEN_ARGS clean compile diff --git a/README.md b/README.md index 9d03245..7c9c48b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The library uses the [Foreign Function & Memory API](https://github.com/openjdk/ | Version | Main New Features | Compatibility | | - | - | - | -| 0.7.x | Prerelease: New setter/getter names for improved Kotlin support; Kotlin examples | JDK 21 | +| 0.7.x | New setter/getter names for improved Kotlin support; Kotlin examples | JDK 21 | | 0.6.x | Support for JDK 21; better handling of composite devices on Windows | JDK 21 | | 0.5.x | Support for JDK 20; high-throuput I/O streams | JDK 20 | | 0.4.x | Early release | JDK 19 | @@ -48,14 +48,14 @@ If you are using Maven, add the below dependency to your pom.xml: net.codecrete.usb java-does-usb - 0.6.1 + 0.7.0 ``` If you are using Gradle, add the below dependency to your build.gradle file: ```groovy -compile group: 'net.codecrete.usb', name: 'java-does-usb', version: '0.6.1' +compile group: 'net.codecrete.usb', name: 'java-does-usb', version: '0.7.0' ``` ```java @@ -134,9 +134,26 @@ The library has not been tested on Windows for ARM64. It might or might not work ### Troubleshooting -- The error `java.lang.ClassFormatError: Illegal field name "" in class net/codecrete/usb/windows/WindowsUsbDeviceRegistry` is caused by a bug in JDK 21, which has been fixed in the mean-time. Please upgrade to the latest release of JDK 21. +#### `ClassFormatError` (all platforms) -- The error `Cannot open library: CoreFoundation.framework/CoreFoundation` is caused by an unfortunate build of the OpenJDK by Homebrew. Please use any other JDK edition instead, e.g. Zulu (`brew install zulu` or directly from https://www.azul.com/downloads/#zulu), Temurin (`brew install temurin` or from https://adoptium.net/en-GB/temurin/releases/), or download the official OpenJDK directly from https://openjdk.org/projects/jdk/21/. And don't forget to uninstall the Homebrew build (`brew uninstall openjdk`). +The error `java.lang.ClassFormatError: Illegal field name "" in class net/codecrete/usb/windows/WindowsUsbDeviceRegistry` is caused by a bug in JDK 21, which has been fixed in the mean-time. Please upgrade to the latest release of JDK 21 (at least 21.0.1). + + +#### `Cannot open library` (macOS only) + +The error `Cannot open library: CoreFoundation.framework/CoreFoundation` is caused by an unfortunate build of the OpenJDK by Homebrew. Please use any other JDK edition instead, e.g. Zulu (`brew install zulu` or directly from https://www.azul.com/downloads/#zulu), Temurin (`brew install temurin` or from https://adoptium.net/en-GB/temurin/releases/), or download the official OpenJDK directly from https://openjdk.org/projects/jdk/21/. + +It will usually not be possible to uninstall the problematic build (`brew uninstall openjdk`) as it is a dependency of other brew packages. So to run an application, set `JAVA_HOME`: + +```shell +export JAVA_HOME=/Users/me/Documents/zulu21.30.15-ca-jdk21.0.1-macosx_aarch64 +``` + +If the JDK was "installed" as opposed to downloaded, the path for `JAVA_HOME` will likely be listed by: + +```sheel +/usr/libexec/java_home -V +``` ### 32-bit versions diff --git a/examples/bulk_transfer/README.md b/examples/bulk_transfer/README.md index 13d6e6e..372082e 100644 --- a/examples/bulk_transfer/README.md +++ b/examples/bulk_transfer/README.md @@ -39,7 +39,7 @@ $ mvn compile exec:exec [INFO] Scanning for projects... [INFO] [INFO] --------------< net.codecrete.usb.examples:bulk-transfer >-------------- -[INFO] Building bulk-transfer 0.6.1 +[INFO] Building bulk-transfer 0.7.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ bulk-transfer --- diff --git a/examples/bulk_transfer/pom.xml b/examples/bulk_transfer/pom.xml index 8e34bba..cfe4587 100644 --- a/examples/bulk_transfer/pom.xml +++ b/examples/bulk_transfer/pom.xml @@ -6,7 +6,7 @@ net.codecrete.usb.examples bulk-transfer - 0.6.1 + 0.7.0 bulk-transfer https://github.com/manuelbl/JavaDoesUSB/examples/bulk_transfer @@ -21,7 +21,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 diff --git a/examples/enumerate/README.md b/examples/enumerate/README.md index 1881b25..5721c61 100644 --- a/examples/enumerate/README.md +++ b/examples/enumerate/README.md @@ -38,7 +38,7 @@ $ mvn compile exec:exec [INFO] Scanning for projects... [INFO] [INFO] ----------------< net.codecrete.usb.examples:enumerate >---------------- -[INFO] Building enumerate 0.6.1 +[INFO] Building enumerate 0.7.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ enumerate --- diff --git a/examples/enumerate/pom.xml b/examples/enumerate/pom.xml index 7e3b68e..43e7b05 100644 --- a/examples/enumerate/pom.xml +++ b/examples/enumerate/pom.xml @@ -6,7 +6,7 @@ net.codecrete.usb.examples enumerate - 0.6.1 + 0.7.0 enumerate https://github.com/manuelbl/JavaDoesUSB/examples/enumerate @@ -21,7 +21,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 org.tinylog diff --git a/examples/enumerate_kotlin/README.md b/examples/enumerate_kotlin/README.md new file mode 100644 index 0000000..94a74c4 --- /dev/null +++ b/examples/enumerate_kotlin/README.md @@ -0,0 +1,50 @@ +# USB Device Enumeration (Kotlin) + +This sample enumerates the connected USB devices and provides information about the interfaces and endpoints. + +## Prerequisites + +- Java 21 +- Apache Maven +- 64-bit operating system (Windows, macOS, Linux) + +## How to run + +### Install Java 21 + +Check that *Java 21* is installed: + +```shell +$ java -version +``` + +If not, download and install it, e.g. from [Azul](https://www.azul.com/downloads/?package=jdk). + +### Install Maven + +Check that *Maven* is installed: + +```shell +$ mvn -version +``` + +If it is not present, install it, typically using package manager like *Homebrew* on macOS, *Chocolately* on Windows and *apt* on Linux. + +### Build a self-contained jar file + +```shell +$ cd JavaDoesUSB/examples/enumerate_kotlin +$ mvn clean package +``` + +### Run the jar + +```shell +$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/enumerate-0.7.0-jar-with-dependencies.jar +Device: + VID: 0xcafe + PID: 0xceaf + Manufacturer: JavaDoesUSB + Product name: Loopback +... +``` diff --git a/examples/enumerate_kotlin/pom.xml b/examples/enumerate_kotlin/pom.xml index 5110c7d..a304b39 100644 --- a/examples/enumerate_kotlin/pom.xml +++ b/examples/enumerate_kotlin/pom.xml @@ -3,17 +3,18 @@ 4.0.0 net.codecrete.usb.examples - kotlin - 0.6.1-SNAPSHOT + enumerate + 0.7.0 jar - kotlin - https://github.com/manuelbl/JavaDoesUSB/examples/kotlin + enumerate + https://github.com/manuelbl/JavaDoesUSB/examples/enumerate_kotlin - 1.9.10 + 1.9.22 true UTF-8 + net.codecrete.usb.examples.EnumerateKt @@ -27,6 +28,30 @@ ${kotlin.version} true + + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + make-assembly + package + + single + + + + + ${main.class} + + + + jar-with-dependencies + + + + + @@ -39,7 +64,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 org.tinylog diff --git a/examples/epaper_display/README.md b/examples/epaper_display/README.md index 3853b11..954070f 100644 --- a/examples/epaper_display/README.md +++ b/examples/epaper_display/README.md @@ -45,7 +45,7 @@ $ mvn compile exec:exec [INFO] Scanning for projects... [INFO] [INFO] -------------< net.codecrete.usb.examples:epaper-display >-------------- -[INFO] Building epaper-display 0.6.1 +[INFO] Building epaper-display 0.7.0 [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] @@ -81,6 +81,6 @@ $ sudo -i Password: $ cd /Users/me/Documents/JavaDoesUSB/examples/epaper_display $ export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-20.jdk/Contents/Home -$ $JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -cp target/classes:/Users/me/.m2/repository/net/codecrete/usb/java-does-usb/0.6.1/java-does-usb-0.6.1.jar net.codecrete.usb.examples.EPaperDisplay +$ $JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -cp target/classes:/Users/me/.m2/repository/net/codecrete/usb/java-does-usb/0.7.0/java-does-usb-0.7.0.jar net.codecrete.usb.examples.EPaperDisplay Display size: 1200 x 825 ``` diff --git a/examples/epaper_display/pom.xml b/examples/epaper_display/pom.xml index 9ea7e0e..73293f7 100644 --- a/examples/epaper_display/pom.xml +++ b/examples/epaper_display/pom.xml @@ -6,7 +6,7 @@ net.codecrete.usb.examples epaper-display - 0.6.1 + 0.7.0 epaper-display https://github.com/manuelbl/JavaDoesUSB/examples/epaper_display @@ -21,7 +21,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 diff --git a/examples/monitor/README.md b/examples/monitor/README.md index c1789a9..1fbcff5 100644 --- a/examples/monitor/README.md +++ b/examples/monitor/README.md @@ -38,7 +38,7 @@ $ mvn compile exec:exec [INFO] Scanning for projects... [INFO] [INFO] -----------------< net.codecrete.usb.examples:monitor >----------------- -[INFO] Building monitor 0.6.1 +[INFO] Building monitor 0.7.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ monitor --- diff --git a/examples/monitor/pom.xml b/examples/monitor/pom.xml index 4d2ae39..8ce4483 100644 --- a/examples/monitor/pom.xml +++ b/examples/monitor/pom.xml @@ -6,7 +6,7 @@ net.codecrete.usb.examples monitor - 0.6.1 + 0.7.0 monitor https://github.com/manuelbl/JavaDoesUSB/examples/monitor @@ -21,7 +21,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 org.tinylog diff --git a/examples/monitor_kotlin/README.md b/examples/monitor_kotlin/README.md new file mode 100644 index 0000000..c3c28c3 --- /dev/null +++ b/examples/monitor_kotlin/README.md @@ -0,0 +1,49 @@ +# USB Device Monitoring (Kotlin) + +This sample enumerates the connected USB devices and provides information about the interfaces and endpoints. + +## Prerequisites + +- Java 21 +- Apache Maven +- 64-bit operating system (Windows, macOS, Linux) + +## How to run + +### Install Java 21 + +Check that *Java 21* is installed: + +```shell +$ java -version +``` + +If not, download and install it, e.g. from [Azul](https://www.azul.com/downloads/?package=jdk). + +### Install Maven + +Check that *Maven* is installed: + +```shell +$ mvn -version +``` + +If it is not present, install it, typically using package manager like *Homebrew* on macOS, *Chocolately* on Windows and *apt* on Linux. + +### Build a self-contained jar file + +```shell +$ cd JavaDoesUSB/examples/monitor_kotlin +$ mvn clean package +``` + +### Run the jar + +```shell +$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/monitor-0.7.0-jar-with-dependencies.jar +WARNING: "public static final void net.codecrete.usb.examples.MonitorKt.main()" chosen over "public static void net.codecrete.usb.examples.MonitorKt.main(java.lang.String[])" +Present: VID: 0xcafe, PID: 0xceaf, manufacturer: JavaDoesUSB, product: Loopback, serial: 35A737883336, ID: 4295265643 +Present: VID: 0x1a40, PID: 0x0801, manufacturer: null, product: USB 2.0 Hub, serial: null, ID: 4295259660 +Monitoring... Press ENTER to quit. +... +``` diff --git a/examples/monitor_kotlin/pom.xml b/examples/monitor_kotlin/pom.xml index 78451d2..9a0094b 100644 --- a/examples/monitor_kotlin/pom.xml +++ b/examples/monitor_kotlin/pom.xml @@ -3,17 +3,18 @@ 4.0.0 net.codecrete.usb.examples - monitor_kotlin - 0.7.0-SNAPSHOT + monitor + 0.7.0 jar - monitor_kotlin - https://github.com/manuelbl/JavaDoesUSB/examples/kotlin + monitor + https://github.com/manuelbl/JavaDoesUSB/examples/monitor_kotlin - 1.9.10 + 1.9.22 true UTF-8 + net.codecrete.usb.examples.MonitorKt @@ -27,6 +28,30 @@ ${kotlin.version} true + + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + make-assembly + package + + single + + + + + ${main.class} + + + + jar-with-dependencies + + + + + @@ -39,7 +64,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 org.tinylog diff --git a/examples/stm_dfu/README.md b/examples/stm_dfu/README.md index b97cd35..f8d34ef 100644 --- a/examples/stm_dfu/README.md +++ b/examples/stm_dfu/README.md @@ -58,7 +58,7 @@ Run the command below (adapting the file path depending on your specific board): ```shell $ mvn package -$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-0.6.1.jar ../../test-devices/loopback-stm32/bin/blackpill-f401cc.bin +$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-0.7.0.jar ../../test-devices/loopback-stm32/bin/blackpill-f401cc.bin DFU device found with serial 35A737883336. Target memory segment: Internal Flash Erasing page at 0x8000000 (size 0x4000) diff --git a/examples/stm_dfu/pom.xml b/examples/stm_dfu/pom.xml index 13ee51f..9161054 100644 --- a/examples/stm_dfu/pom.xml +++ b/examples/stm_dfu/pom.xml @@ -4,7 +4,7 @@ net.codecrete.usb.examples stm_dfu - 0.6.1 + 0.7.0 stm_dfu https://github.com/manuelbl/JavaDoesUSB/examples/stm_dfu @@ -19,7 +19,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 diff --git a/java-does-usb/pom.xml b/java-does-usb/pom.xml index 99f2dea..3a543c0 100644 --- a/java-does-usb/pom.xml +++ b/java-does-usb/pom.xml @@ -6,7 +6,7 @@ net.codecrete.usb java-does-usb - 0.7.0-SNAPSHOT + 0.7.0 21