reading mouse device
hi,
i am new to linux .as my assignment ,i have been asked to read from the usb mouse pointing device. To begin with, I am not aware of the particular device in the "/dev/" directory that I need to do a read on. I also tried to read from "/dev/input/mice" and found that it returned only 3 bytes. I went thru some of the resources onlince and found that it needs to retur struct input_event (defined in /include/linux/). So, I am not aware of how to interpret this 3 bytes that i get from reading. |
This post should get you started on your homework.
|
mouse device
hi,
thank you very much for your help.........can u help me with a detailed code for this. thanks in advance |
Quote:
If you want to use the new way, your code can build on this boilerplate: Code:
#include <stdio.h> Code:
EV_SYN — synthetic events (e.g. 0 0 0) which separate real events Code:
BTN_LEFT If you want some concrete code to look at, look you might take a look at the Xorg evdev input driver or library. There are a bunch more if you search the web for “evdev mouse” or similar. For example, here is a small program which finds the keys and axes supported by a device. |
I Have Finished My Homework......only One Part Left Detecting Whether A Mouse Is Attached Or Not....how Can We Do That Any Clue.
Thanks In Advance Daniel Rex |
If you just want to see all your mouse devices, you can (as I mentioned before) just use /proc/bus/input/devices. If you want something special to occur when you plug in a mouse (e.g., the running of a script) you can use udev.
|
All times are GMT -5. The time now is 04:53 AM. |