linux - Java /dev/input/eventX -


currently have n-trig multitouch panel hooked event file /dev/input/event4, , trying this access it. have included of natives , such in java.library.path getting error when superuser. exception:

java.io.ioexception: invalid argument     @ sun.nio.ch.filedispatcherimpl.read0(native method)     @ sun.nio.ch.filedispatcherimpl.read(filedispatcherimpl.java:46)     @ sun.nio.ch.ioutil.readintonativebuffer(ioutil.java:223)     @ sun.nio.ch.ioutil.read(ioutil.java:197)     @ sun.nio.ch.filechannelimpl.read(filechannelimpl.java:149)     @ com.dgis.input.evdev.eventdevice.readevent(eventdevice.java:269)     @ com.dgis.input.evdev.eventdevice.access$1(eventdevice.java:265)     @ com.dgis.input.evdev.eventdevice$1.run(eventdevice.java:200) event:  null exception in thread "thread-0" java.lang.nullpointerexception     @ com.asdev.t3.bootstrap$1.event(bootstrap.java:41)     @ com.dgis.input.evdev.eventdevice.distributeevent(eventdevice.java:256)     @ com.dgis.input.evdev.eventdevice.access$2(eventdevice.java:253)     @ com.dgis.input.evdev.eventdevice$1.run(eventdevice.java:201) 

does know why happens? thanks

i answered question on project's issues page.

by attilapara
hi, tried use library on raspberry pi , got same exception, figured out source of problem , managed work. basically, problem library written 64 bit cpu/os only. explanation:

the input_event structure looks (source):

struct input_event {     struct timeval time;     unsigned short type;     unsigned short code;     unsigned int value; }; 

here have timeval, has following members (source):

time_t         tv_sec      seconds suseconds_t    tv_usec     microseconds 

these 2 types represented differently on 32 bit , 64 bit system.

the solution:

  1. change size of input_event 24 16 bytes:

change line 34 of source file evdev-java/src/com/dgis/input/evdev/inputevent.java this:

    public static final int struct_size_bytes = 24; this:      public static final int struct_size_bytes = 16; change parse function in same source file follows:  public static inputevent parse(shortbuffer shortbuffer, string source) throws ioexception {     inputevent e = new inputevent();     short a,b,c,d;      a=shortbuffer.get();     b=shortbuffer.get();     //c=shortbuffer.get();     //d=shortbuffer.get();     e.time_sec = (b<<16) | a; //(d<<48) | (c<<32) | (b<<16) | a;     a=shortbuffer.get();     b=shortbuffer.get();     //c=shortbuffer.get();     //d=shortbuffer.get();     e.time_usec = (b<<16) | a; //(d<<48) | (c<<32) | (b<<16) | a;     e.type = shortbuffer.get();     e.code = shortbuffer.get();     c=shortbuffer.get();     d=shortbuffer.get();     e.value = (d<<16) | c;     e.source = source;      return e; } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -