Subject: kevent(2) and /dev/usb
To: None <current-users@netbsd.org>
From: Paulo Alexandre Pinto Pires <p@ppires.org>
List: current-users
Date: 09/06/2004 23:12:07
Hello, folks.

I am writing an application to properly initialize a USB printer when it 
comes on-line.  The first version watched /var/log/messages for ulpt* 
events logged by syslogd(8), from /dev/klog, using kqueue()/kevent() to 
watch for log file growth or rotation.  Then I realized watching 
/dev/usb would be a better idea, and began rewriting the program to use it.

Unfortunately, EVFILT_READ on a descriptor opened to /dev/usb causes 
kevent() to always return positive, but a read() on that descriptor 
always fails with EINVAL.  Man page for usb(4) states that /dev/usb can 
be opened for reading and input data can be detected with poll(2).  If 
usb can be poll()ed, I would expect it to be suitable for kevent() as well.

Should a PR be filed, or is this behavior correct?  If it is correct, 
why is it so?

Regards,

-- 
	Pappires

... Qui habet aurem audiat quid Spiritus dicat ecclesiis.