Reputation: 143
Do any one knows the procedure of NON-BLOCKING reed() command for HID events in LINUX
Currently I am using
read(fd, ev, sizeof(struct hiddev_event) * EV_NUM);
But it goes to BLOCKING stage, when my HID pointing device is NOT towards the sensoer bar
Kind regards,
Madni
Upvotes: 0
Views: 2038
Reputation: 143
Thank you
It resolved the issue
Opwn the HID device in a non blocking mode
char *dev1="/dev/usb/hiddev0";
if ((fd = open(dev1, O_NONBLOCK)) < 0) {
perror("evdev open");
exit(1);
}
Regards,
Upvotes: 0
Reputation: 1200
I think more information is needed to answer this question. Most of the USB HID APIs that I have looked at put an asynchronous flag in the Open() method. In general, you're not going to want to do an asynchronous read one time, then follow that with a synchronous read. All your read() calls should use the same technique.
Are you using the O_NONBLOCK flag when you open the device?
Upvotes: 1