0

I'm trying to get the mouse location from my raspberry pi. The pi right now isn't connect to a monitor so the X server is not running. Only thing connected to my pi is a mouse and a ethernet cable.

I have a simple java program that grabs mouse location using: MouseInfo.getPointerInfo().getLocation()

And the command I'm trying to run xvfb is:
xvfb-run --server-args="-screen 0, 1024x768x24" java GetMouse

I am getting a x and y coordinate from my java program but it seems like the coordinates are not changing it's always at (512,384)

I'm starting to think that xvfb is not what I want. Is there another way of grabbing mouse location via the command line?

vaat
  • 31
  • 4
  • Doesn't the command mean that it's grabbing the mouse position the same time it's starting the virtual screen? You're exactly at screen center, which is a typical initial mouse position. – zapl Nov 18 '15 at 03:47
  • I have the java program running in an endless loop just so I can monitor the mouse location, but it's not changing. I assumed that when I start the virtual screen it would keep on running until I terminate the current process. Is this not that case? – vaat Nov 18 '15 at 05:37
  • Are you expecting the actual mouse to somehow be "connected" to the vfb? I don't think that is how it works. Mouse position is dependent on the context (where an X server is one possible context). Perhaps you would have more luck if you told us what you are actually trying to do (getting the mouse position from X is a solution, not the question...) – John3136 Nov 19 '15 at 00:07
  • I have an IR touch screen connected to the Pi via USB and I want to grab the touch location without starting the X video server since the Pi isn't connected to a monitor. I was hoping that when I start the vfb the touchscreen can change the mouse location and I can just use my java program to grab X and Y coordinates. – vaat Nov 19 '15 at 00:19

0 Answers0