<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:windowtext'>I’m trying to figure out why I get an access violation when I try to open my device with pas-libusb but it works with libusbxhid they both are using libusb-1.0.dll<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>I put a bunch of hacks into pas-libusb to try to figure it out… just a lot of writeln’s so I can try to track down exactly what’s happening. Because if I try to trace through the program I get “Program received signal SIGSEGV Segmentation fault” before I get to the problem<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>I put this in a branch here:<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'><a href="https://github.com/Zaaphod/pas-libusb/tree/Hack/src">https://github.com/Zaaphod/pas-libusb/tree/Hack/src</a><o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>I’m using testopendevic_vidpid2.pas to test it with. <o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Here’s my output:<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>start<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>1<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>2<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>a05472131<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>a10CEEB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>b<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>c<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 8086 10CE A36D EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 8087 10CE 0AAA EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 0424 10CE 2734 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 1D50 10CE 6015 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 1B1C 10CE 0C15 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>TRUE 10CE 10CE EB93 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 05E3 10CE 0610 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 04E8 10CE 61F5 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 1B1C 10CE 0C10 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 0424 10CE 274C EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 047D 10CE 1020 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 1B1C 10CE 1B4F EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 1A40 10CE 0101 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 0C45 10CE 7403 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>FALSE 10C4 10CE EA60 EB93<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>d<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>e<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>H1<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>I<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>4<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Cousldn't connect to device: Access violation<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Here’s as far as I could get….<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>(**<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> * Find endpoint according to MatchFunc<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> *<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> * @param MatchFunc method to compare a given endpoint descriptor with a<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> * criterion<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> *<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> * @returns endpoint or Nil<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> *)<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Function TLibUsbInterface.FindEndpoint(MatchFunc : TLibUsbEndpointMatchMethod) : Plibusb_endpoint_descriptor;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Var IEP : Integer;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> ED : Plibusb_endpoint_descriptor;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Begin<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> writeln('H',FInterface^.bNumEndpoints);<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> For IEP := 0 to FInterface^.bNumEndpoints-1 do<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Begin<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Writeln('I');<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> ED:= @(FInterface^.endpoint^[IEP]);<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> if MatchFunc(ED) then<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Begin<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Writeln('J');<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Exit(ED);<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> End<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> else<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Writeln('K');<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> End;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> Result := Nil;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>End;<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'>MatchFunc(ED) is where the access violation occurs, but I can’t trace any further because I can’t find the function MatchFunc() I just don’t understand where the actual function is.<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>Maybe I made an error in the way I’m trying to open the device? It can’t be any problem with the device itself or using libusb-1.0.dll because that is all working with libusbxhid.. in fact I have all inputs from my device mapped out.. Still don’t have the LCD working…. I can just use libusbxhid, but this is bugging me and I wanted to try to figure out what’s going on.<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:windowtext'>James<o:p></o:p></span></p><p class=MsoNormal><span style='color:windowtext'><o:p> </o:p></span></p></div></body></html>