APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.glass.ui.monocle

pack-priv Class EPDInputDeviceRegistry

extends InputDeviceRegistry
Class Inheritance
Imports
java.io.File, .IOException, java.text.MessageFormat, java.util.HashMap, .Map

Maintains an observable set of input devices. This class is responsible for detecting the attached input devices and generating their input events. Run the following commands as root to list the properties of the keypad (event0) and touch screen (event1) input devices on the system:
# udevadm info -q all -n /dev/input/event0
# udevadm info -q all -n /dev/input/event1

Implementation Note

EPDPlatform creates an instance of this class instead of LinuxInputDeviceRegistry because this class replaces two of its methods.

It replaces the createDevice method to work around bug JDK-8201568 by opening the device before creating its LinuxInputDevice. It also replaces the addDeviceInternal method to work around older versions of udev, such as version 142, which do not provide the ID_INPUT_TOUCHSCREEN=1 property for the touch screen device. LinuxInputDevice#isTouch requires that property and value; otherwise the method returns false, and the touch screen is mistakenly assigned a keyboard input processor. Newer versions of udev, such as version 204, provide the correct property and value.

Therefore, once JDK-8201568 is fixed and the old version of udev is no longer in use, this entire class can be removed and replaced by LinuxInputDeviceRegistry.

Field Summary

Modifier and TypeField and Description
private static final String
KEYPAD_FILENAME

The file name of the keypad input device.

private static final String
TOUCH_FILENAME

The file name of the touch screen input device.

Inherited from com.sun.glass.ui.monocle.InputDeviceRegistry:
devices

Constructor Summary

AccessConstructor and Description
pack-priv
EPDInputDeviceRegistry(boolean
true if this environment cannot support a display, keyboard, and mouse; otherwise false
headless
)

Creates a new observable set of input devices.

Method Summary

Modifier and TypeMethod and Description
private LinuxInputDevice

Returns:

the Linux input device, or null if no input processor is found for the device
addDeviceInternal
(LinuxInputDevice
the Linux input device
device
,
String
the device name, such as /dev/input/event0
name
)

Creates an input processor for the device which runs on a new daemon background thread.

private LinuxInputDevice

Returns:

the new Linux input device, or null if no processor is found for the device
createDevice
(File
the file representing the device name, such as /dev/input/event1
devNode
,
File
the system path to the device, such as /sys/devices/virtual/input/input1/event1
sysPath
,
Map<String, String>
the set of properties for the device
udevManifest
)

Creates a Linux input device with the given properties.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from com.sun.glass.ui.monocle.InputDeviceRegistry:
getInputDevices

Field Detail

KEYPAD_FILENAMEback to summary
private static final String KEYPAD_FILENAME

The file name of the keypad input device.

TOUCH_FILENAMEback to summary
private static final String TOUCH_FILENAME

The file name of the touch screen input device.

Constructor Detail

EPDInputDeviceRegistryback to summary
pack-priv EPDInputDeviceRegistry(boolean headless)

Creates a new observable set of input devices.

Implementation Note

This is a verbatim copy of the LinuxInputDeviceRegistry constructor.

Parameters
headless:boolean

true if this environment cannot support a display, keyboard, and mouse; otherwise false

Method Detail

addDeviceInternalback to summary
private LinuxInputDevice addDeviceInternal(LinuxInputDevice device, String name)

Creates an input processor for the device which runs on a new daemon background thread. Run the following commands as root to display the events generated by the keypad (0) and touch screen (1) input devices when you press buttons or touch the screen:

# input-events 0
# input-events 1

Implementation Note

The "mxckpd" keypad device driver does not generate EV_SYN events, yet the LinuxInputDevice#run method schedules an event for processing only after receiving the EV_SYN event terminator (see the LinuxEventBuffer#put method). The events from this device, therefore, are never delivered to the JavaFX application. The "gpio-keys" keypad device driver on more recent systems, though, correctly generates the EV_SYN event terminator.

Parameters
device:LinuxInputDevice

the Linux input device

name:String

the device name, such as /dev/input/event0

Returns:LinuxInputDevice

the Linux input device, or null if no input processor is found for the device

createDeviceback to summary
private LinuxInputDevice createDevice(File devNode, File sysPath, Map<String, String> udevManifest) throws IOException

Creates a Linux input device with the given properties.

Implementation Note

Works around bug JDK-8201568, "zForce touchscreen input device fails when closed and immediately reopened," by opening the device before creating its LinuxInputDevice.

Parameters
devNode:File

the file representing the device name, such as /dev/input/event1

sysPath:File

the system path to the device, such as /sys/devices/virtual/input/input1/event1

udevManifest:Map<String, String>

the set of properties for the device

Returns:LinuxInputDevice

the new Linux input device, or null if no processor is found for the device

Exceptions
IOException:
if an error occurs opening the device
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override