Writing to a USB Device
John
John at DMJ-Consultancy.co.uk
Sat Jun 14 23:28:02 UTC 2008
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
More information about the ubuntu-users
mailing list