Sign in Join

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

Mailing lists / lazarus / 2009-04

USB Commincation with Lazarus and libusb library

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Sébastien FLOURETTE

Hi,

I contact you because I'm trying since 3 week to do a communication between an electronic board and a Lazarus application with the libusb library ( libusb.sourceforge.net).
After many reserach on the web and lot of manipulations I can't do it .

I want to do a multiplatform application (MAC OS, Windows and Linux) but MAC OS and windows in priority.

I thanks in advance and don't hesitate to contact me for questions if you need details.

Good day

Bonne journ?e S?bastien FLOURETTE -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090407/e578a01b/attachment.html

Reply by email

Henry Vermaak
to Sébastien FLOURETTE

2009/4/7 S?bastien FLOURETTE :

Show quoted text 6 lines
Hi, I contact you because I'm trying since 3 week to do a communication between an electronic board and a Lazarus application with the libusb library (libusb.sourceforge.net). After many reserach on the web and lot of manipulations I can't do it .

you'll first have to tell us what the problem/error is before we can help. what are you trying to do? if you can link to libusb and call the functions, then you should rather post to the libusb mailing list, since they can help you with usb specific stuff. i have used libusb before from fpc (under linux) and it works as expected.

I want to do a multiplatform application (MAC OS, Windows and Linux) but MAC OS and windows in priority.

there are subtle differences in the way libusb and libusb-win32 works, since they are not the same project, so be warned.

henry

Reply by email

Henry Vermaak
to Henry Vermaak
Show quoted text 9 lines
Hi, in response to your message : I have install the libusb library on my MAC OS X and I have link libusb with my Lazrus project and I can call function. The problem is when I try do dev := dev^.next; or dev^.descriptor.idVendor = $04d8 or another operation on dev I get an error "EXC_ACCESS_ERROR" Is it an memory problem ?

make sure you have sufficient rights to access the usb device (run your program as root to test). i have no idea how to give this access on the mac, but you use udev for this on linux.

i see in your sources that you don't try and open the device or claim an interface. try and do this before you check vid/pid: like so:

while bus  nil do begin
    dev := bus^.devices;
    while dev  nil do begin
          usb_device := usb_open(dev);
          if (usb_device  nil) and ((dev^.descriptor.idVendor =
$1234) and (dev^.descriptor.idProduct = $4568)) then ...

i'm not sure if it will solve your problem, though.

if this doesn't help, try the testlibusb.c program in the usb sources and see if that works.

henry

Reply by email

Henry Vermaak

2009/4/8 Henry Vermaak :

Show quoted text 18 lines
2009/4/8 S?bastien FLOURETTE : > I try that you tell me but the result is not good. so what was the result of the libusb test program in c? ?do you have permissions to use the device? > > Have you got an example of use libusb on Lazarus. Perhaps I have a > parameters or other is not good. > If you have can you send me it. i already pasted the relevant code, there's nothing else that's different in my code. ?it works for me in linux. you might have to make a test program in c and ask for help on the libusb list. henry

Reply by email

Sébastien FLOURETTE

2009/4/8 S?bastien FLOURETTE

Show quoted text 52 lines
I have test the test program libusb in C and it work perfectly because I have the list of my device :Dev #0: 05AC - 8005 Dev #0: 05AC - 8005 Dev #0: Apple, Inc. 05AC- Apple Internal Keyboard / Trackpad 0002 Dev #0: http://www.roboticus.org 04D8- USB HID Firmware example - http://www.roboticus.org 0002 Dev #0: 05AC - 8006 Dev #0: 05AC - 8006 Dev #0: 05AC - 8005 Dev #0: 05AC - 8005 Dev #0: 05AC - 8005 Dev #0: 05AC - 8006 Dev #0: Sony 054C- Storage Media 0002 in blue is my board but when I do it on lazarus it don't work. There is options of compilation or specific parameters in lazarus ?? Thanks you for your help S?bastien Le 8 avr. 09 ? 15:05, Henry Vermaak a ?crit : 2009/4/8 S?bastien FLOURETTE : I try that you tell me but the result is not good. so what was the result of the libusb test program in c? do you have permissions to use the device? Have you got an example of use libusb on Lazarus. Perhaps I have a parameters or other is not good. If you have can you send me it. i already pasted the relevant code, there's nothing else that's different in my code. it works for me in linux. you might have to make a test program in c and ask for help on the libusb list. henry
Bonne journ?e S?bastien FLOURETTE 1er Etage, 1?re Porte Droite 35, Rue Emile Goeury 94140 ALFORTVILLE 06-74-67-53-44 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090409/59ce4a8a/attachment.html

Reply by email