1

I'm currently attempting to write a program that needs to read /dev/input/mice in order to gain mouse input. My only problem is that when I read from /dev/input/mice all I get is gibberish. Online (Google), I found very few helpful webpages. I've attempted to use OD's output, but thats even worse than just trying to read from the file. I've attempted to use third-party libraries, but as I am working with an ARM architecture, many libraries will not run or compile. Does anyone know what format this data is in, and how to parse this data into understandable data.

Libraries I've tried to Use:

https://code.google.com/p/jnativehook/ (Won't recompile on ARM)

http://sdljava.sourceforge.net/ (Can't even get this one to compile x86!)

EDIT: I'm using a raspberry pi, with no X server installed. (NO AWT)

  • 1
    /dev/input/mice outputs 3 bytes, The first byte is the button data, the next two are x and y. Its not java code, but you might find [this](http://stackoverflow.com/questions/15882665/how-to-read-out-scroll-wheel-info-from-dev-input-mice?rq=1) or [this](http://stackoverflow.com/questions/11451618/how-do-you-read-the-mouse-button-state-from-dev-input-mice/23317086#23317086) helpful – JustinB Apr 26 '14 at 22:22
  • Thank you for your response @JustinB, how would one interpret the button data as well? – Einstein12345 Apr 29 '14 at 19:52
  • Never Mind, just set up a simple program to read the data in three byte quantities, the pattern is very simple and easy to see, thank you for all your help! – Einstein12345 Apr 29 '14 at 19:59
  • @Einstein12345, What error are you getting trying to compile JNativeHook on arm? It should build, so if you are still experiencing an issue please file a bug report or shoot me an email. – Alex Barker Jul 19 '14 at 20:21

1 Answers1

1

Thanks to @JustinB for his answer in the comments, just thought I should put it here for others to see:

JustinB: "/dev/input/mice outputs 3 bytes, The first byte is the button data, the next two are x and y. Its not java code, but you might find this or this helpful "

  • 1
    Sorry the links weren't obvious. C code to parse the 3 bytes is in this answer http://stackoverflow.com/questions/11451618/how-do-you-read-the-mouse-button-state-from-dev-input-mice/23317086#23317086 – JustinB Apr 29 '14 at 21:13