Reads one joystick device file inside the VM, for Gamepad.
start_link/2 starts a process, linked to the caller, that opens the file and
reads it until it ends or fails, sending owner:
{:gamepad_device, reader, :opened}once the file is open{:gamepad_device, reader, {:data, bytes}}for eachjs_eventrecord read, its 8 bytes forGamepad.Linux.decode/2{:gamepad_device, reader, {:closed, reason}}when the file could not be opened, ended (:eof) or failed, as when the controller is unplugged; the process then exits normally
Each read waits on one of the VM's dirty I/O threads until the controller sends something. A reader asked to exit while waiting goes once that read returns; its file closes with it.
Summary
Functions
Start reading path, sending what is read to owner.