From b1892fe30797a86c40add6b544022e9e60e36108 Mon Sep 17 00:00:00 2001 From: elias Date: Fri, 11 Aug 2006 08:44:12 +0000 Subject: [PATCH] Linux: Ignore rumblers when device is read only --- .../java/net/java/games/input/LinuxEventDevice.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java b/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java index bcd941a..08cb8f2 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java @@ -48,25 +48,29 @@ final class LinuxEventDevice implements LinuxDevice { */ private boolean closed; - /* Access the the key_states array could be synchronized, but + /* Access to the key_states array could be synchronized, but * it doesn't hurt to have multiple threads read/write from/to it */ private final byte[] key_states = new byte[NativeDefinitions.KEY_MAX/8 + 1]; public LinuxEventDevice(String filename) throws IOException { long fd; + boolean detect_rumblers = true; try { fd = nOpen(filename, true); } catch (IOException e) { - ControllerEnvironment.logln("Failed to open device R/W: " + e.getMessage()); fd = nOpen(filename, false); + detect_rumblers = false; } this.fd = fd; try { this.name = getDeviceName(); this.input_id = getDeviceInputID(); this.components = getDeviceComponents(); - this.rumblers = enumerateRumblers(); + if (detect_rumblers) + this.rumblers = enumerateRumblers(); + else + this.rumblers = new Rumbler[]{}; this.type = guessType(); } catch (IOException e) { close();