Skip to content

Commit

Permalink
Upgrade examples to 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed Mar 23, 2023
1 parent f7e8b78 commit 8502a30
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 59 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ If you are using Maven, add the below dependency to your pom.xml:
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.4.1'
compile group: 'net.codecrete.usb', name: 'java-does-usb', version: '0.5.0'
```

```java
Expand Down
16 changes: 8 additions & 8 deletions examples/bulk_transfer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ This sample shows how to find a device, open it and transfer data from and to bu

## Prerequisites

- Java 19
- Java 20
- Apache Maven
- 64-bit operating system (Windows, macOS, Linux)
- A USB device with bulk IN and OUT endpoints (e.g. the test device, see https://github.com/manuelbl/JavaDoesUSB/tree/main/test-devices/loopback-stm32)

## How to run

### Install Java 19
### Install Java 20

Check that *Java 19* is installed:
Check that *Java 20* is installed:

```shell
$ java -version
Expand All @@ -39,24 +39,24 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< net.codecrete.usb.examples:bulk-transfer >--------------
[INFO] Building bulk-transfer 0.4.0
[INFO] Building bulk-transfer 0.5.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ bulk-transfer ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/manuel/Documents/Lab/JavaDoesUSB/examples/bulk_transfer/src/main/resources
[INFO] skip non existing resourceDirectory /Users/me/Documents/JavaDoesUSB/examples/bulk_transfer/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ bulk-transfer ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/manuel/Documents/Lab/JavaDoesUSB/examples/bulk_transfer/target/classes
[INFO] Compiling 1 source file to /Users/me/Documents/JavaDoesUSB/examples/bulk_transfer/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:exec (default-cli) @ bulk-transfer ---
6 bytes sent.
6 bytes received.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.830 s
[INFO] Finished at: 2022-09-09T14:43:10+02:00
[INFO] Total time: 1.259 s
[INFO] Finished at: 2023-03-23T14:10:17+01:00
[INFO] ------------------------------------------------------------------------
```
17 changes: 11 additions & 6 deletions examples/bulk_transfer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>bulk-transfer</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>

<name>bulk-transfer</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/bulk_transfer</url>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>
</dependency>
</dependencies>

Expand All @@ -42,15 +42,20 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>19</release>
<compilerArgs>--enable-preview</compilerArgs>
<source>19</source>
<target>19</target>
<release>20</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>--enable-preview --enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
11 changes: 6 additions & 5 deletions examples/enumerate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ This sample enumerates the connected USB devices and provides information about

## Prerequisites

- Java 19
- Java 20
- Apache Maven
- 64-bit operating system (Windows, macOS, Linux)

## How to run

### Install Java 19
### Install Java 20

Check that *Java 19* is installed:
Check that *Java 20* is installed:

```shell
$ java -version
Expand All @@ -38,15 +38,16 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< net.codecrete.usb.examples:enumerate >----------------
[INFO] Building enumerate 0.4.1
[INFO] Building enumerate 0.5.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ enumerate ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/me/Documents/JavaDoesUSB/examples/enumerate/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ enumerate ---
[INFO] Nothing to compile - all classes are up to date
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/me/Documents/JavaDoesUSB/examples/enumerate/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:exec (default-cli) @ enumerate ---
Device:
Expand Down
21 changes: 13 additions & 8 deletions examples/enumerate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>enumerate</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>

<name>enumerate</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/enumerate</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>
</dependency>
</dependencies>

Expand All @@ -42,15 +42,20 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>19</release>
<compilerArgs>--enable-preview</compilerArgs>
<source>19</source>
<target>19</target>
<release>20</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>--enable-preview --enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
11 changes: 6 additions & 5 deletions examples/monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ This sample program monitors USB devices as they are connected and disconnected.

## Prerequisites

- Java 19
- Java 20
- Apache Maven
- 64-bit operating system (Windows, macOS, Linux)

## How to run

### Install Java 19
### Install Java 20

Check that *Java 19* is installed:
Check that *Java 20* is installed:

```shell
$ java -version
Expand All @@ -38,15 +38,16 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< net.codecrete.usb.examples:monitor >-----------------
[INFO] Building monitor 0.4.1
[INFO] Building monitor 0.5.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ monitor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/me/Documents/JavaDoesUSB/examples/monitor/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ monitor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/me/Documents/JavaDoesUSB/examples/monitor/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:exec (default-cli) @ monitor ---
Present: VID: 0xcafe, PID: 0xceaf, manufacturer: JavaDoesUSB, product: Loopback, serial: 8D8F515C5456, ID: 4295291950
Expand Down
21 changes: 13 additions & 8 deletions examples/monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>monitor</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>

<name>monitor</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/monitor</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>
</dependency>
</dependencies>

Expand All @@ -42,15 +42,20 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>19</release>
<compilerArgs>--enable-preview</compilerArgs>
<source>19</source>
<target>19</target>
<release>20</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>--enable-preview --enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
12 changes: 6 additions & 6 deletions examples/stm_dfu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Even though the DFU

## Prerequisites

- Java 19
- Java 20
- Apache Maven
- 64-bit operating system (Windows, macOS, Linux)

## How to run

### Install Java 19
### Install Java 20

Check that *Java 19* is installed:
Check that *Java 20* is installed:

```shell
$ java -version
Expand Down Expand Up @@ -57,16 +57,16 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0666"
Run the command below (adapting the file path depending on your specific board):

```shell
$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-0.4.1.jar ../../test-devices/loopback-stm32/bin/blackpill-f401cc.bin
DFU device found with serial 36C730037136.
$ java --enable-preview --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-0.5.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)
Writing data at 0x8000000 (size 0x800)
Writing data at 0x8000800 (size 0x800)
Writing data at 0x8001000 (size 0x800)
Writing data at 0x8001800 (size 0x800)
Writing data at 0x8002000 (size 0x800)
Writing data at 0x8002800 (size 0x4cc)
Writing data at 0x8002800 (size 0x1f4)
Firmware successfully downloaded and verified
DFU mode exited and firmware started
```
29 changes: 17 additions & 12 deletions examples/stm_dfu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>stm_dfu</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>

<name>stm_dfu</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/stm_dfu</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>0.4.1</version>
<version>0.5.0</version>
</dependency>
</dependencies>

Expand All @@ -31,10 +37,12 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>19</release>
<compilerArgs>--enable-preview</compilerArgs>
<source>19</source>
<target>19</target>
<release>20</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
<source>20</source>
<target>20</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -44,6 +52,9 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>--enable-preview --enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -76,10 +87,4 @@
</plugin>
</plugins>
</build>

<properties>
<maven.compiler.target>19</maven.compiler.target>
<maven.compiler.source>19</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

0 comments on commit 8502a30

Please sign in to comment.