Byte-banging a USB device attached on ugen
Julian Elischer
julian at freebsd.org
Wed Apr 27 05:27:15 UTC 2016
On 27/04/2016 4:06 AM, Karl Denninger wrote:
> So I've got one of these....
>
> ugen0.5: <X10 Wireless Technology Inc> at usbus0
>
> Which is a CM15.
>
> It does not appear to attach as an HID or expose a serial-like interface
> (on a tty or cua device node.)
>
> I have documentation of two end-points that this device uses, one for
> transmitting data to the host and one for receiving commands from the
> host, along with the byte-format protocol that is expected on each. As
> such if I can determine how to programmatically access those two
> end-points I should be good.
>
> What I'm having trouble finding documentation on is how to open the
> device and attach a byte stream to those endpoints on FreeBSD (e.g. how
> to get it open and specify which endpoint to associate with the handle)
> and once I do, can I expect to use the usual select() paradigm to see if
> they're ready for read (e.g. something is on the bus inbound to me) and
> ready for write (can be written to.)
>
> Is there a pointer available somewhere to a code fragment that shows how
> to do this? I also want to get the device specification as part of the
> setup, obviously, to make sure I'm talking to the right device and not
> some other random thing that was plugged in -- my intent is to handle
> the situation where my code can detect a hot-plug (or unplug) of the
> device and initialize and/or shut down the channel accordingly and thus
> I want to iterate over the ugen devices I find and check them for the
> correct device specification.
what you are looking for is libusb I think.
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=3&query=libusb20&manpath=FreeBSD+5.0-current&format=html
you should also look at the webcamd which I think uses it.
>
> Thanks in advance!
>
More information about the freebsd-usb
mailing list