Read /dev/input/event* via IO.binread ?



Is there is any simple way to read binary stream from /dev/input/event file (e.g mouse event) without any extra libs (like input_event)? Just with loop + and (?) IO.binstream for example. I have tried different IO functions but without success.

I have equivalent snippet in golang:

func main() {
	buff := make([]byte, 64)

	f, err := os.Open("/dev/input/event5")

	if err != nil {

	defer f.Close()

	for {



Something like this should yield a simliar result as your sample code:

|>!([], 64)
|> Stream.each(&IO.inspect/1)

Thanks, but unfortunately it doesn’t help - I get nothing and after the while it throws ** (IO.StreamError) error during streaming: invalid argument