Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Aug 2009 14:39:39 -0400
From:      Brian McGovern <bmcgover@cisco.com>
To:        freebsd-questions@freebsd.org
Subject:   Writing to a uhid device?
Message-ID:  <1249497579.39696.78.camel@bmcgover-pc.cisco.com>

next in thread | raw e-mail | index | archive | help
I picked up a Velleman K8055 digital I/O controller that connects to a
PC via a USB port. FreeBSD picks up this device as a uhid, and I can see
the following elements:

bmcgover-pc# usbhidctl -f /dev/uhid2 -r
Report descriptor:
Collection page=Microsoft usage=0x0001
Input   size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0002, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0003, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0004, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0005, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0006, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0007, logical range 0..255
Input   size=8 count=1 page=Microsoft usage=0x0008, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0001, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0002, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0003, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0004, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0005, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0006, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0007, logical range 0..255
Output  size=8 count=1 page=Microsoft usage=0x0008, logical range 0..255
End collection
Total   input size 8 bytes
Total  output size 0 bytes
Total feature size 0 bytes


Reading from the device 8 bytes at a time does whats expected - I can
see the digital and analog inputs, the counters, etc, and all is fine.

However, I notice on the above output that the "total output size" is 0,
and writing 8 bytes of information to the device seems to do nothing for
the outputs.

I'm guessing at this point that its an issue somewhere with the driver,
but a quick look at uhid_do_write() looks like its doing something,
although the behavior changes around sc->sc_oid and sc->sc_osize
(possible issue with the 'total output size' being 0, above?).

Does anyone have any thoughts or ideas, or better yet, experience with
such devices, before I spend a couple of days of banging my head against
the wall trying to figure out whats happening "under the hood"? Is there
a special/magic process? Or should I just be able to write the 8 bytes,
1 for each output, as I read the input?

	-B



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1249497579.39696.78.camel>