Skip to content

Commit

Permalink
Increase version to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed Oct 13, 2024
1 parent be52fc4 commit a690c72
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 53 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![javadoc](https://javadoc.io/badge2/net.codecrete.usb/java-does-usb/javadoc.svg)](https://javadoc.io/doc/net.codecrete.usb/java-does-usb)

*Java Does USB* is a Java library for working with USB devices. It allows to query the conntected USB devices and to communicate with them using custom / vendor specific protocols. (It is not intended for communication with standard types of USB devices such as mass storage devices, keyboards etc.)
*Java Does USB* is a Java library for working with USB devices. It allows to query the conntected USB devices and to communicate with them using custom / vendor specific protocols. It is not intended for communication with standard types of USB devices such as mass storage devices, keyboards etc.

The library uses the [Foreign Function and Memory API](https://docs.oracle.com/en/java/javase/21/core/foreign-function-and-memory-api.html#GUID-FBE990DA-C356-46E8-9109-C75567849BA8) to access native APIs of the underlying operating system. It is written entirely in Java and does not use JNI or any native third-party library. The *Foreign Function and Memory API* has been introduced with Java 22. Preview versions were available in several earlier releases.
The library uses the [Foreign Function and Memory API](https://docs.oracle.com/en/java/javase/22/core/foreign-function-and-memory-api.html) to access native APIs of the underlying operating system. It is written entirely in Java and does not use JNI or any native third-party library. The *Foreign Function and Memory API* has been introduced with Java 22.



Expand All @@ -31,14 +31,14 @@ If you are using Maven, add the below dependency to your pom.xml:
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
```

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: '1.0.0'
compile group: 'net.codecrete.usb', name: 'java-does-usb', version: '1.1.0'
```

```java
Expand Down Expand Up @@ -69,16 +69,16 @@ public class EnumerateDevices {

- [Bulk Transfer](examples/bulk_transfer/) demonstrates how to find a USB device, open it and communicate using bulk transfer.
- Enumeration ([Java](examples/enumerate/) / [Kotlin](examples/enumerate_kotlin/)) lists all connected USB devices and displays information about interfaces and endpoints.
- Monitor ([Java](examples/monitor/) / [Kotlin](examples/monitor_kotlin/)) lists the connected USB devices and then monitors for devices being connected and disconnnected.
- Monitor ([Java](examples/monitor/) / [Kotlin](examples/monitor_kotlin/)) lists the connected USB devices and then monitors for devices being connected and disconnected.
- [Device Firmware Upload (DFU) for STM32](examples/stm_dfu) uploads firmware to STM32 microcontrollers supporting the built-in DFU mode.
- [ePaper Display](examples/epaper_display) communicates with an IT8951 controller for e-Paper displays and shows an image on the display.



## Prerequisite

- Java 22 available at [jdk.java.net](https://jdk.java.net/21/), [Azul](https://www.azul.com/downloads/?package=jdk), [Adoptium](https://adoptium.net/temurin/releases/) or with your favorite package manager.
- Windows (x86 64-bit), macOS (x86 64-bit, ARM 64-bit) or Linux 64 bit (x86 64-bit, ARM 64-bit)
- Java 22 or higher, available at [jdk.java.net](https://jdk.java.net/), [Azul](https://www.azul.com/downloads/?package=jdk), [Adoptium](https://adoptium.net/temurin/releases/) or with your favorite package manager.
- Windows (x86 64-bit), macOS (x86 64-bit, ARM 64-bit) or Linux 64 bit (x86 64-bit, ARM 64-bit).



Expand All @@ -87,14 +87,14 @@ public class EnumerateDevices {

### macOS

No special considerations apply. Using this library, a Java application can connect to any USB device and claim any interfaces that isn't claimed by an operating system driver or another application. Standard operation system drivers can be unloaded if the application is run with root privileges. It runs both on Macs with Apple Silicon and Intel processors.
No special considerations apply. Using this library, a Java application can connect to any USB device and claim any interface that isn't claimed by an operating system driver or another application. Standard operation system drivers can be unloaded if the application is run with *root* privileges. It runs both on Macs with Apple Silicon and Intel processors.


### Linux

*libudev* is used to discover and monitor USB devices. It is closely tied to *systemd*. So the library only runs on Linux distributions with *systemd* and the related libraries. The majority of Linux distributions suitable for desktop computing (as opposed to distributions optimized for containers) fulfill this requirement. It runs on both Intel and ARM64 processors.
*libudev* is used to discover and monitor USB devices. It is closely tied to *systemd*. So the library runs on Linux distributions with *systemd* and the related libraries. The majority of Linux distributions suitable for desktop computing (as opposed to distributions optimized for containers) fulfill this requirement. It runs on both Intel and ARM64 processors.

Similar to macOS, a Java application can connect to any USB device and claim any interfaces that isn't claimed by an operating system driver or another application. Standard operation system drivers can be unloaded (without the need for root privileges).
Similar to macOS, a Java application can connect to any USB device and claim any interface that isn't claimed by an operating system driver or another application. Standard operation system drivers can be unloaded (without the need for root privileges).

Most Linux distributions set up user accounts without permissions to access USB devices. The *udev* system daemon is responsible for assigning permissions to USB devices. It can be configured to assign specific permissions or ownership:

Expand All @@ -111,13 +111,13 @@ Without the *udev* rule, it is still possible to enumerate and query all USB dev

### Windows

The Windows driver model is rather rigid. It's not possible to open any USB device unless it uses the *WinUSB* driver. This even applies to devices with no installed driver. Enumerating and querying USB devices is possible independent of the driver.
The Windows driver model is rather rigid. It's not possible to open a USB device unless it uses the *WinUSB* driver. This even applies to devices with no installed driver. Enumerating and querying USB devices is possible independent of the driver.

USB devices can implement special control requests to instruct Windows to automatically install the WinUSB driver (search for *WCID* or *Microsoft OS Compatibility Descriptors*). The WinUSB driver can also be manually installed or replaced using a software called [Zadig](https://zadig.akeo.ie/).

The test devices implement the required control requests. So the driver is installed automatically.

Windows for ARM64 is not yet supported. A port is probably easy, provided you have hardware to test it.
Windows for ARM64 is not yet supported. It will once an official Java build for version 22 or higher is available.



Expand All @@ -135,7 +135,7 @@ The *Foreign Function And Memory API* has been available as a preview feature in

| Version | Main New Features | Compatibility |
| - | - | - |
| 1.0.x | Release for final Java API | JDK 22 |
| 1.x.x | Release for final Java API | JDK 22 and higher |
| 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 |
Expand Down
8 changes: 4 additions & 4 deletions examples/bulk_transfer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This sample shows how to find a device, open it and transfer data from and to bu

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand All @@ -39,7 +39,7 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< net.codecrete.usb.examples:bulk-transfer >--------------
[INFO] Building bulk-transfer 1.0.0
[INFO] Building bulk-transfer 1.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ bulk-transfer ---
Expand All @@ -55,6 +55,6 @@ $ mvn compile exec:exec
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.228 s
[INFO] Finished at: 2024-02-18T16:23:29+01:00
[INFO] Finished at: 2024-10-13T16:23:29+01:00
[INFO] ------------------------------------------------------------------------
```
4 changes: 2 additions & 2 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>1.0.0</version>
<version>1.1.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>1.0.0</version>
<version>1.1.0</version>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions examples/enumerate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sample enumerates the connected USB devices and provides information about

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand All @@ -38,7 +38,7 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< net.codecrete.usb.examples:enumerate >----------------
[INFO] Building enumerate 1.0.0
[INFO] Building enumerate 1.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ enumerate ---
Expand Down
4 changes: 2 additions & 2 deletions examples/enumerate/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>enumerate</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<name>enumerate</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/enumerate</url>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
Expand Down
6 changes: 3 additions & 3 deletions examples/enumerate_kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sample enumerates the connected USB devices and provides information about

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand Down Expand Up @@ -40,7 +40,7 @@ $ mvn clean package
### Run the jar

```shell
$ java --enable-native-access=ALL-UNNAMED -jar target/enumerate-1.0.0-jar-with-dependencies.jar
$ java --enable-native-access=ALL-UNNAMED -jar target/enumerate-1.1.0-jar-with-dependencies.jar
Device:
VID: 0xcafe
PID: 0xceaf
Expand Down
4 changes: 2 additions & 2 deletions examples/enumerate_kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>enumerate</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>enumerate</name>
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
Expand Down
10 changes: 5 additions & 5 deletions examples/epaper_display/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ be temporarily detached.)

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand All @@ -45,7 +45,7 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< net.codecrete.usb.examples:epaper-display >--------------
[INFO] Building epaper-display 1.0.0
[INFO] Building epaper-display 1.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ epaper-display ---
Expand All @@ -60,7 +60,7 @@ Display size: 1200 x 825
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.247 s
[INFO] Finished at: 2024-02-18T16:48:43+01:00
[INFO] Finished at: 2024-10-13T16:48:43+01:00
[INFO] ------------------------------------------------------------------------
```

Expand All @@ -79,6 +79,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-native-access=ALL-UNNAMED -cp target/classes:/Users/me/.m2/repository/net/codecrete/usb/java-does-usb/1.0.0/java-does-usb-1.0.0.jar net.codecrete.usb.examples.EPaperDisplay
$ $JAVA_HOME/bin/java --enable-native-access=ALL-UNNAMED -cp target/classes:/Users/me/.m2/repository/net/codecrete/usb/java-does-usb/1.1.0/java-does-usb-1.1.0.jar net.codecrete.usb.examples.EPaperDisplay
Display size: 1200 x 825
```
4 changes: 2 additions & 2 deletions examples/epaper_display/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>epaper-display</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<name>epaper-display</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/epaper_display</url>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions examples/monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sample program monitors USB devices as they are connected and disconnected.

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand All @@ -39,7 +39,7 @@ $ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< net.codecrete.usb.examples:monitor >-----------------
[INFO] Building monitor 1.0.0
[INFO] Building monitor 1.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ monitor ---
Expand All @@ -59,6 +59,6 @@ Connected: VID: 0xcafe, PID: 0xceaf, manufacturer: JavaDoesUSB, product: Loop
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.647 s
[INFO] Finished at: 2024-02-18T16:50:59+01:00
[INFO] Finished at: 2024-10-13T16:50:59+01:00
[INFO] -----------------------------------------------------------------------
```
4 changes: 2 additions & 2 deletions examples/monitor/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>monitor</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<name>monitor</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/monitor</url>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
Expand Down
6 changes: 3 additions & 3 deletions examples/monitor_kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sample enumerates the connected USB devices and provides information about

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand Down Expand Up @@ -40,7 +40,7 @@ $ mvn clean package
### Run the jar

```shell
$ java --enable-native-access=ALL-UNNAMED -jar target/monitor-1.0.0-jar-with-dependencies.jar
$ java --enable-native-access=ALL-UNNAMED -jar target/monitor-1.1.0-jar-with-dependencies.jar
Present: VID: 0x1d6b, PID: 0x0002, manufacturer: Linux 6.5.0-18-generic xhci-hcd, product: xHCI Host Controller, serial: 0000:00:14.0, ID: /dev/bus/usb/001/001
Present: VID: 0xcafe, PID: 0xceaf, manufacturer: JavaDoesUSB, product: Loopback, serial: 35A737883336, ID: /dev/bus/usb/001/009
Monitoring... Press ENTER to quit.
Expand Down
4 changes: 2 additions & 2 deletions examples/monitor_kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>monitor</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>monitor</name>
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.tinylog</groupId>
Expand Down
6 changes: 3 additions & 3 deletions examples/stm_dfu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Even though the DFU

## How to run

### Install Java 22
### Install Java 22 or higher

Check that *Java 22* is installed:
Check that Java 22 or higher is installed:

```shell
$ java -version
Expand Down Expand Up @@ -58,7 +58,7 @@ Run the command below (adapting the file path depending on your specific board):

```shell
$ mvn package
$ java --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-1.0.0.jar ../../test-devices/loopback-stm32/bin/blackpill-f401cc.bin
$ java --enable-native-access=ALL-UNNAMED -jar target/stm_dfu-1.1.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)
Expand Down
4 changes: 2 additions & 2 deletions examples/stm_dfu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.codecrete.usb.examples</groupId>
<artifactId>stm_dfu</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<name>stm_dfu</name>
<url>https://github.com/manuelbl/JavaDoesUSB/examples/stm_dfu</url>
Expand All @@ -19,7 +19,7 @@
<dependency>
<groupId>net.codecrete.usb</groupId>
<artifactId>java-does-usb</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
</dependencies>

Expand Down
Loading

0 comments on commit a690c72

Please sign in to comment.