You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-17Lines changed: 12 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,17 @@
4
4
5
5
*Java Does USB* is a Java library for working with USB devices. It allows to query information about all conntected USB devices and to communicate with USB devices using custom / vendor specific protocols. (It is not intended for communication with standard types of USB devices such as mass storage devices, keyboards etc.)
6
6
7
-
The library uses the [Foreign Function & Memory API](https://github.com/openjdk/panama-foreign) to access native APIs of the underlying operating system. It is written entirely in Java and does not need JNI or any native third-party library. The *Foreign Function & Memory API* (aka as project Panama) is currently in preview and will leave preview with Java 22. Currently, it can be used with Java 19, Java 20 or Java 21 (with preview features enabled).
7
+
The library uses the [Foreign Function & Memory API](https://github.com/openjdk/panama-foreign) to access native APIs of the underlying operating system. It is written entirely in Java and does not need JNI or any native third-party library. The *Foreign Function & Memory API* (aka as project Panama) has been introduced with Java 22. Older versions of this library can be used with preview versions of the API that were available in Java 19, Java 20 or Java 21 (with preview features enabled).
8
8
9
9
| Version | Main New Features | Compatibility |
10
10
| - | - | - |
11
+
| 1.0.x | Release for final Java API | JDK 22 |
11
12
| 0.7.x | New setter/getter names for improved Kotlin support; Kotlin examples | JDK 21 |
12
13
| 0.6.x | Support for JDK 21; better handling of composite devices on Windows | JDK 21 |
13
14
| 0.5.x | Support for JDK 20; high-throuput I/O streams | JDK 20 |
14
15
| 0.4.x | Early release | JDK 19 |
15
16
16
-
*Note: The main branch and published versions ≥ 0.6.0 work with JDK 21 only. For JDK 20, use version 0.5.*. For JDK 19, use version 0.4.x.
17
+
*Note: The main branch and published versions ≥ 1.0 work with JDK 22 and later only. For JDK 21, user version 0.7.*. For JDK 20, use version 0.5.*. For JDK 19, use version 0.4.x.
17
18
18
19
19
20
## Features
@@ -48,14 +49,14 @@ If you are using Maven, add the below dependency to your pom.xml:
48
49
<dependency>
49
50
<groupId>net.codecrete.usb</groupId>
50
51
<artifactId>java-does-usb</artifactId>
51
-
<version>0.7.1</version>
52
+
<version>1.0.0-SNAPSHOT</version>
52
53
</dependency>
53
54
```
54
55
55
56
If you are using Gradle, add the below dependency to your build.gradle file:
@@ -90,23 +91,23 @@ public class EnumerateDevices {
90
91
91
92
## Prerequisite
92
93
93
-
- Java 21, preview features enabled (available at https://www.azul.com/downloads/?package=jdk)
94
+
- Java 22 (available at https://www.azul.com/downloads/?package=jdk)
94
95
- Windows (x86 64-bit), macOS (x86 64-bit, ARM 64-bit) or Linux 64 bit (x86 64-bit, ARM 64-bit)
95
96
96
-
For JDK 20, use the latest published version 0.5.x. For JDK 19, use the latest published version 0.4.x.
97
+
For JDK 21, use the latest published version 0.7.x. For JDK 20, use the latest published version 0.5.x. For JDK 19, use the latest published version 0.4.x.
97
98
98
99
99
100
## Platform-specific Considerations
100
101
101
102
102
103
### macOS
103
104
104
-
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.
105
+
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 Silicion and Intel processors.
105
106
106
107
107
108
### Linux
108
109
109
-
*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.
110
+
*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.
110
111
111
112
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).
112
113
@@ -129,17 +130,11 @@ USB devices can implement certain control requests to instruct Windows to automa
129
130
130
131
The test devices implement the required control requests. So the driver is installed automatically.
131
132
132
-
The library has not been tested on Windows for ARM64. It might or might not work.
133
+
Windows for ARM64 is not yet supported. A port is probably easy, provided you have hardware to test it.
133
134
134
135
135
136
### Troubleshooting
136
137
137
-
#### `ClassFormatError` (all platforms)
138
-
139
-
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).
140
-
141
-
142
-
143
138
### 32-bit versions
144
139
145
140
The Foreign Function & Memory API has not been implemented for 32-bit operating systems / JDKs (and likely never will be).
@@ -170,11 +165,11 @@ mvn clean test
170
165
If they are run from an IDE (such as IntelliJ IDEA), you must likely configure VM options to enable preview features and allow native access:
Copy file name to clipboardExpand all lines: examples/bulk_transfer/README.md
+11-13Lines changed: 11 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,16 @@ This sample shows how to find a device, open it and transfer data from and to bu
4
4
5
5
## Prerequisites
6
6
7
-
- Java 21
7
+
- Java 22
8
8
- Apache Maven
9
9
- 64-bit operating system (Windows, macOS, Linux)
10
10
- 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)
0 commit comments