Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

libusb access from Lazarus

21 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser and Joe Jared.

Does anybody have any experience of or preference for one or the other of these, in particular when not working on x86?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Luca Olivetti
to Mark Morgan Lloyd

En/na Mark Morgan Lloyd ha escrit:

Show quoted text 6 lines
I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser and Joe Jared. Does anybody have any experience of or preference for one or the other of these, in particular when not working on x86?

I've used the headers from Uwe Zimmermann (don't ask me why, I don't remember, probably because it was the newest one) in my botphone program http://ventoso.org/luca/topcombutler4012/
I'm not using it with my arm machine due to problems with the sound driver, but the libusb part worked fine under arm (oabi).

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Mark Morgan Lloyd
to Luca Olivetti
Luca Olivetti wrote 13 lines
En/na Mark Morgan Lloyd ha escrit: > I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb > lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser > and Joe Jared. > > Does anybody have any experience of or preference for one or the other > of these, in particular when not working on x86? I've used the headers from Uwe Zimmermann (don't ask me why, I don't remember, probably because it was the newest one) in my botphone program http://ventoso.org/luca/topcombutler4012/ I'm not using it with my arm machine due to problems with the sound driver, but the libusb part worked fine under arm (oabi).

Thanks Luca, I'll investigate. It's only for a Velleman K8055 USB board I'm tinkering with- just a few low-speed analogues and digitals.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd: I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets…

2008/11/11 Mark Morgan Lloyd :

Show quoted text 6 lines
I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser and Joe Jared. Does anybody have any experience of or preference for one or the other of these, in particular when not working on x86?

i used the one by Uwe Zimmermann (the api is quite stable - at least if you're using the 0.1.12 version, which hasn't been updated a lot). i've got it working on arm-linux without any problems (iirc). if you're interested in doing isochronous or asynchronous i/o, you might want to go with the latest devel branch (or even openusb, which is another project altogether). there is libusb-compat library that wraps the devel version to make porting very easy, but i've never had the need for it.

henry

Reply by email

Mark Morgan Lloyd
to Henry Vermaak
Henry Vermaak wrote 8 lines
i used the one by Uwe Zimmermann (the api is quite stable - at least if you're using the 0.1.12 version, which hasn't been updated a lot). i've got it working on arm-linux without any problems (iirc). if you're interested in doing isochronous or asynchronous i/o, you might want to go with the latest devel branch (or even openusb, which is another project altogether). there is libusb-compat library that wraps the devel version to make porting very easy, but i've never had the need for it.

Thanks Henry, noted in particular openusb. ARM is one of the platforms I'm being asked about, as is SPARC- the latter could obviously be a challenge if there are embedded endianness issues anywhere.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd

2008/11/12 Mark Morgan Lloyd :

Thanks Henry, noted in particular openusb. ARM is one of the platforms I'm being asked about, as is SPARC- the latter could obviously be a challenge if there are embedded endianness issues anywhere.

hmm, i've used libusb on a big endian arm system without problems, too, but the program was written in c, since i couldn't get any joy out of fpc for armeb. the stable libusb (0.1.12) has been present on all the embedded systems i've worked with, so you can't really go wrong. if you are planning to do complicated things, then writing a driver is obviously the best way to go.

henry

Reply by email

Mark Morgan Lloyd
to Henry Vermaak
Henry Vermaak wrote 11 lines
2008/11/12 Mark Morgan Lloyd : > Thanks Henry, noted in particular openusb. ARM is one of the platforms > I'm being asked about, as is SPARC- the latter could obviously be a > challenge if there are embedded endianness issues anywhere. hmm, i've used libusb on a big endian arm system without problems, too, but the program was written in c, since i couldn't get any joy out of fpc for armeb. the stable libusb (0.1.12) has been present on all the embedded systems i've worked with, so you can't really go wrong. if you are planning to do complicated things, then writing a driver is obviously the best way to go.

Thanks, that's valuable. I was able to get a C++ demo program for the board working on SPARC without obvious problems, so I'm hoping to be able to build on that (in between everything else :-) to rewrite the hardware supplier's Windows-only demo in portable form. Shouldn't be a big job and would definitely be useful for ourselves.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Luca Olivetti
to Mark Morgan Lloyd: Thanks Luca, I'll investigate. It's only for a Velleman K8055 USB board I'm tinkering…

En/na Mark Morgan Lloyd ha escrit:

Thanks Luca, I'll investigate. It's only for a Velleman K8055 USB board I'm tinkering with- just a few low-speed analogues and digitals.

I took a look at the program at http://linuxk8055.free.fr/ and it seems pretty simple, you should have no problem driving it from freepascal.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Mark Morgan Lloyd
to Luca Olivetti
Luca Olivetti wrote
I took a look at the program at http://linuxk8055.free.fr/ and it seems pretty simple, you should have no problem driving it from freepascal.

Yes, that's the one I used but it's got some build problems that had me scratching my head. I'm hoping to be able to use Lazarus to code something that looks almost the same as Velleman's example, possibly with extras like a count rate display and /very/ possibly with some embedded scripting for event handling.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Luca Olivetti: En/na Mark Morgan Lloyd ha escrit: I took a look at the program at…
Luca Olivetti wrote 7 lines
En/na Mark Morgan Lloyd ha escrit: > Thanks Luca, I'll investigate. It's only for a Velleman K8055 USB board > I'm tinkering with- just a few low-speed analogues and digitals. I took a look at the program at http://linuxk8055.free.fr/ and it seems pretty simple, you should have no problem driving it from freepascal.

This is now working fairly well and I'm starting to add extras- variable rate polling, counter rate extraction and so on.

I'm left with one niggle though which has a fairly significant cosmetic effect. I've replaced the scrollbars in the original app with vertical TrackBars and ProgressBars for analogue output and input respectively. The ProgressBars work nicely with zero at the bottom, but the TrackBars appears to have zero immutably at the top.

Is there a way to turn a TrackBar upside down?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Henry Vermaak: 2008/11/11 Mark Morgan Lloyd : i used the one by Uwe Zimmermann (the api is quite stable…
Henry Vermaak wrote 11 lines
2008/11/11 Mark Morgan Lloyd : > I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb > lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser > and Joe Jared. > > Does anybody have any experience of or preference for one or the other > of these, in particular when not working on x86? i used the one by Uwe Zimmermann (the api is quite stable - at least if you're using the 0.1.12 version, which hasn't been updated a lot). i've got it working on arm-linux without any problems (iirc).

I can confirm this is OK on x86, SPARC and ARM, i.e. there's no obvious endianness problems. Linux kernel version 2.6.x + libusb 0.1 in all cases.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd: I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets…
Mark Morgan Lloyd wrote
I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser and Joe Jared.

This page also mentions that there are specific interface files available for FTDI devices- does anybody know where they can be found these days?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd

2008/11/21 Mark Morgan Lloyd :

Show quoted text 8 lines
Mark Morgan Lloyd wrote: > I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb > lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser > and Joe Jared. This page also mentions that there are specific interface files available for FTDI devices- does anybody know where they can be found these days?

there is a libftdi (that uses libusb), but it's not really worth depending on, so it's better to read the source (one relatively small c file) and use it directly through libusb. i had to use a usb snoop program under windows to get things working properly, though. better to go with a cypress chip, i'd say...

henry

Reply by email

Mark Morgan Lloyd
to Henry Vermaak
Henry Vermaak wrote 14 lines
2008/11/21 Mark Morgan Lloyd : > Mark Morgan Lloyd wrote: >> I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb >> lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser >> and Joe Jared. > This page also mentions that there are specific interface files > available for FTDI devices- does anybody know where they can be found > these days? there is a libftdi (that uses libusb), but it's not really worth depending on, so it's better to read the source (one relatively small c file) and use it directly through libusb. i had to use a usb snoop program under windows to get things working properly, though. better to go with a cypress chip, i'd say...

Thanks Henry, got that. One of the things I'm due to be asked about is recoding some RS232 monitoring stuff, and I was wondering whether there was any magic I was missing.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Luca Olivetti
to Mark Morgan Lloyd

En/na Mark Morgan Lloyd ha escrit:

Thanks Henry, got that. One of the things I'm due to be asked about is recoding some RS232 monitoring stuff, and I was wondering whether there was any magic I was missing.

You shouldn't need libusb for that, the usb<->serial converter should work right out of the box (most of them do nowadays) but instead of using /dev/ttyS* it will (most probably depending on udev rules) be assigned to /dev/ttyUSB*.
I use synaser (http://www.ararat.cz/synapse) to program serial communications in a cross platform (at least win/linux) way.

Bye

Luca Olivetti Wetron Automatizaci?n S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007

Reply by email

Mark Morgan Lloyd
to Luca Olivetti
Luca Olivetti wrote 12 lines
En/na Mark Morgan Lloyd ha escrit: > Thanks Henry, got that. One of the things I'm due to be asked about is > recoding some RS232 monitoring stuff, and I was wondering whether there > was any magic I was missing. You shouldn't need libusb for that, the usb<->serial converter should work right out of the box (most of them do nowadays) but instead of using /dev/ttyS* it will (most probably depending on udev rules) be assigned to /dev/ttyUSB*. I use synaser (http://www.ararat.cz/synapse) to program serial communications in a cross platform (at least win/linux) way.

I agree that access to the ports shouldn't need anything other than /dev/ttyUSBx, but in the case of monitoring there's a need to get accurate timestamps on every character and signal transition which complicates things. As a result any possibility of improved resolution is worth pursuing.

Incidentally, I can't remember whether it was this list or FPC where there have been questions about accessing USB serial ports from DOS programs. I've run DOS code inside DOSemu on Linux driving USB serial ports for weeks without error, although obviously the longer-term plan is to convert it to run without an emulation layer.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd: Thanks Henry, got that. One of the things I'm due to be asked about is recoding some…

2008/11/22 Mark Morgan Lloyd :

Show quoted text 19 lines
Henry Vermaak wrote: > 2008/11/21 Mark Morgan Lloyd : >> Mark Morgan Lloyd wrote: >>> I notice that http://wiki.lazarus.freepascal.org/Hardware_Access#libusb >>> lists three sets of libusb headers from Uwe Zimmermann, Johann Glaser >>> and Joe Jared. >> This page also mentions that there are specific interface files >> available for FTDI devices- does anybody know where they can be found >> these days? > > there is a libftdi (that uses libusb), but it's not really worth > depending on, so it's better to read the source (one relatively small > c file) and use it directly through libusb. i had to use a usb snoop > program under windows to get things working properly, though. better > to go with a cypress chip, i'd say... Thanks Henry, got that. One of the things I'm due to be asked about is recoding some RS232 monitoring stuff, and I was wondering whether there was any magic I was missing.

the ftdi chip is practically a usb to serial converter, so you can actually use that. if you look at their windows dll api, you'll see that they've got a set of functions that mimic the windows serial functions. otherwise there are serial comms units for fpc (but i haven't used any of them).

henry

Reply by email

Mark Morgan Lloyd
to Henry Vermaak
Henry Vermaak wrote 5 lines
the ftdi chip is practically a usb to serial converter, so you can actually use that. if you look at their windows dll api, you'll see that they've got a set of functions that mimic the windows serial functions. otherwise there are serial comms units for fpc (but i haven't used any of them).

I'll be looking at comms coding at some point, but more important is making sure that I can run legacy arcane protocols- hence my interest in DOSemu, which is good enough to run things like EPROM blasters.

Does anybody use libusb-win32? If so could I have a copy of the unpacked binaries- I've got NT4 systems here which do have USB low-level drivers but the installer insists on NT5 and I don't want to start working out how to rebuild them.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marc Santhoff
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 16 lines
Henry Vermaak wrote: > the ftdi chip is practically a usb to serial converter, so you can > actually use that. if you look at their windows dll api, you'll see > that they've got a set of functions that mimic the windows serial > functions. otherwise there are serial comms units for fpc (but i > haven't used any of them). I'll be looking at comms coding at some point, but more important is making sure that I can run legacy arcane protocols- hence my interest in DOSemu, which is good enough to run things like EPROM blasters. Does anybody use libusb-win32? If so could I have a copy of the unpacked binaries- I've got NT4 systems here which do have USB low-level drivers but the installer insists on NT5 and I don't want to start working out how to rebuild them.

I have installed that stuff once on w2k, can you give the exact names of the DLLs you need? (... attention, henn and egg problem approaching ... ;)

Marc

Reply by email

Mark Morgan Lloyd
to Marc Santhoff
Marc Santhoff wrote 8 lines
> Does anybody use libusb-win32? If so could I have a copy of the unpacked > binaries- I've got NT4 systems here which do have USB low-level drivers > but the installer insists on NT5 and I don't want to start working out > how to rebuild them. I have installed that stuff once on w2k, can you give the exact names of the DLLs you need? (... attention, henn and egg problem approaching ... ;)

Thanks Marc, I'll mail direct later to avoid polluting this ML with C development :-)

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 9 lines
Marc Santhoff wrote: >> Does anybody use libusb-win32? If so could I have a copy of the unpacked >> binaries- I've got NT4 systems here which do have USB low-level drivers >> but the installer insists on NT5 and I don't want to start working out >> how to rebuild them. Thanks Marc, I'll mail direct later to avoid polluting this ML with C development :-)

For the record it looks as though even if low-level USB drivers are installed followed by libusb-win32 that there's something missing from the NT4 kernel that prevents the test programs from returning anything useful. Not a combination worth spending time on- I'll stick to Linux :-)

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email