Writing to a USB Device
SYNass IT Ubuntu / Linux
i-ubux at synass.net
Sun Jun 15 00:29:47 UTC 2008
On Sun, 2008-06-15 at 00:28 +0100, John wrote:
> Karl Larsen 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:
> >
> > [ 1356.357939] usb 1-2: new full speed USB device using ohci_hcd and
> > address 2
> > [ 1356.570089] usb 1-2: configuration #1 chosen from 1 choice
> > [ 1356.783916] Linux video capture interface: v2.00
> > [ 1356.815570]
> > /build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c:
> > USB GSPCA camera found.(SPCA561A)
> > [ 1356.828914] usbcore: registered new interface driver gspca
> > [ 1356.829686]
> > /build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c:
> > gspca driver 01.00.20 registered
> > [ 864.631564] process `skype' is using obsolete setsockopt SO_BSDCOMPAT
> >
> > This tells you all about it.
> >
> > Not sure what other things you can learn :-)
> >
> > Karl
> >
> >
> Thanks, Karl, but I feel you've missed the point, or maybe I have.
>
> I want to write an application (gcc or g++) which reads and writes
> packets of information to the USB device.
>
> I'm guessing that I need to locate the device in a list of connected USB
> devices so that I can get an identifier for it (possibly something like
> /dev/usb1 or /dev/usb2 ... do you get the drift - is my target usb1 or
> 2?). I then need to open a communication channel to and from the device
> and exchange data packets somehow.
>
> Am I on the right or wrong lines here and where can I find some good
> information / learning material?
>
> J
Hi J
Have you thought of labeling your disks ?
Here every disk has its unique label to be identified properly !
With blkid I am getting it displayed and can control them exactly. ;-D
What I do miss personally is a tool to catalog all these flying
media !!!
With the increasing amount of CD's, DVD, streamer tapes and nowadays USB
sticks,
not to forget all these liitle storage stuff from cams, PDA's etc such a
catalog would
help to recognize and organize all these variety of media !? ;-)
HTH and good luck to your project.
Cheers, svobi
More information about the ubuntu-users
mailing list