Hi,
I've got the reading of mouse buttons and mouse position working, by reading the /dev/input/mouse0 device three bytes at a time (but,dx,dy).
My mouse has a scroll wheel.
How can I read the scroll wheel using /dev/input/mouse0 device?
I am not running X btw, just straight from the console.
Thanks,
Bram Stolk
Re: /dev/input/mouse0 and the scrollwheel
look at function "handle_mouse"stolk wrote:Hi,
I've got the reading of mouse buttons and mouse position working, by reading the /dev/input/mouse0 device three bytes at a time (but,dx,dy).
My mouse has a scroll wheel.
How can I read the scroll wheel using /dev/input/mouse0 device?
I am not running X btw, just straight from the console.
Thanks,
Bram Stolk
https://github.com/bbond007/raspytube/b ... bjs.c#L245
here...
https://github.com/bbond007/raspytube/b ... bjs.c#L309
also if you want to see how to get wheel events in Xwindows look at "x_window_loop"
https://github.com/bbond007/raspytube/b ... bjs.c#L547
Re: /dev/input/mouse0 and the scrollwheel
Thank you,
Reading the source, I understand that I should be using /dev/input/eventX and not /dev/input/mouse0.
And when reading the event, the scrollwheel is under type 2, code 8.
Bram
Reading the source, I understand that I should be using /dev/input/eventX and not /dev/input/mouse0.
And when reading the event, the scrollwheel is under type 2, code 8.
Bram
Re: /dev/input/mouse0 and the scrollwheel
yes,stolk wrote:Thank you,
Reading the source, I understand that I should be using /dev/input/eventX and not /dev/input/mouse0.
And when reading the event, the scrollwheel is under type 2, code 8.
Bram
I just realized that you were asking for help with /dev/input/mouse0... and my example uses eventX
my bad

I do believe I wrote a program to dump /dev/input/mice and did not see any sort of wheel events at all.
Yes. you can use eventX, but they do move around... event1 might be a keyboard, might be a mouse, might be a gamepad... etc.. that is the challenge, the mouse can move around.
Re: /dev/input/mouse0 and the scrollwheel
/dev/input/mice emulates a PS/2 mouse. It opens in three-byte mode. To switch it into four-byte intellimouse or intellimouse explorer mode you write the same magic command sequences you would to the real thing:stolk wrote:How can I read the scroll wheel using /dev/input/mouse0 device?
Code: Select all
static unsigned char mousedev_imps_seq[] = { 0xf3, 200, 0xf3, 100, 0xf3, 80 };
static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 };