This sample shows how to communicate with an IT8951 controller for e-paper displays, e.g. Waveshare E-Ink display HAT for Raspberry Pi
- Java 22
- Apache Maven
- 64-bit operating system (macOS, Linux, Windows)
- IT8951 controller
On Windows, the display controller's driver must be replaced with the WinUSB driver using Zadig.
On macOS, root privileges are required to successfully run the sample. (The standard driver will be temporarily detached.)
Check that Java 22 or higher is installed:
$ java -version
If not, download and install it, e.g. from Azul.
Check that Maven is installed:
$ mvn -version
If it is not present, install it, typically using package manager like Homebrew on macOS, Chocolately on Windows and apt on Linux.
$ cd JavaDoesUSB/examples/epaper_display
$ mvn compile exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< net.codecrete.usb.examples:epaper-display >--------------
[INFO] Building epaper-display 1.1.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ epaper-display ---
[INFO] skip non existing resourceDirectory /home/user/Documents/JavaDoesUSB/examples/epaper_display/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.12.1:compile (default-compile) @ epaper-display ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- exec-maven-plugin:3.1.1:exec (default-cli) @ epaper-display ---
Display size: 1200 x 825
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.247 s
[INFO] Finished at: 2024-10-13T16:48:43+01:00
[INFO] ------------------------------------------------------------------------
In order to run the sample with root privileges, the best approach is to build it first without root privileges and then run it as root without Maven:
$ cd JavaDoesUSB/examples/epaper_display
$ mvn compile
[INFO] Scanning for projects...
...
[INFO] ------------------------------------------------------------------------
$ 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.1.1/java-does-usb-1.1.1.jar net.codecrete.usb.examples.EPaperDisplay
Display size: 1200 x 825