Commit 7619c213 authored by John Neffenger's avatar John Neffenger

Avoid closing the zForce input device on startup

The Neonode zForce touchscreen input device often fails when it is
opened immediately after being closed. The device driver logs the
following messages to the kernel ring buffer:

  [drivers/input/touchscreen/zforce_i2c.c-422] zforce_i2c_open()
  [zForce_ir_touch_recv_data-145] command Activate (0) ...
  [zForce_ir_touch_recv_data-154] command Resolution (0) ...
  [zForce_ir_touch_recv_data-179] command Frequency (0) ...
  [drivers/input/touchscreen/zforce_i2c.c-437] zforce_i2c_close()
  [drivers/input/touchscreen/zforce_i2c.c-422] zforce_i2c_open()
  [zForce_ir_touch_recv_data-142] command Deactivate ...
  [zForce_ir_touch_recv_data-198] command overrun (8) ...

Reorder the initialization sequence to be "open, open, close" instead of
"open, close, open" so that the device is never actually closed. With
this change, the device reference count remains above zero so the call
to close it is ignored, and the device driver logs the following
messages to the ring buffer:

  [drivers/input/touchscreen/zforce_i2c.c-422] zforce_i2c_open()
  [zForce_ir_touch_recv_data-145] command Activate (0) ...
  [zForce_ir_touch_recv_data-154] command Resolution (0) ...
  [zForce_ir_touch_recv_data-179] command Frequency (0) ...

Fixes #2
parent f7c34177
......@@ -83,12 +83,12 @@ class LinuxInputDevice implements Runnable, InputDevice {
this.sysPath = sysPath;
this.udevManifest = udevManifest;
this.capabilities = SysFS.readCapabilities(sysPath);
this.absCaps = LinuxAbsoluteInputCapabilities.getCapabilities(
devNode, capabilities.get("abs"));
fd = system.open(devNode.getPath(), LinuxSystem.O_RDONLY);
if (fd == -1) {
throw new IOException(system.getErrorMessage() + " on " + devNode);
}
this.absCaps = LinuxAbsoluteInputCapabilities.getCapabilities(
devNode, capabilities.get("abs"));
// attempt to grab the device. If the grab fails, keep going.
int EVIOCGRAB = system.IOW('E', 0x90, 4);
system.ioctl(fd, EVIOCGRAB, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment