I recently picked up a Velleman K8055, which is basically a Digital and
analog I/O board that connects to a PC via a USB connection. So far, its
worked fine w/FreeBSD, the uhid driver picks it up, and a simple cat
< /dev/uhid0 will start pulling the 8 bytes that represent the inputs
and counters available.
However, once the device is open, it polls several times per second,
and uhid begins to buffer the board's output in a clist. Since I don't
need that level of resolution, I'm looking to have the application back
down to once per second, perhaps slower (every 5 seconds). However, in
order to do this, I need to either stop the over sampling or flush the
buffer, and then pick up the first "new" read. However, performing both
a TIOCFLUSH (have ioctl flush the buffers) as well as a FIONREAD (return
the number of bytes waiting so the application can read them and throw
them away) fail.
I also tried to add a FIONREAD to uhid_do_ioctl() and uhidioctl() at
different times. My understanding is that with the ioctl calls, the
infrastructure should be able to do the copy out, so a simple:
*addr = sc->sc_q.c_cc;
should have done the trick, and it compiles happily, but it fails with
an invalid address error when the ioctl is called. I also tried using
copyout directly, but from the little reading I did, addr is already
supposed to be in the kernel address space, and it returns EFAULT.
Its been about 10 years since I've played seriously in the kernel
space, so I hope its something simple I've just forgotten. Can someone
point me at a way to get this functionality, short have having to write
a device-specific driver (a-la uvisor) ?
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"