[fpc-pascal] USB Human Interface Devices

James Richters james at productionautomation.net
Fri Aug 9 02:19:36 CEST 2019


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?


More information about the fpc-pascal mailing list