22 lines
388 B
Lua
22 lines
388 B
Lua
local evdev = require "evdev"
|
|
|
|
local dev = evdev.Device("/dev/input/event0")
|
|
|
|
local x = 0
|
|
local y = 0
|
|
|
|
while true do
|
|
local timestamp, eventType, eventCode, value = dev:read()
|
|
if eventType == evdev.EV_ABS then
|
|
if eventCode == 57 then
|
|
if value < 0 then
|
|
print("Up: ",x,y)
|
|
end
|
|
elseif eventCode == 0 then
|
|
y = value
|
|
elseif eventCode == 1 then
|
|
x = value
|
|
end
|
|
end
|
|
end
|