Results 1 to 3 of 3
Hi all!
I'm programming USB mouse api on my embedded linux system.
To read mouse event, I typed "mknod /dev/input/event0 c 13 64" and
opened it to read.
After checking ...
- 05-20-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 2
After "re"-plugin USB mouse, can't reopen it
Hi all!
I'm programming USB mouse api on my embedded linux system.
To read mouse event, I typed "mknod /dev/input/event0 c 13 64" and
opened it to read.
After checking correct ouput from that, plugged out usb mouse.
And "cat /dev/input/event0", prints "no such device". It's ok.
But after re-plugin mouse, I can't read() /dev/input/event0 .
On prompt typping "cat /dev/input/event0", still prints "no such device"
even though mouse is being connected.
So I close()ed "dev/input/event0" when unplug mouse, and re-open()ed it when plugin mouse, it is still not possible to open and read..
(and in "/proc/bus/input/devices", handler "event*" number increases,
when I open "dev/input/event*" and replugin mouse.)
What is the problem?
How can I re-open(or re-read) "/dev/input/event0" successfully
when replugin-ing mouse?
- 05-20-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Right.
As far as I know, this is the way it work. If you want to make sure that a given device is always linked to the same device node, then you have to do some magic yourself. It's much easier if you use udev on that system, because a simple udev rule can do that for you:(and in "/proc/bus/input/devices", handler "event*" number increases,
when I open "dev/input/event*" and replugin mouse.)
What is the problem?
Writing udev rules
You can match the device using any info that's unique to it.
I think that that should help.
- 05-22-2008 #3Just Joined!
- Join Date
- May 2008
- Posts
- 2
Thanks i92guboj,
Your advice is very helpful for me
I'll see udev part. Thank you.


Reply With Quote
