Writing to a USB Device
Jonathan Hudson
jh+ubuntu at daria.co.uk
Sat Jun 14 22:47:53 UTC 2008
On Sat, 14 Jun 2008 15:23:02 -0600
Karl Larsen <k5di at zianet.com> wrote:
> John wrote:
> > Hi,
> >
> > I'm gathering the courage to write a program which controls an external
> > device via a USB port. The development and target operating systems are
> > Ubuntu 8.
> >
> > Are there any good books or web sites which would give me an idea of
> > what is involved?
> >
> > TIA
> >
> > J
> >
> > (Although couched as a general question, the external device is a Lenz
> > LVZ100 Model Railway controller!)
> >
> >
> >
> Well it should be a short book. To see what device your USB device
> is plugged into use $dmesg | tail and you see this:
>
Sadly, once again Karl chooses to pollute the NG with a load of
stuff that is not helpful to the OP .....
John, you have (at least) two choices, depending on the
programming language and your skills:
(a) Write a kernel device driver to interface to the controller, a
Google search for "linux device drivers" will find you excellent
references on the subject;
(b) Write a user-space application using libusb. A google search for
'libusb' will find you the documentation.
I would recommend the latter, which is what I used to to write w1retap,
<http://sourceforge.net/projects/w1retap/>, an application with gathers
data from one-wire weather stations via (inter alia), a USB device.
Unless you device is well documented, be prepared for a lot of hard
work reverse engineering the protocol.
-jh
More information about the ubuntu-users
mailing list