Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2016 13:27:04 +0800
From:      Julian Elischer <julian@freebsd.org>
To:        freebsd-usb@freebsd.org
Subject:   Re: Byte-banging a USB device attached on ugen
Message-ID:  <9ea9f4ec-f6be-eaca-54cb-4013a3e0c7be@freebsd.org>
In-Reply-To: <c2e2dadd-6301-1b29-9203-0cb473437630@denninger.net>
References:  <c2e2dadd-6301-1b29-9203-0cb473437630@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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!
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9ea9f4ec-f6be-eaca-54cb-4013a3e0c7be>