[fpc-pascal] Linux USB programming using FPC

Johann Glaser Johann.Glaser at gmx.at
Mon Jun 15 17:15:40 CEST 2009


Hi!

Am Montag, den 15.06.2009, 09:44 +0200 schrieb fpclist at silvermono.co.za:
> Hi guys,
> 
> I'm interested in exploring the USB interface from within Linux using FPC.
> I have looked at libusb and am aware of the functionality which it exposes. 
> 
> I would appreciate it if someone with USB programming experience could help by 
> pointing me to a website or documentation that reveals a bit more than just 
> iterating through connected devices on a USB bus. A code snippet or two would 
> be most helpful. 
> 
> While I am aware that specific device drivers are required in order to access 
> specific USB devices, code samples demonstrating reading and writing to and 
> from a file system on USB stick would be most welcome.

As Henry already pointed out, file system (and block device) access of
USB mass storage devices is already there in the Linux kernel.

For other kinds of devices, especially where the Linux kernel has no
built in drivers, you can use libusb.

Some time ago I did header translations for it. I'll attach it
(libusb.pas) plus some utilities and a class wrapper (usbutil.pas),
firmware download to Cypress EZ-USB AN2131 (and related) chips
(ezusb.pas), intel hex file reader (intelhex.pas), and some generic
utilities (utils.pas) used by the other units. As an example of a device
driver for a simple device I built, I'll attach accudraindev.pas.
Unfortunately it's rather uncommented, sorry.

@FPC team: Are you interested in including the libusb header
translations (and possibly the other stuff) to FPC rtl?

Bye
  Hansi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb.tar.gz
Type: application/x-compressed-tar
Size: 11300 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090615/4ba3448e/attachment.bin>


More information about the fpc-pascal mailing list