[fpc-pascal] USB Human Interface Devices

James Richters james at productionautomation.net
Fri Aug 9 03:36:54 CEST 2019


I changed the VID and PID to match the device I am trying to use and I was able to successfully compile and run test2controlsync.pas and test3controlasync.pas, but when I tried to use my VID and PID in test_arduino_with_bmp280.pas I can't even compile it.. using the x86_64-win64 Text IDE I get the following:

Warning: PIC directive or switch ignored                                                 
Hint: End of reading config file I:\Programming\FPC\W64_Trunk\Bin\x86_64-win64\fp.cfg    
libusbutil.pas(35,63) Error: Constructor name must be INIT                               
libusbutil.pas(45,78) Error: Constructor name must be INIT                               
libusbutil.pas(58,50) Error: Constructor name must be INIT                               
libusbutil.pas(73,108) Error: Constructor name must be INIT                              
libusbutil.pas(76,1) Fatal: There were 4 errors compiling module, stopping               
libusbutil.pas(0) Fatal: Compilation aborted  

Anyone know what this means and how I might fix it?


James

-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of James Richters
Sent: Thursday, August 8, 2019 8:20 PM
To: Jean.Suzineau at wanadoo.fr; 'FPC-Pascal users discussions' <fpc-pascal at lists.freepascal.org>
Subject: Re: [fpc-pascal] USB Human Interface Devices

I finally got the text IDE working with x86_64-Win64!   I was thinking of making a bug report on the problem with the Text IDE but before I did that I thought I would test the current Trunk, and surprisingly that worked just fine!  so I got my settings all put in it and I was able to compile my project with it.

So the next thing I thought I would do is use the IDE to compile the pas-libusb_test_dll examples.  With the IDE it was easier to just copy the units into the same directory as the files.  I started with test1library.pas... it compiled fine so I ran it, and here's what I got.... 


Running "i:\programming\pas-libusb_test_dll\src\examples\test1library.exe "
Using libusb(x) v1.0.22.11312
Found 23 devices:
  Bus   3 Device   0: ID 1B21:2142,  port:   0, Speed: Unknown
  Bus   1 Device   0: ID 1B21:2142,  port:   0, Speed: Unknown
  Bus   2 Device  14: ID 1B1C:0C10,  port:   3, port path from HCD: 0An unhandled exception occurred at $0000000100001DC8:
ERangeError: Range check error
  $0000000100001DC8  main,  line 82 of ../../pas-libusb_test_dll/src/examples/test1library.pas

->

so this was strange... it was working before

line 81            For J := 1 to Length(PortPath)-1 do
line 82              Write('->',PortPath[I]);

Line 82 is using variable I but it's in a loop that uses J, I didn't think that made a lot of sense.. so without really analyzing how any of this was supposed to work.. I just changed the I to a J and then I got this:
              
->Running "i:\programming\pas-libusb_test_dll\src\examples\test1library.exe "
Using libusb(x) v1.0.22.11312
Found 23 devices:
  Bus   3 Device   0: ID 1B21:2142,  port:   0, Speed: Unknown
  Bus   1 Device   0: ID 1B21:2142,  port:   0, Speed: Unknown
  Bus   2 Device  14: ID 1B1C:0C10,  port:   3, port path from HCD: 0->7, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device   8: ID 1B1C:0C12,  port:  10, port path from HCD: 0, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   1 Device   1: ID 1D50:6015,  port:   3, port path from HCD: 0, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device  58: ID 0424:274C,  port:   5, port path from HCD: 0->5->1, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device  62: ID 10CE:EB93,  port:   2, port path from HCD: 0->1, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device  57: ID 047D:1020,  port:   3, port path from HCD: 0->5->1, Speed: 1.5 Mbit/s (USB LowSpeed)
  Bus   2 Device  44: ID 0C45:7403,  port:   2, port path from HCD: 0->5, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device   6: ID 051D:0002,  port:   3, port path from HCD: 0, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device  36: ID 04E8:61F5,  port:   1, port path from HCD: 0->17, Speed: unknown (4)
  Bus   2 Device  59: ID 1B1C:1B4F,  port:   4, port path from HCD: 0->5->1, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device   5: ID 05E3:0608,  port:   7, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device   7: ID 05E3:0608,  port:   8, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device  13: ID 1B1C:1C08,  port:   2, port path from HCD: 0->7, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device   1: ID 0BDA:0411,  port:  17, port path from HCD: 0, Speed: unknown (4)
  Bus   2 Device  42: ID 1A40:0101,  port:   5, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device   0: ID 8086:A2AF,  port:   0, Speed: Unknown
  Bus   2 Device  56: ID 0424:2734,  port:   1, port path from HCD: 0->5, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device  15: ID 05E3:0610,  port:   4, port path from HCD: 0->7, Speed: 480 Mbit/s (USB HighSpeed)
  Bus   2 Device  61: ID 0E50:0002,  port:   4, port path from HCD: 0, Speed: 1.5 Mbit/s (USB LowSpeed)
  Bus   2 Device  41: ID 0A5F:0006,  port:   2, port path from HCD: 0, Speed: 12 Mbit/s (USB FullSpeed)
  Bus   2 Device   2: ID 0BDA:5411,  port:   1, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)              
  
Looks like it worked fine with line 82 reading:  Write('->',PortPath[J]);   
I'm perplexed at how this could have possibly worked before...

So is it supposed to be Write('->',PortPath[J]); and the I was just a typo, or is something else going on here?
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list