Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread Johann Glaser
Hi!

Am Freitag, den 09.08.2019, 08:08 -0400 schrieb James Richters:
> Hi Hansi,
> Thanks for the explanation.
>
> Here's the python code I’m trying to port over to FPC:
> https://github.com/wolfmanjm/kivy-smoothie-host/blob/master/modules/hb04.py
>
> it uses functions like hid.open, hid.close, hid.read, hid.write, and
> hid.send_feature_report   I'm trying to figure out how to somehow get
> similar functions to those in FPC.   Some example of how to perform
> those kinds of functions would be extremely helpful!

These hid.open, hid.close, ... functions are all methods of the object
"hid", which was previously assigned to from devices[0] (line 68),
which itself was returned from en.find(), where en is an object of
Enumeration() from the package easyhid.

To communicate with USB HID devices, please peek into the outdated
branch “master” of pas-libust (for legacy libusb-0.1) and open file
src/usb.pas. This is the old analogous to the new libusboop.pas.

It has the class TUSBPseudoHIDInterface which implements basic
communication with USB HID devices.

I've used that for a project with a barcode scanner. Please find
attached the two files snapi.pas (implementing the "standard" SNAPI for
barcode scanners, which is based on USB HID), and
barcodescannersymbolms4407.pas (implementing a few more specific
methods for a Symbol MS4407 barcode scanner). The latter file uses
several units of my project, therefore it will not compile on your
host. It is just to see how to use the SNAPI devices. I release these
files with the same license as libusboop.pas.

Please excuse that these files are still based on the outdated pas-
libusb for the old libusb-0.1. Therefore they would need translation
for the newer libusb-1.0 stuff. Unfortunately I've never head time to
transition the project. Actually you could copy the class
TUSBPseudoHIDInterface (plus the types THIDReport and TIntrReportFunc)
from usb.pas to libusboop.pas and change everything necessary.

At least one difference is that all names change from TUSB* to
TLibUsb*. I'm sure there are more, but I don't know by heart.

Please also excuse that I can’t recall why its just “PseudoHID” and not
a fully-fledged HID. Probably I didn’t implement all HID functions, or
the SNAPI HID interface just isn't registered with descriptor type $21.

This brings me to the second topic, where you got the message
  Unknown descriptor type $21 with length 9
from test2controlsync. That's a HID descriptor (see LIBUSB_DT_HID). It
is just not decoded in test2controlsync.

And finally, the third point regarding the bug with PortPath index.
I've fixed that now and pushed to Github. Thanks for pointing this out!

Thanks
  Hansi

> -Original Message-
> From: fpc-pascal  On Behalf
> Of Johann Glaser
> Sent: Friday, August 9, 2019 7:17 AM
> To: fpc-pascal@lists.freepascal.org
> Subject: Re: [fpc-pascal] USB Human Interface Devices
>
> Hi!
>
> Just a quick reply while at work, I'll reply to all EMails in the
> evening.
>
> First of all: Thanks for finding the bug with the index variable I
> vs. J. I'll fix that in the evening.
>
> Secondly: You are correct, the "EZ-USB" is a specific chip family by
> Cypress, e.g., AN2131, without Flash/ROM but with SRAM for the
> firmware. I built a few devices with that chip, therefore I also
> implemented the Pascal "driver" to download the firmware into the
> "naked" device. There are also many (old) devices on the marked which
> use that chip, e.g., the Keil uLink (1st generation).
>
> To understand how USB actually works (endpoints, in and out
> transfers, control/bulk/interrupt/isochronous transfers, ...), I have
> learned a lot from the Technical Reference Manual (TRM) of the EZ-
> USB. Just search for it, there are plenty of sources. Chapter 1 is
> the interesting one. If you directly search at the Cypress page, they
> will redirect you to the successor product FX2, but its chapter 1 is
> nearly identical to that of EZ-USB.
>
> The EZ-USB firmware download is performed with control transfers to
> EP0. So you can find examples for control transfers in ezusb.pas.
>
> You can find example code for bulk and interrupt endpoints e.g., in
> https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas.
>
> I can provide more examples in the evening.
>
> Bye
>   Hansi
>
> > Gesendet: Freitag, 09. August 2019 um 12:09 Uhr
> > Von: "James Richters" 
> > An: "'FPC-Pascal users discussions'" <
> > fpc-pascal@lists.freepascal.org>
> > Betreff: Re: [fpc-pascal] USB Human Interface Devices
> >
> > Maybe I am going down the wrong path trying to get
> > test_arduino_with_bmp280.pas to work with my device...  I think I
> > am confusing easyusb with easyhid which is what is used to
> > communicate with the device in the python code I am trying to
> > use.  It looks like easyusb is to send firmware to a specific usb
> > device that has no rom in it... and that's not exactly what I'm
> > trying to do...
> >
> > I'm trying to figure out how to open the device and rea

Re: [fpc-pascal] unit GUi creation also usable for visually impaired developers with no sight at all

2019-08-09 Thread Mgr. Janusz Chmiel
Oh it is very promising programmers approach. I Am even dreaming about 
live Internet radio player written by using Pas2JS. I have analysed 
included units and I have found Webaudio unit.
BUt I Am afraid, that opening live stream with .MP3 live stream and play 
it from Pascal source by using Pas2JS is not so simple as it could seems 
to be.
I have read big unit but there was one function to open audio source. 
But working with such APi would require some deep study.

Thank you for yours tip I have downloaded and tried The WEB page.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FP.exe error in x86_64-Win64

2019-08-09 Thread Jean SUZINEAU

  
  
Le 09/08/2019 à 15:39, James Richters a
  écrit :


  
  
  
  
I am not
using libusb in my project yet…  all that is still just in
separate test programs.  This is the original version of my
project, just compiled for 64bits…  I had to make some other
changes to it.   I have never needed to install anything
else to get my program to run.   I re-compiled it back to
win32 and it runs fine again.
 
I think what
your are saying is that I probably have something that has a
dependency on it, and somehow I already end up having the
win32 version of the DLL but I don’t have the 64 bit version
  

Sorry, I didn't understood correctly, I thought you were trying
  with one  of pas-libusb examples.
May be you can try to list the dll dependencies of your compiled
  program. I searched for ldd equivalents for Windows, Google points
  to http://dependencywalker.com/
May be that in 32 bits your executable uses another (older)
  version of msvcr.dll which is already installed on your test
  machine.

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] unit GUi creation also usable for visually impaired developers with no sight at all

2019-08-09 Thread Jean SUZINEAU

Le 09/08/2019 à 12:22, Mgr. Janusz Chmiel a écrit :
Does somebody of you know about Lazarus compatible Unit, which is able 
to create Windows GUi with no need to specify object position values 
in points or in Pixels?
Something similar like VCL units have for commercial BOrland Delphi. 
Or unfortunately, there is no such unit available for Free Pascal 
compiler and Lazarus?
Visually impaired programmer can not correctly determine object 
position values. So only units, which try to automatically calculate 
objects positions are usable for visually impaired developers.

Thank you very much for yours answers.


May be you should have a look at pas2js ? And the mailing list for 
freepascal pas2js ( https://www.freepascal.org/maillist.html )


Michael Van Canneyt has recently published on it a proof of concept 
which seems to go exactly in this direction.


https://lists.freepascal.org/pipermail/pas2js/2019-August/88.html

https://www.freepascal.org/~michael/designdemo/designdemo.html


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FP.exe error in x86_64-Win64

2019-08-09 Thread James Richters
I am not using libusb in my project yet…  all that is still just in separate 
test programs.  This is the original version of my project, just compiled for 
64bits…  I had to make some other changes to it.   I have never needed to 
install anything else to get my program to run.   I re-compiled it back to 
win32 and it runs fine again.

 

I think what your are saying is that I probably have something that has a 
dependency on it, and somehow I already end up having the win32 version of the 
DLL but I don’t have the 64 bit version

 

From: fpc-pascal  On Behalf Of Jean 
SUZINEAU
Sent: Friday, August 9, 2019 9:24 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] FP.exe error in x86_64-Win64

 

Le 09/08/2019 à 14:19, James Richters a écrit :

Now I have a new problem.  I am able to successfully compile and run my project 
with the text IDE if I use the trunk version of FPC, and I can run the 
resulting exe just fine on the computer I compiled it on,  but when I run it on 
one of my other computers, one that I was always able to run the win32 version 
of my program on just fine,  the x64 version now comes up with 

 

‘The code execution cannot proceed because MSVCR110.dll was not found. 
Reinstalling the program may fix this problem’

 

I do not understand this at all, I never needed anything like that dll before, 
and I have no idea what it is or why the 64bit version would need it, and I 
also don’t know why  this works fine on my development computer without it and 
why I need it on my other computers that I have been running the 32bit version 
of the exact same program on for years.

 

Any thoughts on this?

 

Yes , it just seems that libusb relies on MSVCR110.dll. Very likely you have 
another version on this machine. 

I googled for MSVCR110.dll, it pointed to me to the MSVCR fro VisualStudio 2012:

https://www.microsoft.com/en-us/download/details.aspx?id=30679

It happens to me frequently when installing a  product on a customer's 
computer. Depending on the product you can have to install a different version 
of the redistributable. On some computers the dll is already there, sometimes 
not. As far as I know Microsoft now forbids you to include the dll directly in 
your distribution, you need to use their install program which installs it 
reliably (I think in C:\Windows\System32) and maybe some other stuff around and 
in the registry.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FP.exe error in x86_64-Win64

2019-08-09 Thread Jean SUZINEAU

  
  
Le 09/08/2019 à 14:19, James Richters a
  écrit :


  
  
  
  
Now I have a
new problem.  I am able to successfully compile and run my
project with the text IDE if I use the trunk version of FPC,
and I can run the resulting exe just fine on the computer I
compiled it on,  but when I run it on one of my other
computers, one that I was always able to run the win32
version of my program on just fine,  the x64 version now
comes up with 
 
‘The code
execution cannot proceed because MSVCR110.dll was not found.
Reinstalling the program may fix this problem’
 
I do not
understand this at all, I never needed anything like that
dll before, and I have no idea what it is or why the 64bit
version would need it, and I also don’t know why  this works
fine on my development computer without it and why I need it
on my other computers that I have been running the 32bit
version of the exact same program on for years.
 
Any thoughts
on this?
 
  

Yes , it just seems that libusb relies on MSVCR110.dll. Very
  likely you have another version on this machine. 

I googled for MSVCR110.dll, it pointed to me to the MSVCR fro
  VisualStudio 2012:
https://www.microsoft.com/en-us/download/details.aspx?id=30679
It happens to me frequently when installing a  product on a
  customer's computer. Depending on the product you can have to
  install a different version of the redistributable. On some
  computers the dll is already there, sometimes not. As far as I
  know Microsoft now forbids you to include the dll directly in your
  distribution, you need to use their install program which installs
  it reliably (I think in C:\Windows\System32) and maybe some other
  stuff around and in the registry.

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] unit GUi creation also usable for visually impaired developers with no sight at all

2019-08-09 Thread fredvs
Hello.

There is ideU, a child of mseide that is voice-assisted and gives also the
position of the mouse by voice.

https://github.com/fredvs/ideU/releases

Fre:D

 



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FP.exe error in x86_64-Win64

2019-08-09 Thread James Richters
Now I have a new problem.  I am able to successfully compile and run my project 
with the text IDE if I use the trunk version of FPC, and I can run the 
resulting exe just fine on the computer I compiled it on,  but when I run it on 
one of my other computers, one that I was always able to run the win32 version 
of my program on just fine,  the x64 version now comes up with 

 

‘The code execution cannot proceed because MSVCR110.dll was not found. 
Reinstalling the program may fix this problem’

 

I do not understand this at all, I never needed anything like that dll before, 
and I have no idea what it is or why the 64bit version would need it, and I 
also don’t know why  this works fine on my development computer without it and 
why I need it on my other computers that I have been running the 32bit version 
of the exact same program on for years.

 

Any thoughts on this?

 

 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread James Richters
Hi Hansi, 
Thanks for the explanation.

Here's the python code I’m trying to port over to FPC:
https://github.com/wolfmanjm/kivy-smoothie-host/blob/master/modules/hb04.py

it uses functions like hid.open, hid.close, hid.read, hid.write, and 
hid.send_feature_report   I'm trying to figure out how to somehow get similar 
functions to those in FPC.   Some example of how to perform those kinds of 
functions would be extremely helpful!

Thank you for your help with this

James


-Original Message-
From: fpc-pascal  On Behalf Of Johann 
Glaser
Sent: Friday, August 9, 2019 7:17 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] USB Human Interface Devices

Hi!

Just a quick reply while at work, I'll reply to all EMails in the evening.

First of all: Thanks for finding the bug with the index variable I vs. J. I'll 
fix that in the evening.

Secondly: You are correct, the "EZ-USB" is a specific chip family by Cypress, 
e.g., AN2131, without Flash/ROM but with SRAM for the firmware. I built a few 
devices with that chip, therefore I also implemented the Pascal "driver" to 
download the firmware into the "naked" device. There are also many (old) 
devices on the marked which use that chip, e.g., the Keil uLink (1st 
generation).

To understand how USB actually works (endpoints, in and out transfers, 
control/bulk/interrupt/isochronous transfers, ...), I have learned a lot from 
the Technical Reference Manual (TRM) of the EZ-USB. Just search for it, there 
are plenty of sources. Chapter 1 is the interesting one. If you directly search 
at the Cypress page, they will redirect you to the successor product FX2, but 
its chapter 1 is nearly identical to that of EZ-USB.

The EZ-USB firmware download is performed with control transfers to EP0. So you 
can find examples for control transfers in ezusb.pas.

You can find example code for bulk and interrupt endpoints e.g., in 
https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas.

I can provide more examples in the evening.

Bye
  Hansi

> Gesendet: Freitag, 09. August 2019 um 12:09 Uhr
> Von: "James Richters" 
> An: "'FPC-Pascal users discussions'" 
> Betreff: Re: [fpc-pascal] USB Human Interface Devices
>
> Maybe I am going down the wrong path trying to get 
> test_arduino_with_bmp280.pas to work with my device...  I think I am 
> confusing easyusb with easyhid which is what is used to communicate with the 
> device in the python code I am trying to use.  It looks like easyusb is to 
> send firmware to a specific usb device that has no rom in it... and that's 
> not exactly what I'm trying to do...
>
> I'm trying to figure out how to open the device and read data and write data 
> to this device.  Is there an example of how to do that with pas-libusb?
>
> Sorry I am so confused by all this.  I feel like I'm almost to where I will 
> understand things again but I'm just missing something.
>
> James
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread Johann Glaser
Hi!

Just a quick reply while at work, I'll reply to all EMails in the evening.

First of all: Thanks for finding the bug with the index variable I vs. J. I'll 
fix that in the evening.

Secondly: You are correct, the "EZ-USB" is a specific chip family by Cypress, 
e.g., AN2131, without Flash/ROM but with SRAM for the firmware. I built a few 
devices with that chip, therefore I also implemented the Pascal "driver" to 
download the firmware into the "naked" device. There are also many (old) 
devices on the marked which use that chip, e.g., the Keil uLink (1st 
generation).

To understand how USB actually works (endpoints, in and out transfers, 
control/bulk/interrupt/isochronous transfers, ...), I have learned a lot from 
the Technical Reference Manual (TRM) of the EZ-USB. Just search for it, there 
are plenty of sources. Chapter 1 is the interesting one. If you directly search 
at the Cypress page, they will redirect you to the successor product FX2, but 
its chapter 1 is nearly identical to that of EZ-USB.

The EZ-USB firmware download is performed with control transfers to EP0. So you 
can find examples for control transfers in ezusb.pas.

You can find example code for bulk and interrupt endpoints e.g., in 
https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas.

I can provide more examples in the evening.

Bye
  Hansi

> Gesendet: Freitag, 09. August 2019 um 12:09 Uhr
> Von: "James Richters" 
> An: "'FPC-Pascal users discussions'" 
> Betreff: Re: [fpc-pascal] USB Human Interface Devices
>
> Maybe I am going down the wrong path trying to get 
> test_arduino_with_bmp280.pas to work with my device...  I think I am 
> confusing easyusb with easyhid which is what is used to communicate with the 
> device in the python code I am trying to use.  It looks like easyusb is to 
> send firmware to a specific usb device that has no rom in it... and that's 
> not exactly what I'm trying to do...
>
> I'm trying to figure out how to open the device and read data and write data 
> to this device.  Is there an example of how to do that with pas-libusb?
>
> Sorry I am so confused by all this.  I feel like I'm almost to where I will 
> understand things again but I'm just missing something.
>
> James
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] unit GUi creation also usable for visually impaired developers with no sight at all

2019-08-09 Thread Mgr. Janusz Chmiel
Does somebody of you know about Lazarus compatible Unit, which is able 
to create Windows GUi with no need to specify object position values in 
points or in Pixels?
Something similar like VCL units have for commercial BOrland Delphi. Or 
unfortunately, there is no such unit available for Free Pascal compiler 
and Lazarus?
Visually impaired programmer can not correctly determine object position 
values. So only units, which try to automatically calculate objects 
positions are usable for visually impaired developers.

Thank you very much for yours answers.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread James Richters
Maybe I am going down the wrong path trying to get test_arduino_with_bmp280.pas 
to work with my device...  I think I am confusing easyusb with easyhid which is 
what is used to communicate with the device in the python code I am trying to 
use.  It looks like easyusb is to send firmware to a specific usb device that 
has no rom in it... and that's not exactly what I'm trying to do... 

I'm trying to figure out how to open the device and read data and write data to 
this device.  Is there an example of how to do that with pas-libusb?

Sorry I am so confused by all this.  I feel like I'm almost to where I will 
understand things again but I'm just missing something.

James
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread James Richters
I had "Use STATIC in objects" turned on in compiler setings.. once I turned 
that off I was able to compile libusbutil.pas successfully.

Now when I try to run it though, I am getting :Couldn't connect to device: 
Access violation

I don't know why.  
I don't really know what I am doing.. but here is what I did so far... 

I ran test1library (which also has the line Write('->',PortPath[J]); in it... I 
changed the J to an I again)
I got the list of devices,  then I plugged in the one I am trying to access and 
ran Test1library once again... then I saw the new device in the list, which was 
this one:
Bus   2 Device  62: ID 10CE:EB93,  port:   2, port path from HCD: 0->1, 
Speed: 12 Mbit/s (USB FullSpeed)

So I changed the lines in testcontrolsync.pas as follow:
Const
 WHB04B_VID= $10CE;
 WHB04B_PID= $EB93;

Const DevVID = WHB04B_VID;
  DevPID = WHB04B_PID;

Then I get this output:
Running "i:\programming\pas-libusb_test_dll\src\examples\test2controlsync.exe "
Bus 002 Device 062: ID 10CE:EB93
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor$10CE
  idProduct   $EB93
  bcdDevice1.00
  iManufacturer   1 KTURT.LTD
  iProduct0
  iSerialNumber   0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   27
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes  $80
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   0
  bInterfaceClass 3
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
Unknown descriptor type $21 with length 9

So that looks promising... I don't know about the unknown descriptor, but at 
least I have some information that seems reasonable.
With the same modifications to test3controlasync.pas I get this:

Running "i:\programming\pas-libusb_test_dll\src\examples\test3controlasync.exe "
Submitting control transfer
Finished Transfer, Data = 38, Status = 0, ActualLength = 18
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor$10CE
  idProduct   $EB93
  bcdDevice1.00
  iManufacturer   1
  iProduct0
  iSerialNumber   0
  bNumConfigurations  1
Done.

So I again put my device VID and PID into test_arduino_with_bmp280.pas and got 
this:

Running 
"i:\programming\pas-libusb_test_dll\src\examples\test_arduino_with_bmp280.exe "
No unconfigured devices found.
Couldn't connect to device: No configured devices found.

I suspect it has something to do with the firmware.ihx file mentioned in the 
comments, but I do not understand how to get that file.  It says to compile 
EZ-USB,  but I don't know what to do with it..   When I say I compiled it, I am 
referring to EZUSB.PAS that is included in pas-libusb... but that is just a 
unit,  and I don't know how I could use that to create this firmware.ihx file.  

What is the correct procedure to obtain firmware.ihx?Is there something 
else I need besides the EZUSB unit that would use that unit to create this file?


James

-Original Message-
From: fpc-pascal  On Behalf Of James 
Richters
Sent: Thursday, August 8, 2019 9:37 PM
To: 'FPC-Pascal users discussions' 
Subject: Re: [fpc-pascal] USB Human Interface Devices

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  O

Re: [fpc-pascal] USB Human Interface Devices

2019-08-09 Thread James Richters
I am compiling with the Text IDE, and I set it up with the same settings I was 
using with the 32bit version…  and yes I did turn on Range checking, so that 
explains why we didn’t notice it before.

 

James

 

From: fpc-pascal  On Behalf Of Jean 
SUZINEAU
Sent: Friday, August 9, 2019 12:34 AM
To: James Richters ; 'FPC-Pascal users 
discussions' 
Subject: Re: [fpc-pascal] USB Human Interface Devices

 

Hi James,

 

Le 09/08/2019 à 02:19, James Richters a écrit :

so this was strange... it was working before
 
line 81For 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:

I think it's a typo. 

I think we didn't saw it before because Range type checking was disabled ( 
{$RANGECHECKS OFF} or {$R-} ).  

It seems it's the default value for the compiler: 
https://www.freepascal.org/docs-html/prog/progsu65.html . Very often in Windows 
system functions you have to deal with records with declared with a length of 1 
and the real length stored a few bytes before in the record. This could not 
work with {$R+} 

But it's seems that for some reason it's enabled for your compiler (may be a 
different default value when your recompiled with fpcupdeluxe, or more likely a 
different default value in your settings for fp.exe ?).

I'm not an expert in memory allocation, but I think that while a certain amount 
of memory is allocated after the memory pointed to by PortPath and you're in 
{$R-} mode, you can happily read several bytes after the actual end of PortPath 
without any segmentation fault or memory access exception.

 

 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal