Search this site


Metadata

Articles

Projects

Presentations

USB Mouse support in-progress for newmoused/newpsm

I started working on usb (usbhid) mouse support for my newpsm/newmoused project. So far so good, I can probe /dev/uhidX devices and figure out if it's a mouse or not. Thankfully, usb hid is very easy. Unfortunately, FreeBSD (NetBSD's) implementation is somewhat crazy with the voodoo.

To see what I mean, look at: src/usr.sbin/usbhidct/usbhid.c.

Look near line 230 (the only read() call in the file). Notice the read() call, but 'dbuf' is NEVER used meaningfully. More specifically, the read is mostly ignored and a loop is done over the 'hids' list. Looks like read()s on usbhid devices pushes data to special places in memory which can be found by using hid_start_parse(). A read() shouldn't be doing this. This is the job for an ioctl() or something. read(), to me, says "give me data so I can use it" - not "update some magic places in memory, thanks"

Eek.