Luna/apps/mouse.cpp
apio 2198dedb96
All checks were successful
continuous-integration/drone/push Build is passing
apps: Add mouse
A simple mouse packet reader.
2023-08-02 11:56:12 +02:00

17 lines
422 B
C++

#include <moon/Mouse.h>
#include <os/File.h>
Result<int> luna_main(int, char**)
{
auto mouse = TRY(os::File::open("/dev/mouse", os::File::ReadOnly));
mouse->set_buffer(os::File::NotBuffered);
while (1)
{
moon::MousePacket packet;
TRY(mouse->read_typed(packet));
os::println("Mouse packet: xdelta=%d, ydelta=%d, buttons=%d", packet.xdelta, packet.ydelta, packet.buttons);
}
}